The S in SNMP is a joke. But for your problem, the Net-SNMP agent offers an easy way out. It supports remote query of custom parameters aka scripts using the
pass-through extensions of its UCD MIB under .1.3.6.1.4.1.2021... Assuming
exim -bpc is no CPU hog, you are set with a simple wrapper returning OID, type (string/integer/counter) and the output value. If it is expensive to run, maybe a simple caching layer between invocations would do it.
Update:
Now I see your example and properly recollect the snmpd.conf options. You can write:
exec exim_output_ucd /usr/bin/exim -bpc
extend exim_output_ns /usr/bin/exim -bpc
pass .1.3.6.1.4.1.55555.1 /usr/local/bin/exim_wrapper
To pull the results of old UCD exec, walk .1.3.6.1.4.1.2021.8
For the newer Net-SNMP extend, walk .1.3.6.1.4.1.8072.1.3.2
Both return string output, which may not work well with a snmp poller for graphing.
To create a proper gauge at .1.3.6.1.4.1.55555.1, make a
/usr/local/bin/exim_wrapper like:
#!/bin/sh
case "$1" in
-g) echo ".1.3.6.1.4.1.55555.1" # you are enterprise 55555
echo "gauge"
exec exim -bps
;;
esac
_______________________________
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.