I was going to generalise this before I posted it to the templates/plugins forums, but I don't have time right now. You can see where it is headed though, so hopefully you can take my code and modify it to your needs.
In particular, you will need to modify the regexes to match the transports you have in your config, as well as the definitions of the variables above that part, and the part where it prints out the stats.
Then, cron the script to run every 5 minutes, and redirect the output to /etc/snmp/exim_perf.stats (or wherever you want).
All this script does is do the equivalent of a stateful 'tail' on the exim main.log. It remembers where it finished reading the file the last time, and continues from there, only feeding the new lines to eximstats. When the logfile gets rotated, it processes the last of old one first before processing the new one.
The code isn't pretty, its really just a prototype, but it works.
in your snmpd.conf file you need:
Code: Select all
exec .22.214.171.124.4.1.14464.25 exim_perf.pl /bin/cat /etc/snmp/exim_perf.stats
When you cron the exim_perf.pl script, make sure you cron it on different 5 minute intervals to the poller. You don't want them butting heads at the same time. Its ok for the stats to be a couple of minutes behind imho.
If you have a cluster of machines, I also have another script that can summarise the stats for any number of machines. Let me know if you want me to post it.
I intend to clean all this up someday soon and make some templates; but its difficult because everyone has their own transports defined.