| | | Junior Member
       
Group: Forum Members Last Login: 8/15/2008 3:10:51 PM Posts: 18, Visits: 50 |
| We have a few NetApps at our site. I would like to create a VBscript monitorto monitor the usage of the volumes. Heres the setup:
NetApp 1
OID: 1.3.6.1.4.1.789.1.5.4.1.2
Instances:
1 aggr0
2 aggr0/.snapshot
3 /vol/vol0/
4 /vol/vol0/.snapshot
NetApp 2
OID: 1.3.6.1.4.1.789.1.5.4.1.2
Instances:
1 aggr0
2 aggr0/.snapshot
3 aggr1
4 aggr1/.snapshot
5 /vol/vol1/
6 /vol/vol1/.snapshot
7 /vol/vol0/
8 /vol/vol0/.snapshot
9 /vol/vol2/
10 /vol/vol2/..
11 /vol/vol3/
12 /vol/vol3/..
My question is can I scan through to get the instance ID for let's say /vol/vol1/? I want to use the instance ID from here for multiple OID's. I think that once I determine instance ID I should be able to handle it from there. |
| | | | Junior Member
       
Group: Forum Members Last Login: 8/15/2008 3:10:51 PM Posts: 18, Visits: 50 |
| | Ok well I have figured out a way to do this without using the SNMP stuff since I couldn't get any reponses. I am sharing this with you so you may use it as well. 1. The first thing I did was get the plink application from the PuTTy site and put it in C:\ on the WhatsUp server. 2. Then run "plink -ssh root@host -pw password df" as the account running WhatsUp and accept the key. Perfomance Monitor Source Code: Set wshShell = CreateObject("WScript.Shell") volPath = "/vol/vol0/" sshUser = "root" sshPW = "Password" sshHost = Context.GetProperty("Address") set sResult = wshShell.exec("C:\plink.exe -ssh " & sshUser & "@" & sshHost & " -pw " & sshPW & " df -m " & volPath) Do wshShell.Run "ping -n 2 -w 100 localhost", 0, True Loop Until sResult.Status <> 0 While Not sResult.StdOut.AtEndOfStream strLine = Trim(sResult.StdOut.ReadLine) Do While InStr(1, strLine, " ") strLine = Replace(strLine, " ", " ") Loop dfParts = Split(strLine, " ") If dfParts(0) = volPath Then sPath = dfParts(0) nTotal = Replace(dfParts(1), "MB", "") nUsed = Replace(dfParts(2), "MB", "") nAvail = Replace(dfParts(3), "MB", "") pUsed = Replace(dfParts(4), "%", "") End If Wend 'Set the performance monitor value to graph Context.SetValue nAvail You can set the setValue to Total Space, Used Space, Available Space, or Percentage Used. This can also be modified to report KB, GB or different Volumes. I also didn't have these credentials saved in WhatsUp so I just added them manually. |
| | | | Forum Member
       
Group: Forum Members Last Login: 2 days ago @ 6:02:41 AM Posts: 34, Visits: 79 |
| | Great script, just what I was looking for! Thanks, I will test it out here in our office. If tested it and I got an error in the system log "Failed to parse the script. Error: The script timed out because it exceeds 60 seconds" and I get a "Win32 error code = -1" Is there a way to test it outside Whatsup? Regards, Sander |
| | | | Junior Member
       
Group: Forum Members Last Login: 8/15/2008 3:10:51 PM Posts: 18, Visits: 50 |
| | You might not have the SSH Keys accepted yet. What's happening is plink is waiting for something to enter 'y' or 'n.' What I did was I ran the plink command as myself and accepted the key and copied the registry value to the system ID (we run WhatsUp as System). You will need to do this with every host you want to connect to. Also take note that you need do this for each host. Example: C:\plink.exe -ssh root@192.168.100.10 -pw ROOTPASSWORD df The server's host key is not cached in the registry. Youhave no guarantee that the server is the computer youthink it is. The server's rsa2 key fingerprint is: ssh-rsa 768 32:a1:d6:db:97:d6:42:bb:27:1c:03:0e:e4:1e:0d:d0 If you trust this host, enter "y" to add the key to PuTTY's cache and carry on connecting. If you want to carry on connecting just once, without adding the key to the cache, enter "n". If you do not trust this host, press Return to abandon the connection. Store key in cache? (y/n) y This will store the key in you registry at the path: HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys With Key name rsa2@22:192.168.100.10 You need to create the registry path (assuming you are running WhatsUp with the Service Account): HKEY_USERS\S-1-5-18\Software\SimonTatham\PuTTY\SshHostKeys And create a new String Value with the name from above and copy and paste the value into the REG_SZ. |
| | | | Forum Member
       
Group: Forum Members Last Login: 2 days ago @ 6:02:41 AM Posts: 34, Visits: 79 |
| | Hi, I did accepted the ssh key. But do I still need to copy it to the registry like you: You need to create the registry path (assuming you are running WhatsUp with the Service Account): HKEY_USERS\S-1-5-18\Software\SimonTatham\PuTTY\SshHostKeys And create a new String Value with the name from above and copy and paste the value into the REG_SZ. Regards, Sander |
| | | | Junior Member
       
Group: Forum Members Last Login: 8/15/2008 3:10:51 PM Posts: 18, Visits: 50 |
| | I hope that you know how to use the registry editor. On the WhatsUp server open the registry editor (regedit32.exe) and copy the values from HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys to HKEY_USERS\S-1-5-18\Software\SimonTatham\PuTTY\SshHostKeys Making new keys and strings as necessary. Or you can use psexec from http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx On the server that is running WhatsUp you can run: psexec -s c:\plink.exe -ssh root@192.168.100.10 -pw PASSWORD df And accept the message there. psexec -s runs the program as the system account so you don't have to hunt the registry. |
| | | | Forum Member
       
Group: Forum Members Last Login: 2 days ago @ 6:02:41 AM Posts: 34, Visits: 79 |
| | HI, I've added the keys in the registry. But I still get the same errors. Any thoughts? Regards, Sander |
| | | | Junior Member
       
Group: Forum Members Last Login: 8/15/2008 3:10:51 PM Posts: 18, Visits: 50 |
| | What account are you running WhatsUp as? Did you change the root password in the script? You can try the following script and we'll go from there. It's basically the same thing, but runable on Windows with some extra output. Change the extension to .vbs and run it in a cmd window: cscript "C:\path\to\vol space.vbs" Post your results.
|
| | | | Forum Member
  |
| |
|