Included here are some sample script files we've written as examples for use with SNMPc. They are meant as examples of what is possible and are not meant to be efficient or even error free. linktest.vbs ------------ This script polls three interfaces of a device and returns a status based on how many are up. To use it, go to the service polling properties, and add a new service with the script value set to "cscript.exe //B linktest.vbs $i". This script demonstrates the mapattr.exe, snmpget.exe, and snmptrap.exe command line utilities and has an example of a user defined node attribute (LINKQOS) which stores the last state so warnings are not generated on every poll. memtest.vbs ----------- This script uses WMI to poll the memory usage statistics on a Windows server, will generate a trap when it is lower than a certain value, and set the "quality of service" to the percent memory free. To use this script, add a service polling profile that runs "cscript.exe //B memtest.vbs $i 10" where the number is the percent value you want to see an alarm for. It contains examples of the mapattr and snmptrap command line programs, and the use of WMI to poll Windows servers. Note that you must run the SNMPc polling service under an account with permissions on the remote Windows server. You may be able to set authentication parameters on the winmgmts object, but that is beyond the scope of these examples. Also, this script doesn't keep track of the previous state and will continue issuing warnings when memory is below threshold. svctest.vbs ----------- Uses a similar method to the above memtest script, but polls for Windows service status. Add a serivce polling profile that runs "cscript.exe //B svctest.vbs $i "Service Name"", replacing "Service Name" with the name of the service you want to monitor. This does not issue any of its own alert traps like the prior examples, but relies entirely on the returned value to set the QOS of the service. Note that a QOS of 0 will generate a service down alarm in SNMPc. Again, you must run the SNMPc polling service under an account with permissions on the remote Windows server. svctest2.vbs ------------ Another service polling example, but uses a different method. Uses the same arguments as svctest.vbs. sc.bat ------------ Another service polling example, but uses the sc.exe command line app. Add a service profile that runs "cmd.exe /c sc.bat $a "Service Name"". This sample is more efficient than either of the vbs examples. https.vbs --------- This script will allow you to do an HTTPS (or any other web) request and search the results for a string. To use this script, add a new service profile which runs "cscript.exe //B https.vbs https://$a/ "search string"". The script will return success if the page is received and the "search string" is found in the body of the page. filesize.vbs ------------ This script will check the filesize of a file provided on the command line. Add a service profile that runs "cscript.exe //B filesize.vbs \\$a\C$$\pagefile.sys 1000000000" with the name of the file you want to monitor, and the size for which you want an alarm. The example here with $a assumes the SNMPc polling service has access to the C$ share on the remote server. The $$ is replaced by a single $. You can, of course, poll files on local drives, but network share drive letters are not accessible in the service environment, so UNC paths must be used. sqlquery.bat ------------ This script polls the status of a Microsoft SQL server. You provide the server, user, password, and database to query on the command line. The script polling service would look like "cmd.exe /c sqlquery.bat $a sa SA_password master". You must have the sqlcmd.exe program installed and somewhere in the search path environment variable. onlnode.vbs ----------- This script is not for polling, but can be used with the SNMPc console double click or custom menu items to launch an SNMPc OnLine node summary for the selected node. Just run "wscript.exe onlnode.vbs $i" from the menu item. * Note there were bugs in script polling prior to 7.1.2, so make sure you are running the latest version.