Walkthrough on Postifx monitoring with Cacti

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

Moderators: Moderators, Developers

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

Strange problem

#61 Post by rizcacti » Tue Dec 11, 2007 4:32 pm

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

#62 Post by ScatterBrain » Fri Jan 04, 2008 9:40 am

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
sample.jpg
Over night run of the Posftix monitoring script/tempate for Cacti.
sample.jpg (36.6 KiB) Viewed 14194 times

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

#63 Post by sapofeo » Thu Mar 20, 2008 7:08 am

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 13522 times

GT4NE1
Posts: 7
Joined: Tue Apr 22, 2008 5:32 pm

Not getting output from snmpwalk command

#64 Post by GT4NE1 » Tue Apr 22, 2008 5:37 pm

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
Contact:

#65 Post by sapofeo » Wed Apr 23, 2008 7:33 am

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

#66 Post by GT4NE1 » Wed Apr 23, 2008 4:48 pm

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
Contact:

#67 Post by sapofeo » Thu Apr 24, 2008 7:17 am

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

#68 Post by GT4NE1 » Thu Apr 24, 2008 11:11 am

I got it working. Stupid selinux.

Thanks.

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

#69 Post by delinquent » Thu Jun 12, 2008 11:01 am

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 <[email protected]>
#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

#70 Post by delinquent » Sat Jun 14, 2008 2:24 am

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

#71 Post by Fred » Wed Jul 02, 2008 10:12 am

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

#72 Post by mrfree » Fri Nov 21, 2008 6:40 am

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

#73 Post by mrfree » Mon Nov 24, 2008 5:16 am

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

#74 Post by rtnair » Wed Feb 11, 2009 11:34 pm

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

#75 Post by edgalura » Mon Mar 16, 2009 2:37 am

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