| |
mcds99
Posts: 416
Score: 4
Joined: 2/28/2006
Status: offline
|
I need (as part of my job) to keep an eye on a couple of directories on a UNIX machine, sure I could use Putty open up sessions to each machine and go to the folder and use the ls command until the cows come home. Not something I like doing when I can make it 1 click and reduce memory use on the server. This could be changed to do the same for windows servers as well. If you need to do this sort of monitoring this little tool might help, it uses plink (part of the putty tool set) to connect using SSH, login, run the command, and exit. [code] <HTML> <head><title>Sys Mon</Title> <HTA:Application Border= "thin" WINDOWSTATE="maximize" Application="SysMon" Scoll="No" Singleinstance="Yes" ShowInTaskbar="Yes" Caption="Yes"> </Head> <Script Language="VBSCRIPT" Type = "text/vbscript"> Sub Window_Onload Window.resizeTo 890,830 End Sub DIM ctr1, ctr2 ctr1 = 0 ctr2 = 0 FUNCTION srvMDP1(uName, pWord) ctr1 = ctr1 + 1 Set objShell1 = CreateObject("WScript.Shell") '### change SERVER and the /dir/dir2 to what you use. Set objWshScriptExec1 = objShell1.Exec("C:\Program Files\Putty\plink -ssh SERVER -l " & uName.value & " -pw " & pWord.value & " ls -lrt /dir/dir2") Set objStdOut1 = objWshScriptExec1.StdOut strOutput1 = objStdOut1.ReadAll DispDirmd1.value = strOutput1 & "Count: " & ctr1 END FUNCTION FUNCTION srvMDP2(uName, pWord) ctr2 = ctr2 + 1 Set objShell2 = CreateObject("WScript.Shell") '### change SERVER and the /dir/dir2 to what you use. Set objWshScriptExec2 = objShell2.Exec("C:\Program Files\Putty\plink -ssh SERVER -l " & uName.value & " -pw " & pWord.value & " ls -lrt /dir/dir2") Set objStdOut2 = objWshScriptExec2.StdOut strOutput2 = objStdOut2.ReadAll DispDirmd2.value = strOutput2 & "Count: " & ctr2 END FUNCTION </Script> <body> <Table> <TR><td>Enter Your Username: </td><td><input type="text" name="uName"></td><td>Enter Your Password: </td><td><input type="PASSWORD" name="pWord"></td><TR> </Table> <Table border="1"> <TR><td><input type="BUTTON" value="SERVER1" onclick="srvMDP1 uName, pWord"><br><textarea name="DispDirmd1" rows="20" cols=100></textarea></td></tr> <TR><td><input type="BUTTON" value="SERVER2" onclick="srvMDP2 uName, pWord"><br><textarea name="DispDirmd2" rows="20" cols=100></textarea></td></tr> </Table> </body> </html> [code]
_____________________________
Sam Keep it Simple Make it Fun KiSMiF
|
|