Script Template

OpManager's script monitoring helps you execute your home-grown scripts and alerts you with the script output. It supports PowerShell, Linux shell script, VBScript, Perl and Python scripts out-of-the-box. In this page, the most commonly used script templates have been compiled; these templates can be imported to OpManager to make your network monitoring easier. You can assign this template to a device to get script outputs.

For steps on how to create, add, test, and associate script templates among other activities, please check this page.


How to import/export script monitoring templates?

The import/export template option is useful when you want to share a custom template you created with the community or import a template from the community.

Importing templates

  • Step 1 : Download the required templates to your local machine.
  • Step 2 : Go to Settings > Monitoring > Script Templates page. Click on the Import link to browse and import the templates.

Custom Script Templates

 
MSSQL Command output

Getting an integer value from a local or remote MSSQL db Query server using sqlcmd utility.

Download 
Use case-
Prerequisites

sqlcmd utility should have been installed in the server where OpManager is and "sqlcmd" must be a recognized command.

The remote SQL server should not be configured with dynamic ports.

The firewall should be disabled. It should not prevent OpManager server's access to remote SQL server's port.

Limitations

We can query only two columns from a table., provided the second column should return an integer value.

For better performance - query should not return more than 20 rows

Command Linecscript ${FileName}.vbs <sqlserver>\<instance,port> <dbusername_optional> <dbpassword_optional> <dbname> <query>
Arguments

sqlserver: Sql Server name

instance: Instance name

port: Mssql Port

dbusername_optional: Username (not required for local server)

dbpassword_optional: Password (not required for local server)

dbname: DataBase Name

query: Query to execute

Examplecscript ${FileName}.vbs 172.10.10.10\SQLSERVER,1433 sa mssql12 EmployeeDB "select emp_name,emp_salary from Employee"
SHA 256dc2278563ff716a895684a6ec392b6cb509c690124b5ebb6734a29dec259a6bb
 
SNMP v2 Credential check

This script will periodically check the SNMP response and alert the user if credential is failing or SNMP agent isn't responding.

Download 
Use caseThere could be some situations where the SNMP service has stopped or read community string used for monitoring the devices has changed in the device. OpManager using that credential would stop collecting the data for those devices. Unfortunately, there is no option to alert the wrong credential.
PrerequisitesCompatible Net-SNMP should be installed and its executable should be kept in the path ie user should be able to run the executable from any directory.
LimitationsOnly SNMP v1/v2/v2c can be tested.
Arguments-
Example-
SHA 2567c4d8cc52f6b5a2de075b30db8d31fda3e32464c451faa1cc91ea6c39b662780
 
Process Count Monitoring

This Powershell script uses WMI to get the processes on a Windows device and gives you a total count. You can configure OpManager to alert you when the number of processes exceeds a certain count.

Download 
Use case-
Prerequisites-
Limitations-
ArgumentsNo Change
Example-
SHA 256183ae28f093c2acb14000edd9188bd19559bcb2514a56f3a13175373eb1a7c47
 
Windows Volume Mount Point

This VBS Script lets you monitor Windows Volumes Mount Point utilization

Download 
Use case-
Prerequisites-
Limitations-
ArgumentsNo Change
Example-
SHA 2564f5f8c4d23aad6d95db77fda39ca4aac73eed1fbc00b9ec13b80e61b30cf901e
 
SSL Certification Expiry Monitor

This is a VBScript to get the number of days remaining for a website's SSL Certificate to expire.

Download 
Use case-
PrerequisitesOpen SSL should be installed on the OpManager server. After importing the script, change the installation path of the openssl.exe in the following line within the script body. PluginPath = "C:\Program Files\OpenSSL-Win64\bin\"
Limitations-
Argumentscscript ${FileName}.vbs <ssl_addr> ${FileName}.txt
<ssl_addr> : Ssl certificate address
Example cscript ${FileName}.vbs www.opmanager.com:443 ${FileName}.txt
SHA 2563177312dfb4d8054389d82635af0a55a8962faecf1063de44fc1d833e4c63410
 
Certificate Expiry Monitor

A PowerShell script to check the expiry date of the certificates in the Windows machine on which OpManager is installed.

