creating SNMP monitoring for MC.. any interest?

Talk about anything...

Moderators: FlorianB, Pascal, bourgeois, mentor

dallenk
Posts: 45
Joined: Thu Nov 10, 2011 7:06 am
How did you hear about Mailcleaner: google

creating SNMP monitoring for MC.. any interest?

Postby dallenk » Thu Dec 29, 2011 5:05 am

I know this has been asked a couple times in the past.. but I am currently creating a way to monitor stage1 logs using snmp extend options with a cron job and a script installed to the MC servers.. I have it somewhat working and counting several of the events in the stage1 logs.. if anybody is interested in the cacti template when I'm sure it's working correctly just post here, I'll update this thread with screenshots and progress as I go.. Have a bunch of bugs to work out still..
Last edited by dallenk on Fri Dec 30, 2011 7:21 am, edited 1 time in total.
screwloose
Posts: 29
Joined: Sun Dec 18, 2011 9:46 am
How did you hear about Mailcleaner: google

Re: SNMP monitoring for MC

Postby screwloose » Thu Dec 29, 2011 7:06 am

We use cacti also and would be most interested.
Please keep us updated :)
dallenk
Posts: 45
Joined: Thu Nov 10, 2011 7:06 am
How did you hear about Mailcleaner: google

Re: SNMP monitoring for MC

Postby dallenk » Fri Dec 30, 2011 6:38 am

Well, here is my first ugly graphs for MC.. I'm by no means a cacti expert and am having some difficulty in generating graphs the way I want... I created two templates that are created by using snmp walk on a custom extend from the MC snmpd.conf file.. cron runs this script every minute and updates.. Cacti polls it and creates the graphs..

here you can see a test message I sent to a known user.. shown by both graphs.. in/out, and the filter_forward in the events log

main in-out.png
main in-out.png (23.4 KiB) Viewed 8240 times


This graph shows events during each minute of the stage1 log.. there are spikes at each 5 min interval showing the (blocked) attempt to deliver mail.. so incoming Q shows stuck messages.. this will be usefull to create thresholds and alarms should there be a time where mail builds in the Queue.

events.png
events.png (29.55 KiB) Viewed 8240 times


I'm having some difficulties in the exact number not graphing correctly, and for some reason each step seems to have a little training portion of the graph.. still working the bugs out.. but progress is progress..
dallenk
Posts: 45
Joined: Thu Nov 10, 2011 7:06 am
How did you hear about Mailcleaner: google

Re: creating SNMP monitoring for MC.. any interest?

Postby dallenk » Tue Jan 03, 2012 11:08 pm

Well here is my first round of templates for for Cacti to monitor State 1 logs on Mailcleaner. I verified that the difficulties with the graphs were just the way that RRDTool works. This is based from other peoples work and not all my own.. credit given to:

Ian P. Christian, and his work that got me thinking about doing this in the first place. http://pookey.co.uk/wordpress/archives/ ... ide-part-1
Matthew Newton - University of Leicester: original script author that I further modified for Mailcleaner


Mailcleaner templates.rar
(12.35 KiB) Downloaded 201 times


INSTRUCTIONS:

1 - add the custom extend to /usr/mailcleaner/bin/dump_snmpd_config.pl stop/start SNMP
print TARGET "extend .1.3.6.1.4.1.8607.64 mx-stats /bin/cat /var/mailcleaner/run/exim_stage1_statistics\n";

Code: Select all

   while(<TEMPLATE>) {
      my $line = $_;

      $line =~ s/__VARDIR__/$config{'VARDIR'}/g;
      $line =~ s/__SRCDIR__/$config{'SRCDIR'}/g;

      print TARGET $line;
   }

   my @disks = split(/\:/, $snmpd_conf{'__DISKS__'});
        my $disk;
        foreach $disk (@disks) {
                print TARGET "disk      $disk   100000\n";
        }
        print TARGET "extend .1.3.6.1.4.1.8607.64 mx-stats /bin/cat /var/mailcleaner/run/exim_stage1_statistics\n";

   close TEMPLATE;
   close TARGET;

restart SNMP

Code: Select all

/usr/mailcleaner/etc/init.d/snmpd stop; sleep 2
/usr/mailcleaner/etc/init.d/snmpd start



2 - copy exim_stage1_stats.pl file to /usr/local/bin/ chmod appropriately to allow execution by the cron user (if you restrict it)
manually execute this script to populate the statistics file created in /var/mailcleaner/run/

3 - test smpwalk from cacti.. make sure you see data returned. yours should not be "0" if everything is working

Code: Select all

Important stuff is near the bottom:
[root@nms ~]# snmpwalk -v2c -cmailcleaner 10.40.250.31 .1.3.6.1.4.1.8607.64
~~~
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.1 = STRING: "0"
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.2 = STRING: "0"
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.3 = STRING: "0"
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.4 = STRING: "0"
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.5 = STRING: "0"
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.6 = STRING: "0"
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.7 = STRING: "0"
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.8 = STRING: "0"
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.9 = STRING: "0"
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.10 = STRING: "0"
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.11 = STRING: "0"
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.12 = STRING: "0"
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.13 = STRING: "0"
SNMPv2-SMI::enterprises.8607.64.4.1.2.8.109.120.45.115.116.97.116.115.14 = STRING: "0"

4 - add the cron job IMPORTANT - run this script again manually before putting into service, or allow enough time for cron to execute it twice.. otherwise you will get a huge spike in your graphs as it will read EVERYTHING in mainlog and mainlog.0

Code: Select all

*/1 * * * * /usr/local/bin/exim_stage1_stats.pl


After the cron has run you should start seeing values in the statistics file

Code: Select all

cat /var/mailcleaner/run/exim_stage1_statistics


If everything is working so far, you can import the three XML graph templates into Cacti (i created them on Version 0.8.7i )




PLEASE post feedback on things you don't like, or would like to see added or separated or just plain hate.. I am very new to creating my own templates so don't expect much quite yet. I will be creating more templates for further monitoring..

*** I only have a few values being graphed, so if someone can submit stage1 logs with greylisting, i would be more than happy to add it to the templates.
Last edited by dallenk on Wed Jan 04, 2012 8:54 am, edited 2 times in total.
dallenk
Posts: 45
Joined: Thu Nov 10, 2011 7:06 am
How did you hear about Mailcleaner: google

Re: creating SNMP monitoring for MC.. any interest?

Postby dallenk » Tue Jan 03, 2012 11:33 pm

another note.. keep in mind I have no idea if running cvs updates will either mess up your installation or blow all this away, so please be aware everything here is at your own risk.. I'll try to support as much as I can but in the end it is user risk to modify anything in your mailcleaner installation.

This can be installed on all of your servers. Master or slave. I will also be working on creating aggregate graphs that will pull all servers together into a single graph for the most important values.

Cacti thresholds can be created against these values to alert you to problems on the server.. For instance if you have a DNS problem and your server cannot resolve names, you will end up with mail sitting in your queues.. a threshold on the current smtp_defer count could alert you to a problem and allow you to fix it long before any users even notice it.
olivier
Posts: 1348
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: creating SNMP monitoring for MC.. any interest?

Postby olivier » Wed Jan 04, 2012 1:27 am

I may miss something here but.. why not using the included official MIB of MailCleaner for these data ?
The MIB is available here https://your_mailcleaner/admin/download ... ER-MIB.txt .
The SNMP daemon will then be able to provide you with all rejected/delayed/accepted/spam/clean/viruses/spool counts/etc... data (and also per domain). This is what is used in the "monitoring -> status" panel for the different graphics.
But maybe is there some data missing ?
dallenk
Posts: 45
Joined: Thu Nov 10, 2011 7:06 am
How did you hear about Mailcleaner: google

Re: creating SNMP monitoring for MC.. any interest?

Postby dallenk » Wed Jan 04, 2012 1:55 am

LOL. I didn't know the MIB could supply everything already in that fashion. I didn't notice that part of the docs (not sure how I missed it)

I will be rewriting my templates now :) Thanks.. and If I see anything that could be better for more granularity is it something that can be added to future versions ??
olivier
Posts: 1348
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: creating SNMP monitoring for MC.. any interest?

Postby olivier » Wed Jan 04, 2012 9:33 am

dallenk wrote:I didn't notice that part of the docs (not sure how I missed it)

mmhh.. maybe because MailCleaner is not (yet) the most documented product :wink: .. working on it.

dallenk wrote:and If I see anything that could be better for more granularity is it something that can be added to future versions ??
feel free to ask. I cannot guarantee, of course, but if it sounds useful, there's no reason why we wouldn't add it.

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest