exim statistics

Templates, scripts for templates, scripts and requests for templates.

Moderators: Moderators, Developers

Author
Message
chrome
Posts: 13
Joined: Fri May 13, 2005 1:38 am

exim statistics

#1 Post by chrome » Tue May 17, 2005 7:43 pm

this was split off ofhttp://forums.cacti.net/viewtopic.php?t=7609
Reinhard


Hi Paul,

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 .1.3.6.1.4.1.14464.25 exim_perf.pl /bin/cat /etc/snmp/exim_perf.stats
I do it this way to avoid eximstats from forking off for every oid that gets hit when you smack the snmpd. 'cat' is probably a little less overhead.

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.
Attachments
exim_perf.pl.zip
(1.23 KiB) Downloaded 3876 times

chrome
Posts: 13
Joined: Fri May 13, 2005 1:38 am

#2 Post by chrome » Tue May 17, 2005 7:45 pm

A prettier example :)
Attachments
graph_image-1.png
graph_image-1.png (67.06 KiB) Viewed 53176 times

chrome
Posts: 13
Joined: Fri May 13, 2005 1:38 am

#3 Post by chrome » Tue May 17, 2005 7:49 pm

Here is the graph template with dependencies ... i have no idea if any of this will work if you just throw it in.
Attachments
cacti_graph_template_exim_delivery_statistics.xml
(37.45 KiB) Downloaded 2893 times

Paul Thexton
Posts: 49
Joined: Tue Jan 18, 2005 7:50 am

#4 Post by Paul Thexton » Fri Jul 15, 2005 8:41 am

Excellent - thanks for that, I'll give them ago!

Hildebrand
Posts: 18
Joined: Thu Oct 27, 2005 9:24 am
Location: Germany, Bavaria

#5 Post by Hildebrand » Thu Nov 24, 2005 4:10 am

Thanks for this Script!

I must modified the Transporters in your Script and don´t know how!? :roll:
I looked into the pearl Script and set for example the "ClamAV" to "ditch_malware" but it wont work! Because in my mainlog of Exim is nothing with ClamAV, the one thing i have seen was "ditch_maleware" and "ditch_spam". But this no transporter? Or is this right?

Here some lines of the mainlog:

Code: Select all

2005-11-24 07:38:56 1EfAky-0001hh-Fv <= [email protected] H=mforward.dtag.de [194.25.242.123] P=esmtp S=2385 [email protected] T="lowCostDrugs!" from <[email protected]> for [email protected]
2005-11-24 07:38:56 1EfAky-0001hh-Fv => :blackhole: <[email protected]> R=ditch_spam
Output of your Script after the modification:

Code: Select all

mail:/usr/local/share/cacti/scripts# ./exim_perf.pl
rejected
0
virtual_delivery
7
remote_smtp
2
ditch_spam
0
ditch_malware
0
remote_smtp_single_recipient_domains
0
mail:/usr/local/share/cacti/scripts#
In the mainlog of EXIM are also "rejected" mails that i wont into the Cacti Graph, but i don´t know what to do! Here is an example:

Code: Select all

2005-11-24 07:05:16 H=mforward.dtag.de [194.25.242.123] F=<[email protected]> rejected RCPT <[email protected]>: Unknown user
Thanks 4 help!!
Hildebrand

aleto
Posts: 39
Joined: Wed May 25, 2005 3:57 am

#6 Post by aleto » Sun Jun 11, 2006 4:48 pm

ANyone had luck with these scripts? Ive setted everything up as request but no luck, graphs keep saying NAN.. but they d

umbroboy
Posts: 9
Joined: Thu Apr 06, 2006 4:28 pm

#7 Post by umbroboy » Fri Aug 18, 2006 9:34 am

i try to install the exim4 log.

and it works i think, but i dont know what i must choose in:

Data Source [exim_clamcheck]
The data source to use for this graph item.
Data Source [exim_local_delivery]
The data source to use for this graph item.
Data Source [exim_remote_smtp]
The data source to use for this graph item.
Data Source [exim_single_recipie]
The data source to use for this graph item.
Data Source [exim_spamcheck]
The data source to use for this graph item.
Data Source [exim_trend_micro]
The data source to use for this graph item.


Load Average 15 min?

thanks
marcus

Overflower
Posts: 3
Joined: Fri Oct 27, 2006 1:03 am

Cacti not updating

#8 Post by Overflower » Fri Oct 27, 2006 1:07 am

Hi Guys,

I'm running this script now. But I does not get update in any way.
The exim_perf.pl does ouput info but if I walk the system with snmpwalk all the request come back with "0".

