Independent SNMP OID Monitoring

Document ID : KB000010538
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

At times it is important to compare CA UIM snmp data with data from a separate source to confirm functionality.  It can be difficult to catch the monitored device at the appropriate times, so the following scripts are designed to gather data for as long as the user allows it to run.  The output includes a time stamp so it can be compared to data from the raw data, UMP's Performance reports, etc.

*These scripts are provided for informational use only.  CA does not maintain or support products from other companies or groups.*

Instructions:

Windows SNMP Script
1. Use a web search to find an appropriate tool to do Windows command line snmp walks.  This script assumes that the user installed SnmpWalk.
2. Determine which OID the script needs to monitor.  To get this from CA UIM snmpcollector, a user can do a Vendor Certification Test.
3. Replace the items in the script bordered by asterisks with the appropriate IP address, OID or user name.
2. Copy the script below into a text file and call this file something arbitrary like snmpwalk_repeat.bat.
3. From a command line in that directory, type: snmpwalk_repeat.bat
4. Ensure this batch file created a new file called "snmpwalk_output.txt" and that it is filling with OID output.
5. Wait for the issue with CA UIM SNMP monitoring to reoccur.  Stop this script with ctrl+C and compare the output from CA UIM.
Batch file contents begin here:
  ::Replace the text in the asterisks with appropriate strings
  @echo off
  :loop
  echo %date% %time% >> C:\Users\*user name*\Desktop\snmpwalk_output.txt
  snmpwalk -v 2c -c public *Device IP address* *OID* >> *Path*\snmpwalk_output.txt
  timeout /t 120  ::this is the number of seconds to wait between repeated commands
  goto loop

Linux SNMP Script
1. Install a program like SnmpWalk.  On Red Hat: yum install net-snmnp-utils
2. Save the text below as a file called snmpwalk_repeat.sh
3. Use chmod to make it executable.  Example:  chmod u+x snmp_output.sh
4. Start the script with a command like:  ./snmpwalk_repeat.sh
5. This script will continue running until the user presses ctrl + C.
Linux shell script content begins here:
  # Replace the text in the asterisks with appropriate strings
  #!/bin/bash
  while true;
  do date>>snmp_output.txt;snmpwalk -v2c -c public *IP address* *OID*>>*Path*/snmp_output.txt;
  sleep 120;  # this is the number of seconds to wait between repeats
  done;