MRTG / SMTP
David Kramer
david at thekramers.net
Tue Jul 20 22:09:00 EDT 2004
So I'm fooling around with the whole MRTG thing. I didn't know it could track
pretty much any metric. Way cool. I'm having three problems with it.
1) I can't seem to get it to measure only one number. In the case where
you're tracking something else besides router stats, like "caught spam rate",
and there's only one metric, it bitches that "ERROR: Target[testone][_OUT_] '
$$target[2]{$mode} ' did not eval into defined data". The FM says 'If your
script does not have any data to return but does not want mrtg to complain
about invalid data, it can return 'UNKNOWN' instead of a number." That works
for upime, but not OUT. Wassup with that?
2) I have been focusing on using MRTG to track other things besides router
statistics, just having one server with a WAN card (eth0) and a LAN card
(eth1), but it would be kinda cool to track them. The SMTP syntax confuses me
though. Can anyone tell me what Target I would need to track the WAN side and
the LAN side?
3) I have this target that's not producing any output, though it looks like it
should be. I have two IMAP mail folders; one has caught spam, one has
uncaught spam. I wrote a script that produces line counts for both files and
produces the expected MRTG input. For instance, if I run the script now, I
get (between the lines. Lines not included):
----------------------
423
22
UNKNOWN
Spam Count
----------------------
When I display the graph, it always displays zeros for both. When I turn on
log debugging, I can see that rateup is getting data to save:
----------------------
2004-07-20 21:55:42 -- --log: Called /usr/bin/rateup
/srv/www/htdocs/mrtg/logs/ spamcount 1090374942 -Z u 423 22 500 c #00cc00
#0000ff #006600 #ff00ff l [emails] k 1000 i
/srv/www/htdocs/mrtg/spamcount-day.png -500 -500 400 100 1 1 0 300 0 4 1 i
/srv/www/htdocs/mrtg/spamcount-week.png -500 -500 400 100 1 1 0 1800 0 4 1
----------------------
The entry in the config file looks like
----------------------
Target[spamcount]: `/usr/bin/perl /etc/mrtg/agent_spamcount.pl`
MaxBytes[spamcount]: 500
Title[spamcount]: Spam Count
PageTop[spamcount]: <H1>Spam Count</H1>
YLegend[spamcount]: emails
ShortLegend[spamcount]: emails
LegendI[spamcount]: Caught Spam
Legend1[spamcount]: Caught Spam
LegendO[spamcount]: Missed Spam
Legend2[spamcount]: Missed Spam
----------------------
Anyh help is much appreciated. Sorry, this one is not worth a dozen pizzas.
--
DDDD David Kramer david at thekramers.net http://thekramers.net
DK KD
DKK D "...Just remember what the MPAA says: horrific, deplorable violence
DK KD is OK, as long as people don't say any naughty words."
DDDD Cartman's Mom
More information about the Discuss
mailing list