Ad blocker detected: Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker on our website.
#!/bin/bash
#getmailq.sh - written by Valec 2006. Steal and share.
#Get postfix queue lengths
#Place in /usr/local/bin/
#exec .1.3.6.1.4.1.2021.53.101.0 mailq /usr/local/bin/getmailq.sh
QUEUES="incoming active deferred hold"
for i in $QUEUES; do
COUNT=`qshape $i | grep TOTAL | awk '{print $2}'`
printf "$i:$COUNT "
done
Place in /usr/local/bin/
Add the following to /snmpd.conf:
after try, i have problem. the graphic show nan, and manual running snmpwalk give info :
bash-3.00# snmpwalk -v1 -c gagak localhost .1.3.6.1.4.1.2021.53.101.0
UCD-SNMP-MIB::ucdavis.53.101.0.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.53.101.0.2.1 = STRING: "mailq"
UCD-SNMP-MIB::ucdavis.53.101.0.3.1 = STRING: "/usr/local/bin/getmailq.sh"
UCD-SNMP-MIB::ucdavis.53.101.0.100.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.53.101.0.101.1 = STRING: "/usr/local/bin/getmailq.sh: line 12: qshape: command not found"
UCD-SNMP-MIB::ucdavis.53.101.0.101.2 = STRING: "incoming: /usr/local/bin/getmailq.sh: line 12: qshape: command not found"
UCD-SNMP-MIB::ucdavis.53.101.0.101.3 = STRING: "active: /usr/local/bin/getmailq.sh: line 12: qshape: command not found"
UCD-SNMP-MIB::ucdavis.53.101.0.101.4 = STRING: "deferred: /usr/local/bin/getmailq.sh: line 12: qshape: command not found"
UCD-SNMP-MIB::ucdavis.53.101.0.101.5 = STRING: "hold: "
UCD-SNMP-MIB::ucdavis.53.101.0.102.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.53.101.0.103.1 = ""
and after run in command line, i have error like this :
./getmailq.sh
./getmailq.sh: line 12: qshape: command not found
incoming: ./getmailq.sh: line 12: qshape: command not found
active: ./getmailq.sh: line 12: qshape: command not found
deferred: ./getmailq.sh: line 12: qshape: command not found
i have running postfix postfix-2.2.10 in freebsd box
I am getting a "Error: XML: Hash version does not exist." when importing the graph template. What version of Cacti was this exported from? I am using 0.8.6i-1.
Problem is that the snmp deamon (running as user snmp) doesn't have access to the /var/spool/postfix/.. directories. So qshape will generate errors. How did you guys solve this?
I am also having a problem with this script. If I enter the information in manually it works no problem and I've narrowed it down to "syzygy". I have no idea what that is. If it's a place holder is there any way to have the script grab the community from cacti rather than manually enter it?
MoreDakka wrote:I am also having a problem with this script. If I enter the information in manually it works no problem and I've narrowed it down to "syzygy". I have no idea what that is. If it's a place holder is there any way to have the script grab the community from cacti rather than manually enter it?
syzygy is the snmp community name.
I am also stuggling with the permissions. Added user:snmp to postfix and root groups. When i run the getmailq.sh script it returns 0 values. When running the same script under root it works fine.
I've just added this script to my cacti system. The client side works fine. The postfixqueues.sh on cacti server give me correct results but result in cacti are false :
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: