Now, that's an interesting issue, just my thing! Assuming you have a way
of gatering data (as you indicate) using a script, you can make that
data snmp readable using snmpd and the "pass" or "pass_persist" feature.
What you need to do:
1 - Edit /etc/snmp/snmpd.conf and add the following line:
pass .1.3.6.1.3.x /path/script.php
Adjust the x and the script/program to suit your needs. the x can be any
number, since .1.3.6.1.3 is the SNMP experimental tree free for you to
use much like RFC 1918 IP addresses (10.0.0.0/8, 172.16.0.0/12 and
192.168.0.0/16). I used my phone number as x in a project:)
While you're there, set up an SNMP community that can be used to read
your new private tree:
rocommunity public 0.0.0.0/0
(more lines may be needed depending on config and version)
2 - Write a program/script to serve OID values. The script should take
two arguments. The first is query type and the second the requested OID.
Query type is -g for get and -n for get next so basically the script
could be run manually like this:
# script.php -g .1.3.6.1.3.12345.1.0
.1.3.6.1.3.12345.1.0
integer
0
So, the output NEEDS to be:
OID (with leading dot...)
type
value
Not that hard to accomplish as long as your data can be processed by the
script. I have used a MySQL database to store the data gathered and then
used that dB to read values using the PHP script.
If you need read performance exceeding more than a few snmpreads per
second you need to consider the "pass_persist" feature. We can do 8
reads per second with the "pass" script, and spawning the new process
for each read is probably what takes so much time. I originally
implemented it for a low-rate reading application, but then "they" kept
increasing the demands on read performance... Surely there are lots of
examples out there with pass_persist.
How will you be reading data from your device? Telnet/SSH/HTTP/...?
"expect" is a function we all "love to hate" with its TCL syntax, but
very usable for automatically telnetting/SSHing into a switch or
whatever and do things automagically. After getting the data, putting it
in a database or file in a structured way readable by the "pass" script
is the next task for you, but then, you're done! I even monitor a Dell
server using the "ipmitool" program from Dell that is supposed to be
interactive, but "expect" does the interactivity for me once evey minute...
pass_persist:
http://www.net-snmp.org/wiki/index.php/Tut:Extending_snmpd_using_shell_scripts
Expect:
http://www2.tcl.tk/11583
/Fredrik
Craig Taylor skrev 2014-04-03 17:30:
I want to proactively monitor a small storage system with Net SNMP,
but the storage doesn't allow querying with snmpget commands. Can I
create an external script to get the string another way and pass that
string onto the tool like it came from an snmpget command?
If yes, any help on how to do this would be appreciated.
Thanks,
Craig D. Taylor
m: 630.485.9975
e: taylo...@us.ibm.com
------------------------------------------------------------------------------
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
------------------------------------------------------------------------------
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users