Walkthrough on Postifx monitoring with Cacti

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

Moderators: Developers, Moderators

rizcacti
Posts: 2
Joined: Wed Jan 25, 2006 6:49 am

Strange problem

Post by rizcacti »

Hello.

I'm trying to graph postfix with this template, but I have some problem.

Code: Select all

server:/usr/local/bin# ./fetch_mail_statistics.pl /var/log/mail.log /var/log/mailstats.db .1.3.6.1.4.1.2021.255 -n .1.3.6.1.4.1.2021.255
.1.3.6.1.4.1.2021.255.0
integer
9
It seems to be ok.

Code: Select all

server:/usr/local/bin# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.255
UCD-SNMP-MIB::ucdavis.255.0 = INTEGER: 9
UCD-SNMP-MIB::ucdavis.255.1 = INTEGER: 10
UCD-SNMP-MIB::ucdavis.255.2 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.3 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.4 = INTEGER: 36
UCD-SNMP-MIB::ucdavis.255.5 = INTEGER: 10
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
..and this is also seems ok.

But the graph isn't ok, as you can see:

Image

Could someone please tell me what is wrong ?

Thanks in advance.
ScatterBrain
Posts: 1
Joined: Tue Jan 09, 2007 2:07 pm

Post by ScatterBrain »

I'm having trouble making this script run in a consistant manner.

My Cacti machine is a separate machine than my mail server(s). I've followed the instructions and it seems to mostly work. But like nuber (his post is on page three of this thread) I've got to run the script manually on the mail server before Cacti can retrieve any data.

But unlike nuber, I get different error messages in the poller log:

Code: Select all

01/04/2008 09:05:22 AM - CMDPHP: Poller[0] Host[41] DS[897] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur  
01/04/2008 09:05:22 AM - CMDPHP: Poller[0] Host[41] DS[896] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur  
01/04/2008 09:05:22 AM - CMDPHP: Poller[0] Host[41] DS[895] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur  
01/04/2008 09:05:22 AM - CMDPHP: Poller[0] Host[41] DS[894] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur  
01/04/2008 09:05:22 AM - CMDPHP: Poller[0] Host[41] DS[893] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur  
01/04/2008 09:05:22 AM - CMDPHP: Poller[0] Host[41] DS[892] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur  
01/04/2008 09:05:22 AM - CMDPHP: Poller[0] Host[41] DS[891] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur  
01/04/2008 09:05:22 AM - CMDPHP: Poller[0] Host[41] DS[887] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur  
01/04/2008 09:05:22 AM - CMDPHP: Poller[0] Host[41] DS[888] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur  
01/04/2008 09:05:22 AM - CMDPHP: Poller[0] Host[41] DS[889] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur  
01/04/2008 09:05:22 AM - CMDPHP: Poller[0] Host[41] DS[890] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur  
01/04/2008 09:05:20 AM - CMDPHP: Poller[0] Host[38] DS[883] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur  
01/04/2008 09:05:20 AM - CMDPHP: Poller[0] Host[38] DS[882] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur  
01/04/2008 09:05:20 AM - CMDPHP: Poller[0] Host[38] DS[884] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur  
01/04/2008 09:05:20 AM - CMDPHP: Poller[0] Host[38] DS[885] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur  
01/04/2008 09:05:20 AM - CMDPHP: Poller[0] Host[38] DS[886] WARNING: Result from SNMP not valid. Partial Result: No Such Instance cur 



Host 38 and 41 are my mail servers and the DS entries noted are the Postfix templates. (Host 41 is a Spam Filter and therefore has many more data points to look for.)

I've attached a sample of my output graph below. So my question is what can I do make this any better?
Attachments
Over night run of the Posftix monitoring script/tempate for Cacti.
Over night run of the Posftix monitoring script/tempate for Cacti.
sample.jpg (36.6 KiB) Viewed 15345 times
sapofeo
Posts: 13
Joined: Thu Feb 17, 2005 5:23 pm

Post by sapofeo »

First of all, thanks to all that have worked on this script.

I'm also having an issue capturing data above 1024. The script itself is returning a value of "0" whenever the actual value is above this threshold. I haven't been able to find any information on limitations of perl (arrays, memory issues, etc) that may be causing this. To my untrained eye, the script seems correct. Attached is what I'm seeing. Any insight would be greatly appreciated.
achoi wrote:Hi,

I am a problem trying to show data that is over 1024. I have already changed to the maximum value in the data template to 100000, but my graph still won't graph anything higher than 1000.

Please help. thanks!
Attachments
postfix2.JPG
postfix2.JPG (38.61 KiB) Viewed 14673 times
GT4NE1
Posts: 7
Joined: Tue Apr 22, 2008 5:32 pm

Not getting output from snmpwalk command

Post by GT4NE1 »

Hi all,

I'm trying to get this working, but I can't even get an output from the snmpwalk command. Doesn't give an output nor an error.

Code: Select all

snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.255
If I remove the .255, I do get some output.

Code: Select all

snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021
UCD-SNMP-MIB::memIndex.0 = INTEGER: 0
UCD-SNMP-MIB::memErrorName.0 = STRING: swap
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 2064376
UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 2064376
UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 4045072
UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 2955756
UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 5020132
UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000
UCD-SNMP-MIB::memShared.0 = INTEGER: 0
UCD-SNMP-MIB::memBuffer.0 = INTEGER: 84580
UCD-SNMP-MIB::memCached.0 = INTEGER: 855044
UCD-SNMP-MIB::memSwapError.0 = INTEGER: 0
UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING:
.
.
.
I do get output if I run the following command manually though.

Code: Select all

/usr/local/bin/fetch_mail_statistics.pl /var/log/maillog /var/log/mailstats.db .1.3.6.1.4.1.2021.255 -g .1.3.6.1.4.1.2021.255
.1.3.6.1.4.1.2021.255.0
integer
14
What am I missing? Am I missing some kind of Postfix MIB or something?

Thanks,

-GT
sapofeo
Posts: 13
Joined: Thu Feb 17, 2005 5:23 pm

Post by sapofeo »

I ended up fixing my problems by raising the maximum value in the RRD file.

I recently upgraded to 0.8.7b and blew up again though. NAN across the board.

GT4NE1, did you make the necessary entry in snmp.conf?

pass .1.3.6.1.4.1.2021.255 /usr/local/bin/fetch_mail_statistics.pl /var/log/maillog /var/log/mailstats.db .1.3.6.1.4.1.2021.255
GT4NE1
Posts: 7
Joined: Tue Apr 22, 2008 5:32 pm

Post by GT4NE1 »

Yes. This snmpd.conf change needs to be made on the monitored host correct?
sapofeo wrote:I ended up fixing my problems by raising the maximum value in the RRD file.

I recently upgraded to 0.8.7b and blew up again though. NAN across the board.

GT4NE1, did you make the necessary entry in snmp.conf?

pass .1.3.6.1.4.1.2021.255 /usr/local/bin/fetch_mail_statistics.pl /var/log/maillog /var/log/mailstats.db .1.3.6.1.4.1.2021.255
sapofeo
Posts: 13
Joined: Thu Feb 17, 2005 5:23 pm

Post by sapofeo »

yes, on the monitored host. It sounds like the host is setup correctly. Try running the snmpwalk every few seconds. I see that my host tends to time out every so often (granted it throws a timeout error).
GT4NE1
Posts: 7
Joined: Tue Apr 22, 2008 5:32 pm

Post by GT4NE1 »

I got it working. Stupid selinux.

Thanks.
delinquent
Posts: 10
Joined: Thu Oct 25, 2007 1:27 am

Post by delinquent »

This error has been discussed before, but this seems to a different issue.

I've had this working before, but if done a reinstall and am now having problems.

Code: Select all

netra-svr:/etc/snmp# snmpwalk -v 2c -c public netra-svr .1.3.6.1.4.1.2021.255
UCD-SNMP-MIB::ucdavis.255 = No Such Instance currently exists at this OID
netra-svr:/etc/snmp# snmpget -v 2c -c public netra-svr .1.3.6.1.4.1.2021.255
UCD-SNMP-MIB::ucdavis.255 = No Such Instance currently exists at this OID
netra-svr:/etc/snmp#
I can run the script manually and it works:

Code: Select all

netra-svr:/usr/local/bin# ./fetch_mail_statistics.pl /var/log/mail.log /var/log/mailstats.db .1.3.6.1.4.1.2021.255 -n .1.3.6.1.4.1.2021.255
.1.3.6.1.4.1.2021.255.0
integer
0
if i use -g rather than -n when i manually run the script, is saves the value for what appears to be the time set in the script by the var $MINRESET

Code: Select all

netra-svr:/usr/local/bin# snmpwalk -v 2c -c public netra-svr .1.3.6.1.4.1.2021.255
UCD-SNMP-MIB::ucdavis.255 = No Such Instance currently exists at this OID
netra-svr:/usr/local/bin# ./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
.1.3.6.1.4.1.2021.255.0
integer
0
netra-svr:/usr/local/bin# snmpwalk -v 2c -c public netra-svr .1.3.6.1.4.1.2021.255
UCD-SNMP-MIB::ucdavis.255.0 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.2 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.3 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.4 = INTEGER: 1
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
netra-svr:/usr/local/bin#
I can't seem to fault the config. I've done everything right (as far as i know), i haven't changed the values of the fetch_mail_statistics.pl script...

Does anyone have any idea's as to why snmp doesn't seem to be keeping the values? If you need more info, please ask....

Here's my config:
Linux netra-svr.network.athome 2.6.24-1-sparc64 #1 Thu May 8 17:12:30 UTC 2008 sparc64 GNU/Linux

Package: snmpd
Source: net-snmp
Version: 5.4.1~dfsg-7.1


snmpd.conf

Code: Select all

############### SNMPD Configuration ################
#####################################################

################ SECURITY ################

#       sec.name        source          community
com2sec readonly        default         public

