Postfix Queues

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

Moderators: Developers, Moderators

enash
Posts: 25
Joined: Tue Oct 04, 2005 9:41 am
Location: Clearwater, FL
Contact:

Re: Anyone...

Post by enash »

sterpstra wrote:Sorry for the bump but I would like to get this template working before I go over to the Mailgraph-based one...

Anyone have any ideas?
[/quote]

Has anyone got this working.. Error: XML: Hash version does not exist.
enash
Posts: 25
Joined: Tue Oct 04, 2005 9:41 am
Location: Clearwater, FL
Contact:

think i found it.

Post by enash »

I realized i am running version CACTID 0.8.6e. I will just have to wait till I upgrade the server and reinstall cacti.
enash
Posts: 25
Joined: Tue Oct 04, 2005 9:41 am
Location: Clearwater, FL
Contact:

Post by enash »

OK so theres is no way i can upgrade cacti right now, so I have to get this graphing some how.. I have followed serveral of the ideas in this thread. I have getmailq.sh working on the mail server itself. I also have used the idea from one post to have the output going to a file that is readable. Both work. So now here is what is left that i need to do. Be able to have the cacti host produce a readable graph by doing one of the following, either via snmp call the getmailq.sh script on the mail server and get the results and graph them, or read the mailqueuestats file i have that gets data every minute from crontab and graph those results. I guess the final problem is how do i graph my results from my script? Non of the XML templates will load, I get XML hash or parse error. And i believe its because i am using version 0.8.6e.

someone help!!
ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

Post by ehall »

If you absolutely must get this working, you have two options, neither of which may or may not work

1) look in the include directory for the file that contains the version hashes and change it so that the hash is associated with a known version. make a backup first and restore it afterwards, obviously.

2) use regular expressions to search and replace the hash information in the file you are trying to import. this is how I make my templates work with older versions--I change the exported hash version.
xseries
Posts: 8
Joined: Mon Jul 27, 2009 11:52 am
Location: Netherlands

Post by xseries »

Hello,

I'm rather new to cacti and snmp; so please forgive me if i'm asking for the wrong things.

I'm trying to get my outgoing mailserver graphed (postfix) in cacti.

On the mailserver I've this script :
#!/bin/sh

QUEUES="incoming active deferred hold"

for i in $QUEUES; do
# COUNT=`qshape $i | grep TOTAL | awk '{print $2}'`
# COUNT=`find /var/spool/postfix/$i -maxdepth 5 -type f | wc -l`
COUNT=`find /var/spool/postfix/$i -type f | wc -l`
printf "$i:$COUNT "
# printf "$i:456 "

done
This is called getmailq.sh

When I run in from the commandline it counts the messages in the 4 postfix queues and returns e.g. :
incoming:1 active:0 deferred:80 hold:0

But; when I do a snmpwalk; like :
%snmpwalk -Oav -v 2c -c public xxx.xxx.xxx.xxx .1.3.6.1.4.1.2021.53.101.0.4

It returns : STRING: "incoming:2 active:0 deferred:0 hold:0 "
So the deferred count won't be in my string...

The data is furthermore processed in Cacti; and the graph is being made.

Cacti is running on a different machine; but I think the problem is somewhere in snmp because it doesn't pick up the right data ?

I don't think it 's a rights-problem; the user snmp has rights to read the contens of the /var/spool/postfix/active, /deferred, /incoming and /hold-directories...

