|
|
| Author |
Message |
Enforcer
Joined: 08 Apr 2004 Posts: 10
|
Posted: Mon Apr 12, 2004 10:24 am Post subject: |
|
|
Well i did some small changes after i posted also. But the big work that sucks is in the templates *G*
I changed the Data Source Type to ABSOLUTE because i dont saw that
before.
The OID is a problem but not if you install it stricly like it was said in the manual and put the exec for them on top of the snmpd.
Greetings
Enforcer
PS: my first work with cacti and i would also not make one datasource for each input anymore - well it works *G*
|
|
| Back to top |
|
 |
_pre[PL]
Joined: 29 Dec 2003 Posts: 12 Location: Poland, Gdynia
|
Posted: Sun May 02, 2004 6:48 am Post subject: |
|
|
what version do you have ?
Mine is 0.8.4 and cannot use your template....
Just do an import, and nothing happens. Could not find 'Postfix Stats'...
|
|
| Back to top |
|
 |
oharel Cacti User
Joined: 07 Jan 2004 Posts: 84
|
Posted: Mon Aug 02, 2004 10:20 am Post subject: |
|
|
hi there,
i installed the template "cacti_graph_template_postfix_stats.xml", but the graph generates NaN.
Data Source Debug shows:
/usr/local/bin/rrdtool create \
/var/www/htdocs/cacti-0.8.5a/rra/office_postfixstats_recv_952.rrd \
--step 300 \
DS:recv:GAUGE:600:0:1000 \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \
RRA:LAST:0.5:1:600 \
RRA:LAST:0.5:6:700 \
RRA:LAST:0.5:24:775 \
RRA:LAST:0.5:288:797 \
i see, on the machine the postfix is installed on, snmprequests for the oids of the sent, recv, bounce, etc. btu it seems as if no data is returned, or that the postfix does not have these mibs - is that possible?
also, where does the mailgraph.pl script comes into play here?
--harel
|
|
| Back to top |
|
 |
oxy
Joined: 01 Sep 2004 Posts: 18
|
Posted: Fri Sep 03, 2004 4:35 am Post subject: |
|
|
Hi,
i have 2 questions:
I import the xml template and unzipzd the mailgraph.pl.gz script in the cacti/scripts/ directory.
1. Now i'd like to know if i need to add in the DATA INPUT METHODS the following line :
perl <cacti path> /scripts/mailgraph.pl ??
2. what's more, do this scripts allow me to get postifx information of a remote linux machine or only from the localhost (which run cacti and this perl sciprt) ??
thanks a lot
|
|
| Back to top |
|
 |
gninja Cacti User
Joined: 24 Aug 2004 Posts: 290 Location: San Francisco, CA
|
Posted: Fri Jan 28, 2005 9:04 pm Post subject: |
|
|
Ok, having an issue with this... Had to change the snmpd.conf, since I already have things responding on those oids.. so my snmpd.conf looks like:
| Code: |
exec 1.3.6.1.4.1.2021.8.2.101.1 mailcount_sent /bin/cat /var/tmp/mailsent
exec 1.3.6.1.4.1.2021.8.2.101.2 mailcount_recv /bin/cat /var/tmp/mailrecv
exec 1.3.6.1.4.1.2021.8.2.101.3 mailcount_reject /bin/cat /var/tmp/mailrejected
exec 1.3.6.1.4.1.2021.8.2.101.4 mailcount_bounced /bin/cat /var/tmp/mailbounced
exec 1.3.6.1.4.1.2021.8.2.101.5 mailcount_spam /bin/cat /var/tmp/mailspam
exec 1.3.6.1.4.1.2021.8.2.101.6 mailcount_virus /bin/cat /var/tmp/mailvirus
|
I changed the data templates to match...
sent oid is: .1.3.6.1.4.1.2021.8.2.101.1
etc...
I can snmpwalk the oids, and I get:
# snmpwalk -v 2c -c xxxxx mail01 1.3.6.1.4.1.2021.8.2.101.1
UCD-SNMP-MIB::extTable.2.101.1.1.1 = INTEGER: 1
UCD-SNMP-MIB::extTable.2.101.1.2.1 = STRING: "mailcount_sent"
UCD-SNMP-MIB::extTable.2.101.1.3.1 = STRING: "/bin/cat /var/tmp/mailsent"
UCD-SNMP-MIB::extTable.2.101.1.100.1 = INTEGER: 0
UCD-SNMP-MIB::extTable.2.101.1.101.1 = STRING: "16"
UCD-SNMP-MIB::extTable.2.101.1.102.1 = INTEGER: 0
Which looks right... But cacti's not graphing anything.
in the logs I get:
01/28/2005 05:46:18 PM - CMDPHP: Poller[0] Host[47] SNMP: v2: mail00.avantgo.com, dsname: send, oid: .1.3.6.1.4.1.2021.8.2.101.1, output: U
Any ideas?
|
|
| Back to top |
|
 |
gninja Cacti User
Joined: 24 Aug 2004 Posts: 290 Location: San Francisco, CA
|
Posted: Mon Jan 31, 2005 2:33 pm Post subject: |
|
|
| Ok, fixed it. was a premissions issue for the cron job.
|
|
| Back to top |
|
 |
nduda78 Cacti User
Joined: 01 Mar 2005 Posts: 105
|
Posted: Wed Mar 02, 2005 12:03 pm Post subject: |
|
|
> That templates are working if you have the exec stuff in the snmpd at > the top or the postfix stats entry’s are the only one.
Can you explain what i need to add to my snmpd.conf file for this to work. I've imported the templates already.
- Nick
|
|
| Back to top |
|
 |
boran11
Joined: 21 Mar 2005 Posts: 21
|
Posted: Tue Mar 29, 2005 11:09 am Post subject: |
|
|
I'd be very interesting in tying in postfix into my (new) Cacti setup, I was wondering whwere I could get the latest versions of
- the XML file
- the perl script
- snmp.conf
and a few tips on setting it up?
I was also wondering about using snmp to get the stuff. For my environment it would probalby have been just as easy to create the rrd file on the postfix box, and copy via ssh to the Cacti box, from where it would be imported into cacti & displayed. Has anyone tried an alternative like this?
Finally I was wondering if anyone has integrated postgrey log analysis?
Regards,
|
|
| Back to top |
|
 |
ManuelW
Joined: 06 Apr 2005 Posts: 2
|
Posted: Wed Apr 06, 2005 2:14 pm Post subject: |
|
|
Hi, i think i have a little Problem with the script.
With starting i get a failure:
Use of uninitialized value in numeric eq (==) at ... line 588
Use of uninitialized value in numeric lt (<) at ... line 589
and the counters for send, recived and spam in the textfiles are not set back to 0, so the
graph shows always a line climbing up.
| Description: |
| the cacti imported goes not back to 0 |
|
| Filesize: |
6 KB |
| Viewed: |
15575 Time(s) |

|
| Description: |
| the original graph goes to 0 if no mail comes in |
|
| Filesize: |
5.58 KB |
| Viewed: |
15575 Time(s) |

|
|
|
| Back to top |
|
 |
Rübenrotze
Joined: 02 May 2005 Posts: 6
|
Posted: Mon May 02, 2005 7:36 pm Post subject: |
|
|
1. failure when starting mailgraph:
solution: modify the latest version of mailgraph.
2. graph not set back to 0:
solution: after polling set /var/tmp/mail... to 0.
i have done this by adding some "/bin/echo > 0 /var/tmp/mail..." to the cacti cron.
i attached all changed files.
also includes a init script for fedora core.
dirk
| Description: |
modified mailgraph
mailgraph init script
snmpd.conf change
modified cacti cron
cacti_graph_template_postfix_stats.xml
little install howto |
|
 Download |
| Filename: |
Mailgraph.zip |
| Filesize: |
12.11 KB |
| Downloaded: |
2047 Time(s) |
|
|
| Back to top |
|
 |
jpingle
Joined: 09 May 2005 Posts: 37
|
Posted: Mon May 09, 2005 4:45 pm Post subject: Slight Change... |
|
|
I stumbled upon this thread while looking for ways to monitor my mail systems with Cacti, and I had a suggestion.
I am running Cacti on a different host than the Postfix install I want to monitor, so the crontab entry included in that zip wasn't going to work in my setup.
A more elegant solution for zeroing out the message counts is to make the SNMP daemon exec a script that returns the count and zeros the counter in one step. I made a script that is called like so: catstat.sh sent - it will return the contents of /var/tmp/mailsent and then replace it with a 0.
Of course this may raise other issues I have yet to discover, but it works for now!
Getting the whole altered mailgraph setup to run on FreeBSD required some other changes, all minor -- paths to binaries and scripts are different -- but it was overall fairly easy.
Now if I could just figure out why cacti goes haywire on my ifDescr indexed ATM interfaces on a Cisco router every time the router reboots, I'd be really happy (It's not fun seeing pages of NaN's after a long power outage...) But that's a story for another thread.
|
|
| Back to top |
|
 |
dgman
Joined: 12 Nov 2003 Posts: 16
|
Posted: Mon May 09, 2005 10:28 pm Post subject: |
|
|
yes i agree. the script in the zip does not zero the values. i am by nomeans able to fix the scirpt to do it. but any help would be nice.
--j
|
|
| Back to top |
|
 |
jpingle
Joined: 09 May 2005 Posts: 37
|
Posted: Tue May 10, 2005 2:27 pm Post subject: |
|
|
Here is the script that I am using to return the value from the mail counter files and zero them out.
| Code: |
#!/bin/sh
if [ "$1" = "sent" ] || [ "$1" = "recv" ] || [ "$1" = "rejected" ] || [ "$1" = "bounced" ] || [ "$1" = "spam" ] || [ "$1" = "virus" ]
then
/bin/cat /var/tmp/mail$1
/bin/echo 0 > /var/tmp/mail$1
fi
|
I reference this from snmpd.conf on the server running postfix as follows:
| Code: |
exec mailcount_sent /path/to/script/catstat.sh sent
exec mailcount_recv /path/to/script/catstat.sh recv
exec mailcount_reject /path/to/script/catstat.sh rejected
exec mailcount_bounced /path/to/script/catstat.sh bounced
exec mailcount_spam /path/to/script/catstat.sh spam
exec mailcount_virus /path/to/script/catstat.sh virus
|
I have the script check for the names as a simple measure against shooting ones self in the foot by passing an invalid parameter (i.e. ../../etc/passwd) and having the wrong file overwritten.
I also have altered the graph template to make the Current/Maximum values use the "Exact Numbers" GPRINT type, and use 0 for the unit exponent value. This allows me to get whole number message counts without being converted to other formats. i.e. 2421 messages instead of 2.4k messages, or 24 instead of 24.94 (which is erroneous anyway...)
The postfix server is a spam filter/relay, so it has no local recipients. As such my graph is heavily skewed toward rejected messages and the received & sent are pretty much the same all the time. I had to re-order the values so rejects were on the top otherwise I couldn't see half the other graph values
Hope this helps...
|
|
| Back to top |
|
 |
jpingle
Joined: 09 May 2005 Posts: 37
|
Posted: Tue May 10, 2005 4:05 pm Post subject: Big problem... |
|
|
While getting this to work I thought the numbers were a little low. The mail server I'm monitoring typically processes about 150,000-200,000 incoming messages per day (70% of which are rejected by RBLs...)
So I went just looking at the code and output trying to determine just exactly what the numbers in the graph were trying to tell me. I thought "Are they messages per second, minute, or 5 minutes?" So I watched the counter files, and they were replaced once per minute, the old values completely ignored. Whichever file happend to be in place when the poller ran was recorded.
In short, anyone using this script is only getting 1 minute out of 5 graphed, and the other values are completely ignored. I modified a version of the already-modified mailgraph script to read in the old numbers and add to them, rather than overwriting them.
Alternately, you could probably change the rrdstep variable to 60*5 instead of 60, but I didn't know if the timing would be off then.
This also means that the value being graphed should be "Messages per 5 minutes" - I suppose one could divide the number in the file by 5 to get a per minute average, or divide it up however you'd like.
Right now I have a dirty hack done to the script to fix this, I'd like a more elegant solution but that will take time. If I get a chance to fix it I'll post a corrected version.
Comments are welcome...
|
|
| Back to top |
|
 |
jpingle
Joined: 09 May 2005 Posts: 37
|
Posted: Thu May 12, 2005 3:51 pm Post subject: Alternate version of Mailgraph for Cacti |
|
|
Here is my version of the Postfix Processing stats graph and associated files. It's similar to the other version posted here, but operates differently.
Main differences:
Works with postfix running on a different host than cacti
Properly gathers all data for a 5-minute period
Uses a single data source instead of 6 separate ones
Collects data via SNMP using a script
Various alterations of the graph template including ordering of the items as well as using exact numbers for last/max items
Everything should be included in the zip, including install instructions (Though my instructions are geared toward FreeBSD, they should easily adapt to Linux.) All of the templates and items required by cacti should be in the included XML file. You will at least have to check paths in the scripts to make sure they properly point to items such as perl, bash, and snmpwalk.
I named the templates differently so that they would not conflict with the templates from the old version. However, the OID may conflict with the old version.
Some other changes that you can make on your own might be to have Cacti average the data so that it is messages per minute instead of per 5 minutes, and maybe graph type changes such as changing from AREA to LINE types.
Be sure that if you are starting with this version to touch the mail counter files in /var/tmp before starting mailgraph or it will not update. You should execute the following commands:
| Code: |
touch /var/tmp/mailreceived
touch /var/tmp/mailsent
touch /var/tmp/mailrejected
touch /var/tmp/mailbounced
touch /var/tmp/mailspam
touch /var/tmp/mailvirus
|
Edited on 5/16 - Updated files to fix some errors.
| Description: |
Alternate Mailgraph for Cacti implementation.
Read INSTALL for FreeBSD instructions |
|
 Download |
| Filename: |
mailgraph-jjp.zip |
| Filesize: |
13.41 KB |
| Downloaded: |
2379 Time(s) |
Last edited by jpingle on Mon May 16, 2005 10:31 pm; edited 1 time in total |
|
| Back to top |
|
 |
|