#                       sec.model       sec.name
group   MyROGroup       v2c             readonly

#               incl/excl       subtree                          mask
view    all     included        .1                               80

#                context sec.model sec.level match  read   write  notif
access MyROGroup ""      any       noauth    exact  all    none   none


################ GENERAL ################

syslocation Tob of Cabinet, Backroom
syscontact Chris <admin@network.athome>
#master  agentx


################ MISC ################
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
perl srcipt location

Code: Select all

netra-svr:/usr/local/bin# ls
total 16K
drwxrwsr-x  2 root staff 4.0K 2008-06-12 23:43 .
drwxrwsr-x 10 root staff 4.0K 2008-05-28 19:03 ..
-rwxrwxrwx  1 root root  5.5K 2008-06-12 23:29 fetch_mail_statistics.pl
mailstats file

Code: Select all

netra-svr:/var/log# ls mailstats*
-rwxrwxrwx 1 root root 29 2008-06-12 23:30 mailstats.db
delinquent
Posts: 10
Joined: Thu Oct 25, 2007 1:27 am

Post by delinquent »

I've fixed my problem.....

For all of those that are intersted, as of snmpd version 5.2 the default user that SNMP runs as has changed from root to snmp. What that basically means is any *fresh* install of snmpd above 5.2 will have snmp as the user, but if you upgraded from a previous version (im refering to debian and apt) it will NOT change the user (hence why this script worked on my previous install which was a old snmpd 4 install).

I've changed the running user back to root and it worked.
Fred
Cacti User
Posts: 81
Joined: Fri Jan 03, 2003 11:43 am

Post by Fred »

GT4NE1 wrote: I'm trying to get this working, but I can't even get an output from the snmpwalk command. Doesn't give an output nor an error.

...

I got it working. Stupid selinux.
Can you describe what you did?

I'm getting the same behavior. When I run the script manually as the snmp user, /var/db/mailstats.db is created correctly. But when I try to snmpwalk, I get no output (no error, no nothing).
mrfree
Posts: 2
Joined: Fri Nov 21, 2008 6:36 am

Post by mrfree »

I'm trying to get it working but...

Code: Select all

/usr/local/bin/fetch_mail_statistics.pl /var/log/mail.log /var/tmp/mailstats.db .1.3.6.1.4.1.2021.255 -n .1.3.6.1.4.1.2021.255
.1.3.6.1.4.1.2021.255.0
integer
0

Code: Select all

snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.255
UCD-SNMP-MIB::ucdavis.255.0 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.0 = INTEGER: 0
Error: OID not increasing: UCD-SNMP-MIB::ucdavis.255.0
 >= UCD-SNMP-MIB::ucdavis.255.0
Any idea?
mrfree
Posts: 2
Joined: Fri Nov 21, 2008 6:36 am

Post by mrfree »

okokok... my fault :)
I read the snmpd.conf man and modified the fetch_mail_statistics.pl entry with

Code: Select all

pass .1.3.6.1.4.1.2021.255 /usr/local/bin/fetch_mail_statistics.pl /var/log/mail.log /var/tmp/mailstats.db .1.3.6.1.4.1.2021.255
now it works correctly ;)
rtnair
Posts: 1
Joined: Wed Feb 11, 2009 11:25 pm

Post by rtnair »

Hi
I am new to cacti. I want to monitor my postfix server activity.

Imported the host template attached with the first post in this thread into my cacti installation successfully.
Along with host template, it created 2 graph templates, and updated some other stuff too. Seems that the setup serves my purpose.

But I am not able to make out the syntax used in this xml file and am curious to know how to create such template xmls for different purposes. can somebody guide me through the syntax and procedure?

Sorry if I'm asking something trivial. But I think this will help many others too.

-Raja.
edgalura
Posts: 14
Joined: Fri Jun 06, 2008 3:23 pm

posfix | cyrus | cacti

Post by edgalura »

Hi guys,

I tried running the script on the host machine where postfix is running and manage to get a results:

[mailserver]:/export/home/egalura # snmpwalk -v 1 -c [mydomain] [my ip] .1.3.6.1.4.1.2021.255
UCD-SNMP-MIB::ucdavis.255.0 = INTEGER: 123
UCD-SNMP-MIB::ucdavis.255.1 = INTEGER: 40
UCD-SNMP-MIB::ucdavis.255.2 = INTEGER: 24
UCD-SNMP-MIB::ucdavis.255.3 = INTEGER: 3
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

also i manage to get results where cacti is installed

[localhost]:~ # snmpwalk -v 1 -c [mydomain] [mailserver] .1.3.6.1.4.1.2021.255
UCD-SNMP-MIB::ucdavis.255.0 = INTEGER: 33
UCD-SNMP-MIB::ucdavis.255.1 = INTEGER: 7
UCD-SNMP-MIB::ucdavis.255.2 = INTEGER: 7
UCD-SNMP-MIB::ucdavis.255.3 = INTEGER: 2
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

but the graph is still empty.
Is this scripts only compatible for the machine where cacti and postfix runs?

Please help? I'm running out of ideas where to look.

thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests