Walkthrough on Postifx monitoring with Cacti
Moderators: Developers, Moderators
Can't get to the MIB
Hey guys,
Just having a bit of trouble browsing to the correct MIB. I'm running a GENTOO box.
/ # snmpwalk -v 2c -c public [computername] .1.3.6.1.4.1.2021.255 UCD-SNMP-MIB::ucdavis.255 = No Such Object available on this agent at this OID
Have I made a mistake or is there an easy way to find out which branch I should be going to.
Cheers
Just having a bit of trouble browsing to the correct MIB. I'm running a GENTOO box.
/ # snmpwalk -v 2c -c public [computername] .1.3.6.1.4.1.2021.255 UCD-SNMP-MIB::ucdavis.255 = No Such Object available on this agent at this OID
Have I made a mistake or is there an easy way to find out which branch I should be going to.
Cheers
First of all, did you have restarted the snmpd daemon after adding the pass configuration line ?
Secondly, the OID is fixed by the pass configuration line :
Secondly, the OID is fixed by the pass configuration line :
Here the 1.3.6.1.4.1.2021.255 Oid will be assign to fetch script. You can walk the whole Net-SNMP dedicated tree .1.3.6.1.4.1.2021 if you are not sure of the configuration ![/i]pass .1.3.6.1.4.1.2021.255 /usr/local/bin/fetch_mail_statistics.pl /var/log/mail.log /var/log/mailstats.db .1.3.6.1.4.1.2021.255
The problem was in my version of the fetch_mail_statistics.pl script file, when I had pasted the txt into vi in the cvs comments the $ symbol was not commented out and this was what was causing the script and everything else not to work.
Thanks for all your help... and I will now walk away with head bowed and my tail between my legs.
Thanks for all your help... and I will now walk away with head bowed and my tail between my legs.
cacti & amavis
Mathieu, thanks for all the assistance. I finally got it working and in case anyone's interested using snmp to monitor amavis, see http://forums.cacti.net/viewtopic.php?t=3190
Hi everyone!
Thanks for the perl script, i've changed to fetch also SPF information and seems to work very well.
But one question, the $MINRESET isnt supposed to be 300 seconds ? The time that cacti waits to get updated information ? Or the Data Source/Template is configured to fetch data at 50/50 seconds ?
Thanks for the perl script, i've changed to fetch also SPF information and seems to work very well.
But one question, the $MINRESET isnt supposed to be 300 seconds ? The time that cacti waits to get updated information ? Or the Data Source/Template is configured to fetch data at 50/50 seconds ?
-
- Posts: 1
- Joined: Wed May 31, 2006 4:36 pm
No Graphs
thought I'd mention this to elaborate on a problem I think Giovanni had.
I had mine up and running and I could use snmpwalk to verify stats were being collected. However, I was getting no graphs. If you meet those criteria, you probably need to go to the console, click on the data templates option, then for each option
ETC, you need to manually enter the OID for each query. The OIDs are as follows... this applies to fetch_mail_statistics.pl,v 1.6 2004/11/07
Do not check the box just below "oid" where is says Use Per-Data Source Value (Ignore this Value)
Hope this helps someone as much as it helped me
I had mine up and running and I could use snmpwalk to verify stats were being collected. However, I was getting no graphs. If you meet those criteria, you probably need to go to the console, click on the data templates option, then for each option
Code: Select all
ucd/net - Postfix - Bad Header
ucd/net - Postfix - Banned Content
Code: Select all
Bad Header - .1.3.6.1.4.1.2021.255.9 (This applied to bad headers passed and blocked)
Banned Content - .1.3.6.1.4.1.2021.255.10
Bounced - .1.3.6.1.4.1.2021.255.3
Clean - .1.3.6.1.4.1.2021.255.5
Deferred - .1.3.6.1.4.1.2021.255.2
Possible Spam - .1.3.6.1.4.1.2021.255.6
Received - .1.3.6.1.4.1.2021.255.0
Rejected - .1.3.6.1.4.1.2021.255.4
Sent - .1.3.6.1.4.1.2021.255.5.1
Spam - .1.3.6.1.4.1.2021.255.7
Virus - .1.3.6.1.4.1.2021.255.8
Hope this helps someone as much as it helped me
Problem with Potential Spam and Spam graphs
Hey Guys,
I was having problems with possibly spam and spam being shown on the Mail filtering graph.
So I checked the header information and I realised that my "Hits" was not what my system was using in the X-Spam- header but actually score.
So I have modified the fetch_mail_statistics.pl file. Unfortunatley I really don't care about possible spam... As I rarely find that my setup gets false positives. But hey... no biggie just pass through all mail to my users that under a certain score but wrap it so I preface it that it may be spam. That should keep them happy.
Ok so what code did I change well I basically deleted the lines in the elsif that refer to spam and posible spam and added
elsif ( /score=([-+]?[0-9]*\.?[0-9]+)/) {
$hits = $1;
$num_clean++ if ($hits < $SPAMLVL);
$num_spam++ if ($hits >= $SPAMLVL);
}
That way the num clean increments and the number that spam increment.
If you want to check syntax on your own box or check certain things use this script
#! /usr/bin/perl -W
$temp = 0;
$SPAMLVL = 6.3;
print "opening file\n";
open (TEMP, "/var/log/amavis.log") or die "can't open file \n";
while ( <TEMP> ){
#print $_;
if( /score=([-+]?[0-9]*\.?[0-9]+)/) {
$temp++ if ($1 >= $SPAMLVL);
#print $2;
#print "\n";
#$temp = $temp + $0;
}
}
print $temp;
Just modify the if as need be and the componenets you want to search for. I have left a couple of test print statments in the loop just uncomment them as need be. Please also don't forget to change the log file that you are using.
Thanks for the great scripts and posts by everyone I have found it really helpful and currently have a fully working system that use Postfix, Amavis, ClamAV, DCC, pyzor, LDAP, MYSQL, Spamassasin and Cacti. I can now monitor both my Postfix and Amavis to see what is really going on in the system.
Hopefully before my contract is up I will be working on a per/domain monitoring system. If I get it to work in time I will post it.
I was having problems with possibly spam and spam being shown on the Mail filtering graph.
So I checked the header information and I realised that my "Hits" was not what my system was using in the X-Spam- header but actually score.
So I have modified the fetch_mail_statistics.pl file. Unfortunatley I really don't care about possible spam... As I rarely find that my setup gets false positives. But hey... no biggie just pass through all mail to my users that under a certain score but wrap it so I preface it that it may be spam. That should keep them happy.
Ok so what code did I change well I basically deleted the lines in the elsif that refer to spam and posible spam and added
elsif ( /score=([-+]?[0-9]*\.?[0-9]+)/) {
$hits = $1;
$num_clean++ if ($hits < $SPAMLVL);
$num_spam++ if ($hits >= $SPAMLVL);
}
That way the num clean increments and the number that spam increment.
If you want to check syntax on your own box or check certain things use this script
#! /usr/bin/perl -W
$temp = 0;
$SPAMLVL = 6.3;
print "opening file\n";
open (TEMP, "/var/log/amavis.log") or die "can't open file \n";
while ( <TEMP> ){
#print $_;
if( /score=([-+]?[0-9]*\.?[0-9]+)/) {
$temp++ if ($1 >= $SPAMLVL);
#print $2;
#print "\n";
#$temp = $temp + $0;
}
}
print $temp;
Just modify the if as need be and the componenets you want to search for. I have left a couple of test print statments in the loop just uncomment them as need be. Please also don't forget to change the log file that you are using.
Thanks for the great scripts and posts by everyone I have found it really helpful and currently have a fully working system that use Postfix, Amavis, ClamAV, DCC, pyzor, LDAP, MYSQL, Spamassasin and Cacti. I can now monitor both my Postfix and Amavis to see what is really going on in the system.
Hopefully before my contract is up I will be working on a per/domain monitoring system. If I get it to work in time I will post it.
[newbie with postfix]
Hello,
my MTA is postfix, but i don't find my /var/log/mailstats.db...
Where (or in which config file) do i find this file?
I found : /etc/postfix/access.db...
Regards,
my MTA is postfix, but i don't find my /var/log/mailstats.db...
Where (or in which config file) do i find this file?
I found : /etc/postfix/access.db...
Regards,
Hi ryaz, the mailstat.db file is created by the Perl script called fetch_mail_statistics.pl.
You must first call the script by hand to get the file created or configure snmpd with a line like the below example and then walk throught the OID thanks to snmpwalk.
Hope this will help you a little.
Mathieu[/b]
You must first call the script by hand to get the file created or configure snmpd with a line like the below example and then walk throught the OID thanks to snmpwalk.
Code: Select all
pass .1.3.6.1.4.1.2021.255 /usr/local/bin/fetch_mail_statistics.pl /var/log/mail.log /var/log/mailstats.db .1.3.6.1.4.1.2021.255
Mathieu[/b]
I have followed Instigater's instructions, but have been unable to maintain the statistics in SNMP. The only way I've been able to get it to work is by first doing this on the mail server:
Upon running that piece of code, it shows the following in SNMP:
However, that information is quickly deleted for some reason (MINRESET?).
Therefore, after that information expires, the poller generates the following error which was documented earlier in this thread.
Anyone have some ideas on what I might be doing wrong?
Thanks ahead of time!
Code: Select all
/etc/snmp/fetch_mail_statistics.pl /var/log/mail.log /var/log/mailstats.db .1.3.6.1.4.1.2021.255 -g .1.3.6.1.4.1.2021.255
Code: Select all
snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.255
UCD-SNMP-MIB::ucdavis.255.0 = INTEGER: 5
UCD-SNMP-MIB::ucdavis.255.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.255.2 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.3 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.4 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.5 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.6 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.7 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.8 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.9 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.10 = INTEGER: 0
Therefore, after that information expires, the poller generates the following error which was documented earlier in this thread.
Code: Select all
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: .1.3.6.1.4.1.2021.255.0
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: .1.3.6.1.4.1.2021.255.4
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: .1.3.6.1.4.1.2021.255.1
Thanks ahead of time!
You migth have done some modification on the fetch perl script. Could you attach your version of the script to a forum post ?
For your question on $MINRESET script variable, here is a brief description on how it is used in the script .
Begin Script
Compute TimeSinceLastUpdate
If TimeSinceLastUpdate > $MINRESET
Compute NewStatistics
Store NewStatistics Into Dbfile
End If
Load Statistics Out of Dbfile
Print Statistics
End Script
Mathieu
For your question on $MINRESET script variable, here is a brief description on how it is used in the script .
Begin Script
Compute TimeSinceLastUpdate
If TimeSinceLastUpdate > $MINRESET
Compute NewStatistics
Store NewStatistics Into Dbfile
End If
Load Statistics Out of Dbfile
Print Statistics
End Script
Mathieu
Who is online
Users browsing this forum: No registered users and 1 guest