When running this on another mailserver; I receive the right data of the queue; but my snmp-walk string must be different (may be another version of net-snmp; i've the figure this out).
variable
Posts: 5
Joined: Sun Aug 17, 2008 2:19 pm

Post by variable »

Just in case anyone else didn't feel like having to enter in a separate host IP address for this graph, I edited the template.

Thanks for all the work everyone!
-Eric
Attachments
cacti_graph_template_postfix_queues.xml
this template uses the devices management ip
(18.47 KiB) Downloaded 776 times
Muffinman
Posts: 17
Joined: Thu Apr 12, 2007 1:48 am

Re: Postfix Queues

Post by Muffinman »

valec wrote:And on the Cacti host I have:

Code: Select all

#!/bin/bash
#/usr/share/cacti/site/scripts/postfixqueues.sh

output=`/usr/bin/snmpwalk -Oav -v2c -c syzygy $1 .1.3.6.1.4.1.2021.53.101.0.101.1 | cut -d '"' -f 2`
printf "$output"
echo
I had the output

Code: Select all

/var/www/cacti/scripts/postfixqueues.sh: line 6: echo: write error: Broken pipe
So I canged the script to

Code: Select all

#!/bin/bash
output=`/usr/bin/snmpwalk -Oav -v2c -c syzygy $1 .1.3.6.1.4.1.2021.53.101.0.101.1 | cut -d '"' -f 2`
echo $output
And now am lucky!
Thanks for the script and the templates!
kiruah
Posts: 5
Joined: Tue May 04, 2010 8:52 am

Post by kiruah »

Hello,

in SNMP, can be decomposed into integer values rather than having a string ?

Thanks
pexotinec
Posts: 2
Joined: Thu Jun 28, 2012 10:52 pm

Re: Postfix Queues

Post by pexotinec »

Help me plz guys!
I dont understand what iv do wrong
Graph does not show

On cacti server:
snmpwalk -v 1 -c public 10.20.100.244 .1.3.6.1.4.1.2021.53.101.0
UCD-SNMP-MIB::ucdavis.53.101.0.1.0 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.2.5.109.97.105.108.113 = STRING: "/usr/local/bin/getmailq.sh"
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.3.5.109.97.105.108.113 = ""
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.4.5.109.97.105.108.113 = ""
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.5.5.109.97.105.108.113 = INTEGER: 5
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.6.5.109.97.105.108.113 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.7.5.109.97.105.108.113 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.20.5.109.97.105.108.113 = INTEGER: 4
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.21.5.109.97.105.108.113 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.53.101.0.3.1.1.5.109.97.105.108.113 = STRING: "incoming: 0 active: 0 deferred: 2 hold: 0 "
UCD-SNMP-MIB::ucdavis.53.101.0.3.1.2.5.109.97.105.108.113 = STRING: "incoming: 0 active: 0 deferred: 2 hold: 0 "
UCD-SNMP-MIB::ucdavis.53.101.0.3.1.3.5.109.97.105.108.113 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.53.101.0.3.1.4.5.109.97.105.108.113 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.53.101.0.4.1.2.5.109.97.105.108.113.1 = STRING: "incoming: 0 active: 0 deferred: 2 hold: 0 "

On monitor server:
snmpwalk -v 1 -c public 10.20.100.244 .1.3.6.1.4.1.2021.53.101.0
UCD-SNMP-MIB::ucdavis.53.101.0.1.0 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.2.5.109.97.105.108.113 = STRING: "/usr/local/bin/getmailq.sh"
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.3.5.109.97.105.108.113 = ""
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.4.5.109.97.105.108.113 = ""
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.5.5.109.97.105.108.113 = INTEGER: 5
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.6.5.109.97.105.108.113 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.7.5.109.97.105.108.113 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.20.5.109.97.105.108.113 = INTEGER: 4
UCD-SNMP-MIB::ucdavis.53.101.0.2.1.21.5.109.97.105.108.113 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.53.101.0.3.1.1.5.109.97.105.108.113 = STRING: "incoming: 0 active: 0 deferred: 2 hold: 0 "
UCD-SNMP-MIB::ucdavis.53.101.0.3.1.2.5.109.97.105.108.113 = STRING: "incoming: 0 active: 0 deferred: 2 hold: 0 "
UCD-SNMP-MIB::ucdavis.53.101.0.3.1.3.5.109.97.105.108.113 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.53.101.0.3.1.4.5.109.97.105.108.113 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.53.101.0.4.1.2.5.109.97.105.108.113.1 = STRING: "incoming: 0 active: 0 deferred: 2 hold: 0 "
Attachments
Postfix Queues.jpg
Postfix Queues.jpg (67.6 KiB) Viewed 3411 times
TraceElements
Posts: 2
Joined: Thu Jun 25, 2015 11:03 am

Re:

Post by TraceElements »

monachus wrote:if using newer versions of net-snmp, you should use the extend directive instead of the exec directive, which will require some changes to the scripts:

in snmpd.conf:

Code: Select all

extend mailq /usr/local/bin/getmailq.sh

in postfixqueues.sh:

Code: Select all

/usr/bin/snmpget -Oqav -v2c -c<community> -t30 $1 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."mailq".1' | cut -d '"' -f 2
also, in newer versions of postfix, "qshape" has become "qshape.pl." check on your system for the updated version.

This was great advice, though to make it work I had to change the 'cut' part to a sed command as it was just returning "mailq" since it was in double quotes. Here's the sed command I used to replace the cut command, now this awesome mailq monitor script is working for me :)

Code: Select all

sed -n -e 's/^.*STRING: //p'
Example output of the script after this change:

incoming:0 active:0 deferred:1 hold:0

Love this forum, thanks to everyone who's here :)
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests