I'll preface this by saying I'm just a novice, with just basic knowledge of shell scripting, as well as basic knowledge in SNMP. I working on a script that takes the motd file on a solaris 5.x box and parses the information out into an OID to be passed to the SNMP server. We're using SysEDGE client and Spectrum on the server end.
MOTD file:
-----------------------------------
#******************************************************#
# IN CASE OF EMERGENCY, CALL FRONTLINE SUPPORT AT (555) 555-5555
#
# Primary ESA = FirstN LastN
# Secondary ESA = FirstN LastN
# Primary Customer = FirstN LastN
# Primary DBA = FirstN LastN
# System Location = MK E-09 T1-CH2-03
# Business Unit = Dev Interfaces #1
# Console = Blade Center
# System Type = 7998-60X
#******************************************************#
Code to parse out what needed:
--------------------------------------------------------
#!/bin/sh
# Shell script to pull primary ESA out of a file
# Define some stuff
FILENAME=/etc/motd
# Do work
grep "Primary ESA" $FILENAME|cut -d\= -f2
This works great to pull just the one line out.
This script then needs to be added to the sysedge.cf file as:
-----------------------------------------------------------
extension 1 OctetString readwrite '/etc/primaryesa.sh'
extension 2 OctetString readwrite '/etc/secondaryesa.sh'
etc....
I realize that the script won't set the snmp OID to this value, and that's were I'm having the issue. What I want to do is to have a single script that pulls all the information sequentially as it's being called from the .cf file. I've tried to manually set the value, but was getting snmpset: Varbind could not be created. I've not created the MIB extensions on the server yet, but I was just trying to set the OID value to the private local machine(127.0.0.1). What am I missing? Can someone please help?:wall:
Jeff