I added this ling to my snmpd.conf at the bottom:
exec .1.3.6.1.4.1.14464.25 /usr/sbin/exim_perf.pl /bin/cat /etc/snmp/exim_perf.stats

If I do a snmpwalk on the spam stats I get this all the time:
SNMPv2-SMI::enterprises.14464.25.101.8 = STRING: "0"

Anyone any idea what I am doing wrong???

Linuxfreak_be
Posts: 22
Joined: Sun Sep 04, 2005 3:30 am
Location: Belgium

#9 Post by Linuxfreak_be » Sun Nov 05, 2006 2:07 pm

hi,

I've installed this.The graph is there but it always stays on 0.When running exim_perf.pl on the shell it runs correctly (no errors returned) but it always displays 0 for the values ....

System:fedora core 5
cpanel /whm
Exim & MailScanner
Attachments
exim.png
exim.png (17.81 KiB) Viewed 50261 times

iYRe
Posts: 40
Joined: Mon May 07, 2007 4:49 pm
Location: Auckland NZ
Contact:

#10 Post by iYRe » Sun May 13, 2007 9:57 pm

you might want to make sure the path to the log file is the right one.. for example, exim on my MX's logs to /var/log/mail.log, but the .pl script says /var/log/exim/mainlog.log

User avatar
KiaN
Posts: 12
Joined: Wed May 04, 2005 6:25 am
Location: Paris, France
Contact:

#11 Post by KiaN » Wed Jul 11, 2007 11:37 am

Same problem here, and the path is correct.
Attachments
graph_image.png
Exim
graph_image.png (33.13 KiB) Viewed 46982 times
http://www.kianouch.com
My pictures ^^

iYRe
Posts: 40
Joined: Mon May 07, 2007 4:49 pm
Location: Auckland NZ
Contact:

#12 Post by iYRe » Wed Jul 11, 2007 3:04 pm

hmm weird, i still cant get mine to work either...
If a man is in a forest, and he speaks to a tree and no woman can hear....

[i]is he still wrong?[/i]

User avatar
dk10tlx
Posts: 19
Joined: Sat Aug 04, 2007 8:10 am
Location: Tirol / Austria
Contact:

#13 Post by dk10tlx » Sat Aug 04, 2007 8:22 am

Hi,

I've tried to modify the script to fit the output/mainlog for Exim4 on a Debian box, using vexim2.

Therefor I use the following routers and transports:
remote_smtp
virtual_delivery
virtual_vacation_delivery
ditch_spam_transport
ditch_spam_drop

Also I'd like to stat the rejected ones. So I modified the Script accordingly, but I get strange errors, when I execute it. Now I think about a way to rewrite it, maybe in PHP, but i don't really know, if or how to do it. Is there someone else using cacti to graph a mailserver using exim4/vexim2? Maybe we could find a solution togehter.

regards
Daniel

User avatar
dk10tlx
Posts: 19
Joined: Sat Aug 04, 2007 8:10 am
Location: Tirol / Austria
Contact:

#14 Post by dk10tlx » Tue Aug 07, 2007 4:44 pm

:D vexim2 and exim4 works now perfectly for me
Attachments
cacti_graph_template_exim_delivery_statistics.xml
(38.29 KiB) Downloaded 1109 times
cacti_data_template_exim4_blackhole.xml
(6.52 KiB) Downloaded 874 times
cacti_data_template_exim4_ditch_spam_transport.xml
(6.54 KiB) Downloaded 1032 times
cacti_data_template_exim4_local_delivery.xml
(6.53 KiB) Downloaded 978 times
cacti_data_template_exim4_mailman.xml
(6.51 KiB) Downloaded 1033 times
regards
Daniel

[size=67]
[b]cacti [color=red]0.8.6j[/color] - cactid [color=red]0.8.6i[/color]
Debian GNU/Linux lenny/sid[/b]
Apache2 - PHP5 - MySQL5[/size]

User avatar
dk10tlx
Posts: 19
Joined: Sat Aug 04, 2007 8:10 am
Location: Tirol / Austria
Contact:

#15 Post by dk10tlx » Tue Aug 07, 2007 4:45 pm

and some more xml's
Attachments
cacti_data_template_exim4_remote_smtp.xml
(6.52 KiB) Downloaded 932 times
cacti_data_template_exim4_virtual_delivery.xml
(6.53 KiB) Downloaded 834 times
cacti_data_template_exim4_virtual_vacation_delivery.xml
(6.54 KiB) Downloaded 849 times
regards
Daniel

[size=67]
[b]cacti [color=red]0.8.6j[/color] - cactid [color=red]0.8.6i[/color]
Debian GNU/Linux lenny/sid[/b]
Apache2 - PHP5 - MySQL5[/size]

Post Reply