[TriLUG] scripted sesssions with ssh

Lance A. Brown lance at bearcircle.net
Tue Jul 7 23:32:37 EDT 2009

Joseph Mack NA3T said the following on 7/7/2009 9:57 PM:
> On Tue, 7 Jul 2009, Heath Roberts wrote:
>> What are you monitoring? Could you maybe install an SNMP agent?
> a lot of the parameters don't have SNMP eg disk temp (via smartctl).
> I've never used SNMP because it looks like a lot of work to write the
> client/server (agent/something) whereas I can get the disk temp from
> smartctl in one line with grep/awk.

If you can get it with a quick command line, you can get the data via
SNMP using 'exec' functionality in snmpd.conf.  It lets you plug the
output of a command (shell script, C, whatever) into SNMP so it can be

#  You can also have programs run by the agent that return a single
#  line of output and an exit code.  Here are two examples.
#  exec NAME PROGRAM [ARGS ...]
#  NAME:     A generic name.
#  PROGRAM:  The program to run.  Include the path!
#  ARGS:     optional arguments to be passed to the program

#exec echotest /bin/echo hello world

# Then,
# % snmpwalk -v 1 localhost -c public .
# enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1
# enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest"
# enterprises.ucdavis.extTable.extEntry.extCommand.1 = "/bin/echo hello
# enterprises.ucdavis.extTable.extEntry.extResult.1 = 0
# enterprises.ucdavis.extTable.extEntry.extOutput.1 = "hello world."
# enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0


 GPG Fingerprint: 409B A409 A38D 92BF 15D9 6EEE 9A82 F2AC 69AC 07B9
 CACert.org Assurer

More information about the TriLUG mailing list