Download 
Use case-
Prerequisites-
Limitations-
Arguments-
Example-
SHA 256997e08cab7e26b5597cf3fd6e7f733094bc59775eb282a717b9e9575e6a5ff56
 
Windows Security Logs Usage Monitor

VBS script to get the security logs' usage percentage of a Windows device.

Download 
Use case-
Prerequisites-
Limitations-
ArgumentsNo need to change
Example-
SHA 256233ffb916880125c602925d8f42bdf3d8058ec007584478a71400d1ca3428fd8
 
Date and Time in Italian Format

VBScript to show the date and time in Italian Format.

Download 
Use case-
Prerequisites-
Limitations-
ArgumentsNo Change
Example-
SHA 25653e6b01588716f294aea5ac9bcdb0a0f1047472439565649b98611fbcc15cdc9
 
Windows Disk Utilisation Monitor

Shows the usage of Disk in percentage for each drive.

Download 
Use case-
Prerequisites-
Limitations-
ArgumentsNo need to change any arguments
Example-
SHA 2561059442b53643fb13e775a1dfbbe0f2ac9ef2b3fff3efb409495e046c993b18c
 
PoolNonpagedMemory - VBscript

VBScript to monitor the PoolNonpagedMemory in MB.

Download 
Use case-
Prerequisites-
Limitations-
Arguments-
Example-
SHA 2563dffb635450fc6e6103746a6eeae201e8a8fb0e9954031b208d3ca43c3d5a0c3
 
Linux FileAvailability Monitor

Shell script to check whether a file is present in monitored Linux machines.

Download 
Use case-
Prerequisites-
Limitations-
Argumentssh ${FileName}.sh <Valid_File_Path>
Examplesh ${FileName}.sh /home/guest/MyFile.txt
SHA 256e7426c6b92b2fef39b4441621e29152d85ee158ca1713c27dff5696ea78883eb
 
FileCheckSum Monitor

Shell Script to check if any changes have been done in a file.

Download 
Use caseThis Script checks for changes in a given file - it will raise an alarm in case of a change (any change) in the file content.
Prerequisites-
Limitations-
Argumentssh ${FileName}.sh <Valid_File_Path>
Examplesh ${FileName}.sh /home/guest/test.txt
SHA 2568a5910809cb4cc3304018545bbc10ebc2e7d9a154d8a85731ae8081ce05620e0
 
Windows SysupTime Monitor

To get the system up-time value in hours using WMI and to store the value in hours.

Download 
Use case-
Prerequisites-
Limitations-
ArgumentsLeave the commandline as it is.
Example-
SHA 25667daf8b979c5fb188391d37891807cfd1fa984aa8997b29a42d6e459db5f3f32
 
File count Monitoring in Linux Folder

Monitoring the file count in a folder using Script Monitor.

Download 
Use caseGet the number of files in folder using this Script.
Prerequisites-
Limitations-
Arguments

sh ${FileName}.sh <FolderPath>

FolderPath : Give the valid path of the folder inLinux

Examplesh ${FileName}.sh /home/test/myFolder
SHA 2564d83c5b9576f80dc1a867c9e240f9764d8bb6276c6bf4f221d986153d6db5b34
 
Windows FileAge Monitoring

It returns the file age (created time - current time) in days, months, hours, etc. of all local and remote files under a directory and its subfolders using VBScript.

Download 
Use case-
Prerequisites-
Limitations

1. OpManager server and Remote server should exist on the same network.

2. Drives/Files of remote machine is accessible.

Arguments

cscript ${FileName}.vbs ${DeviceName} ${UserName} ${Password} <DIRECOTORY_PATH> <TIMEUNIT> <IS_RECURSIVE>

DIRECOTORY_PATH = valid directory path ( in case of remote file -> d:\ - should be provided as d$\ )

TIMEUNIT = Allowed values are - [ year, month, week, day, hour, minute and second]

IS_RECURSIVE = true to scan sub-folder, false to exclude sub-folders

Example

Remote cscript ${FileName}.vbs ${DeviceName} ${UserName} ${Password} " d$\OPMInstallation\OpManager\logs" month true

Local: cscript ${FileName}.vbs ${DeviceName} "d$\OPMInstallation\OpManager\logs" month true

SHA 256ed3f2d3867cb59a75a1d00a310a67f8a3cbd1b479ba843c94d5b20eec20f155b