I want to output a command to a specific log and somehow with in that log
for a certain event that happens with in it send a email out. This is what I
have I was wondering since I am new to bash what areas I need to address.
Also I would like to be able to either
A. Run this script against a ip address or a ip list or list of commands
. And if List how would list look like just a normal list of ips separated
by returns?
This is part of my script I have so far. Keep in mind I am new to the bash
process.
#!/bin/bash
#This is script to run snmpget on remote adtrans ip list and sends it to
/var/log/snmp.log
#Developed by Shane
#Network Surveillance
#ipaddr=/tmp/ip.list this is a attempt to do a ip list instead of inputing
specific ips in script
date
echo "Waiting 60 seconds before next command takes place..."
#snmpwalk -v 1 -c public 172.18.60.246:161 1.3.6.1.4.1.664.2.444.1.1.1.1.1 >
/var/log/snmp.log
echo `snmpwalk -v 1 -c public "$ipaddr"`
exit 0
B. Once the output hits the log it will look like this
SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.4 = INTEGER: 2
SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.5 = INTEGER: 2
SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.6 = INTEGER: 2
SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.7 = INTEGER: 3
SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.8 = INTEGER: 3
SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.9 = INTEGER: 4
SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.10 = INTEGER: 4
SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.11 = INTEGER: 5
SNMPv2-SMI::enterprises.664.2.444.1.1.3.1.6.12 = INTEGER: 1
This is the output to the log I would like to send a email if lets say in
instance integer changes from 1 .
Any pointers to the certain things I need to learn or examples similiar or
anything to help me in this would be greatly appreciated. Thanks in advanced