SNMP on Leopard (Mac OS 10.5) not working properly?

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
criuz
Posts: 1
Joined: Sun Nov 09, 2008 9:32 am

SNMP on Leopard (Mac OS 10.5) not working properly?

Post by criuz »

I have this perl script at /tmp/shtest:

Code: Select all

#!/bin/sh
 echo hello world
 echo hi there 
 exit 35
Which outputs:

Code: Select all

$ /bin/sh /tmp/shtest
hello world
hi there
When I want to execute this script with SNMP exec I add this to my /usr/share/snmp/snmpd.conf:

Code: Select all

exec shtest /bin/sh /tmp/shtest
And call snmpwalk with following command:

Code: Select all

$ snmpwalk -On -v 2c -c public localhost .1.3.6.1.4.1.2021.8
which gives:

Code: Select all

$ snmpwalk -On -v 2c -c public localhost .1.3.6.1.4.1.2021.8
.1.3.6.1.4.1.2021.8.1.1.1 = INTEGER: 1
.1.3.6.1.4.1.2021.8.1.2.1 = STRING: shtest
.1.3.6.1.4.1.2021.8.1.3.1 = STRING: /bin/sh
.1.3.6.1.4.1.2021.8.1.100.1 = INTEGER: 35
.1.3.6.1.4.1.2021.8.1.101.1 = STRING: hello world
.1.3.6.1.4.1.2021.8.1.102.1 = INTEGER: noError(0)
.1.3.6.1.4.1.2021.8.1.103.1 = STRING:
As you can see the second line of the output is missing. Hm,.. this way I can not use SNMP for graphing purposes. Anyone has a clue?

TIA, criuz
User avatar
Linegod
Developer
Posts: 1626
Joined: Thu Feb 20, 2003 10:16 am
Location: Canada
Contact:

Post by Linegod »

exec and sh commands, on their own, can only have a single line of output.

You either have to create a separate script for each output, or use assign the script to a MIB.

Note: That is a shell script, not a perl script.
--
Live fast, die young
You're sucking up my bandwidth.

J.P. Pasnak,CD
CCNA, LPIC-1
http://www.warpedsystems.sk.ca
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests