Postfix monitoring with David Schweikert's Mailgraph?

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

Moderators: Developers, Moderators

Post Reply
tymbow
Cacti User
Posts: 54
Joined: Sat May 14, 2005 8:00 pm

Post by tymbow »

Has anyone managed to get the totals working properly?

I had a go at it, but I don't think it can be done because the math relies on knowing how many data points there are for Daily, Weekly etc. graphs. If I build a CDEF its' right for Daily graph but progressively too small for other graphs. Looking at mailgraph as an example he does math based on caclculations Perl makes before defining the CDEF.

Maybe it needs a VDEF but this is not supported until Cacti 0.9
smor
Posts: 4
Joined: Sat Jul 21, 2007 1:23 pm

Re: Alternate version of Mailgraph for Cacti

Post by smor »

jpingle wrote: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: Select all

      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.
I'm having problem with the script on the cacti host that is pulling snmp data.
It always return 0 for all values.
sent:0 received:0 rejected:0 bounced:0 spam:0 virus:0

And if i start postfixstats.sh on the server i get everything ok. The numbers are right and 0 gets writen to files in /var/tmp.
It's like writing 0 to files happens before reading them but I checked and that is not the case.
dangaudette
Posts: 1
Joined: Tue Feb 10, 2009 3:59 pm

Re: Alternate version of Mailgraph for Cacti

Post by dangaudette »

I'm having problem with the script on the cacti host that is pulling snmp data.
It always return 0 for all values.
sent:0 received:0 rejected:0 bounced:0 spam:0 virus:0

And if i start postfixstats.sh on the server i get everything ok. The numbers are right and 0 gets writen to files in /var/tmp.
It's like writing 0 to files happens before reading them but I checked and that is not the case.
Restarting mailgraph fixed that problem for me
/etc/init.d/mailgraph restart
edgalura
Posts: 14
Joined: Fri Jun 06, 2008 3:23 pm

SuSe guide for PostFix & Mailscanner

Post by edgalura »

Hi Guys,

Thank you for the wonderful share.
I created a revision to the previous post of steve since ours is running on SuSe Ent Server.

The document includes the revise guide as well as the files that I use in order for the script to work.

Regards,

ed
Attachments
Postfix_Mailscanner_4_cacti.doc
(111.5 KiB) Downloaded 2259 times
stevo1664
Posts: 1
Joined: Wed Nov 05, 2008 10:09 am
Location: Derby, UK

Mailgraph restart recount problem

Post by stevo1664 »

Hello, I am using this script and I have noticed that if I restart mailgraph it re-counts messages that have already been counted, anyone else experiencing this or know what is happening.
akos.maroy
Posts: 9
Joined: Tue Jul 14, 2009 2:47 am

Post by akos.maroy »

I just installed the mailgraph package on my ubuntu box, and I see that it is already generating .rrd files:

Code: Select all

# ls /var/lib/mailgraph/ | more
mailgraph.rrd
mailgraph_virus.rrd
wouldn't it be just easier to tell cacti to process these rrd files, instead of having perl scripts extract info, etc?

but how would I do that - tell cacti to draw graphs based on these rrd files?
dertoaster
Posts: 6
Joined: Wed Nov 11, 2009 12:13 pm
Location: Germany

Post by dertoaster »

Hello,

i have a problem with the mailgraph.pl script on my machine where postfix is running. SLES10 SP2, Postfix version 2.5.4, Perl version 5.8.8

The script does not update the values of /var/tmp/mailreceived;mailrejected, etc. The values are all 0.

If i set a value e.g. /var/tmp/mailreceived to 200 manually, my cacti machine graph this correctly.

In my snmpd.conf file if have added the line

Code: Select all

exec mailcount /usr/local/bin/postfixstats.sh
mailgraph.pl are in the same directory as postfixstats.sh. Both scripts are executable.

Settings of my /etc/init.d/mailgraph file

Code: Select all

MAILGRAPH_PL=/usr/local/bin/mailgraph.pl
MAIL_LOG=/var/log/mail
What can be wrong with my mailgraph installation on my postfix machine?
How can i debug or fix this issue?

Thank you!
Toaster
100matolog
Posts: 41
Joined: Sun Dec 20, 2009 3:15 am
Location: Kiev

Post by 100matolog »

if somebody got a error like:

Code: Select all

[root@router init.d]# /etc/init.d/mailgraph-init start
Starting mail statistics grapher: mailgraph
Can't locate File/Tail.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/bin/mailgraph.pl line 296.
BEGIN failed--compilation aborted at /usr/bin/mailgraph.pl line 296.
this is the solution

perl -MCPAN -e shell

than insert

install File::Tail

let it do his job than insert exit

and it should work...а янукович палюбе мудак
niranjan
Posts: 6
Joined: Fri Mar 19, 2010 8:51 am

Post by niranjan »

gninja wrote:Ok, fixed it. was a premissions issue for the cron job.
Hi,

I'm getting same problem, SNMP walk is working but poller outputs is "U". Can you please tell me how you fix this issue?

Thanks
Niranjan
niranjan
Posts: 6
Joined: Fri Mar 19, 2010 8:51 am

Postfix stat graph

Post by niranjan »

Enforcer wrote:Hi,

i saw what you did here. I liked it a lot but well i also had to create all the templates.
All that clicking and adjustment took me some time so i decided to make it public.

So here we go. 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.

Thx for that idea and script.
Hi,

I followed the same procedure on my cacti server, snmpwalk with MIBs I'm getting correct data but in cacti.log says "output:U". I'm completly stuck with no clue, please help me out on this.

snmpwalk:

UCD-SNMP-MIB::extOutput.1.1.1 = INTEGER: 1
UCD-SNMP-MIB::extOutput.1.2.1 = STRING: "mailcount_sent"
UCD-SNMP-MIB::extOutput.1.3.1 = STRING: "/bin/cat /var/tmp/mailsent"
UCD-SNMP-MIB::extOutput.1.100.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.1.101.1 = STRING: "4"
UCD-SNMP-MIB::extOutput.1.102.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.1.103.1 = ""
UCD-SNMP-MIB::extOutput.2.1.1 = INTEGER: 1
UCD-SNMP-MIB::extOutput.2.2.1 = STRING: "mailcount_recv"
UCD-SNMP-MIB::extOutput.2.3.1 = STRING: "/bin/cat /var/tmp/mailrecv"
UCD-SNMP-MIB::extOutput.2.100.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.2.101.1 = STRING: "2"
UCD-SNMP-MIB::extOutput.2.102.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.2.103.1 = ""
UCD-SNMP-MIB::extOutput.3.1.1 = INTEGER: 1
UCD-SNMP-MIB::extOutput.3.2.1 = STRING: "mailcount_reject"
UCD-SNMP-MIB::extOutput.3.3.1 = STRING: "/bin/cat /var/tmp/mailrejected"
UCD-SNMP-MIB::extOutput.3.100.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.3.101.1 = STRING: "0"
UCD-SNMP-MIB::extOutput.3.102.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.3.103.1 = ""
UCD-SNMP-MIB::extOutput.4.1.1 = INTEGER: 1
UCD-SNMP-MIB::extOutput.4.2.1 = STRING: "mailcount_bounced"
UCD-SNMP-MIB::extOutput.4.3.1 = STRING: "/bin/cat /var/tmp/mailbounced"
UCD-SNMP-MIB::extOutput.4.100.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.4.101.1 = STRING: "0"
UCD-SNMP-MIB::extOutput.4.102.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.4.103.1 = ""
UCD-SNMP-MIB::extOutput.5.1.1 = INTEGER: 1
UCD-SNMP-MIB::extOutput.5.2.1 = STRING: "mailcount_spam"
UCD-SNMP-MIB::extOutput.5.3.1 = STRING: "/bin/cat /var/tmp/mailspam"
UCD-SNMP-MIB::extOutput.5.100.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.5.101.1 = STRING: "0"
UCD-SNMP-MIB::extOutput.5.102.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.5.103.1 = ""
UCD-SNMP-MIB::extOutput.6.1.1 = INTEGER: 1
UCD-SNMP-MIB::extOutput.6.2.1 = STRING: "mailcount_virus"
UCD-SNMP-MIB::extOutput.6.3.1 = STRING: "/bin/cat /var/tmp/mailvirus"
UCD-SNMP-MIB::extOutput.6.100.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.6.101.1 = STRING: "0"
UCD-SNMP-MIB::extOutput.6.102.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.6.103.1 = ""


cacti.log


05/27/2010 06:35:10 AM - CMDPHP: Poller[0] Host[36] DS[386] SNMP: v1: mohican.corp.upromise.com, dsname: virus, oid: .1.3.6.1.4.1.2021.8.1.101.6, output: U
05/27/2010 06:35:10 AM - CMDPHP: Poller[0] Host[36] DS[385] SNMP: v1: mohican.corp.upromise.com, dsname: spam, oid: .1.3.6.1.4.1.2021.8.1.101.5, output: U
05/27/2010 06:35:10 AM - CMDPHP: Poller[0] Host[36] DS[384] SNMP: v1: mohican.corp.upromise.com, dsname: send, oid: .1.3.6.1.4.1.2021.8.1.101.1, output: U
05/27/2010 06:35:10 AM - CMDPHP: Poller[0] Host[36] DS[383] SNMP: v1: mohican.corp.upromise.com, dsname: reject, oid: .1.3.6.1.4.1.2021.8.1.101.3, output: U
05/27/2010 06:35:10 AM - CMDPHP: Poller[0] Host[36] DS[382] SNMP: v1: mohican.corp.upromise.com, dsname: recv, oid: .1.3.6.1.4.1.2021.8.1.101.2, output: U
05/27/2010 06:35:10 AM - CMDPHP: Poller[0] Host[36] DS[381] SNMP: v1: mohican.corp.upromise.com, dsname: bounced, oid: .1.3.6.1.4.1.2021.8.1.101.4, output: U
niranjan
Posts: 6
Joined: Fri Mar 19, 2010 8:51 am

Re: Postfix stat graph

Post by niranjan »

I fixed by removing OIDs from snmpd.conf file.
niranjan wrote:
Enforcer wrote:Hi,

i saw what you did here. I liked it a lot but well i also had to create all the templates.
All that clicking and adjustment took me some time so i decided to make it public.

So here we go. 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.

Thx for that idea and script.
Hi,

I followed the same procedure on my cacti server, snmpwalk with MIBs I'm getting correct data but in cacti.log says "output:U". I'm completly stuck with no clue, please help me out on this.

snmpwalk:

UCD-SNMP-MIB::extOutput.1.1.1 = INTEGER: 1
UCD-SNMP-MIB::extOutput.1.2.1 = STRING: "mailcount_sent"
UCD-SNMP-MIB::extOutput.1.3.1 = STRING: "/bin/cat /var/tmp/mailsent"
UCD-SNMP-MIB::extOutput.1.100.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.1.101.1 = STRING: "4"
UCD-SNMP-MIB::extOutput.1.102.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.1.103.1 = ""
UCD-SNMP-MIB::extOutput.2.1.1 = INTEGER: 1
UCD-SNMP-MIB::extOutput.2.2.1 = STRING: "mailcount_recv"
UCD-SNMP-MIB::extOutput.2.3.1 = STRING: "/bin/cat /var/tmp/mailrecv"
UCD-SNMP-MIB::extOutput.2.100.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.2.101.1 = STRING: "2"
UCD-SNMP-MIB::extOutput.2.102.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.2.103.1 = ""
UCD-SNMP-MIB::extOutput.3.1.1 = INTEGER: 1
UCD-SNMP-MIB::extOutput.3.2.1 = STRING: "mailcount_reject"
UCD-SNMP-MIB::extOutput.3.3.1 = STRING: "/bin/cat /var/tmp/mailrejected"
UCD-SNMP-MIB::extOutput.3.100.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.3.101.1 = STRING: "0"
UCD-SNMP-MIB::extOutput.3.102.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.3.103.1 = ""
UCD-SNMP-MIB::extOutput.4.1.1 = INTEGER: 1
UCD-SNMP-MIB::extOutput.4.2.1 = STRING: "mailcount_bounced"
UCD-SNMP-MIB::extOutput.4.3.1 = STRING: "/bin/cat /var/tmp/mailbounced"
UCD-SNMP-MIB::extOutput.4.100.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.4.101.1 = STRING: "0"
UCD-SNMP-MIB::extOutput.4.102.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.4.103.1 = ""
UCD-SNMP-MIB::extOutput.5.1.1 = INTEGER: 1
UCD-SNMP-MIB::extOutput.5.2.1 = STRING: "mailcount_spam"
UCD-SNMP-MIB::extOutput.5.3.1 = STRING: "/bin/cat /var/tmp/mailspam"
UCD-SNMP-MIB::extOutput.5.100.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.5.101.1 = STRING: "0"
UCD-SNMP-MIB::extOutput.5.102.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.5.103.1 = ""
UCD-SNMP-MIB::extOutput.6.1.1 = INTEGER: 1
UCD-SNMP-MIB::extOutput.6.2.1 = STRING: "mailcount_virus"
UCD-SNMP-MIB::extOutput.6.3.1 = STRING: "/bin/cat /var/tmp/mailvirus"
UCD-SNMP-MIB::extOutput.6.100.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.6.101.1 = STRING: "0"
UCD-SNMP-MIB::extOutput.6.102.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.6.103.1 = ""


cacti.log


05/27/2010 06:35:10 AM - CMDPHP: Poller[0] Host[36] DS[386] SNMP: v1: mohican.corp.upromise.com, dsname: virus, oid: .1.3.6.1.4.1.2021.8.1.101.6, output: U
05/27/2010 06:35:10 AM - CMDPHP: Poller[0] Host[36] DS[385] SNMP: v1: mohican.corp.upromise.com, dsname: spam, oid: .1.3.6.1.4.1.2021.8.1.101.5, output: U
05/27/2010 06:35:10 AM - CMDPHP: Poller[0] Host[36] DS[384] SNMP: v1: mohican.corp.upromise.com, dsname: send, oid: .1.3.6.1.4.1.2021.8.1.101.1, output: U
05/27/2010 06:35:10 AM - CMDPHP: Poller[0] Host[36] DS[383] SNMP: v1: mohican.corp.upromise.com, dsname: reject, oid: .1.3.6.1.4.1.2021.8.1.101.3, output: U
05/27/2010 06:35:10 AM - CMDPHP: Poller[0] Host[36] DS[382] SNMP: v1: mohican.corp.upromise.com, dsname: recv, oid: .1.3.6.1.4.1.2021.8.1.101.2, output: U
05/27/2010 06:35:10 AM - CMDPHP: Poller[0] Host[36] DS[381] SNMP: v1: mohican.corp.upromise.com, dsname: bounced, oid: .1.3.6.1.4.1.2021.8.1.101.4, output: U
spz
Posts: 17
Joined: Fri Jan 30, 2009 3:53 am

Post by spz »

Hi !

I set up mailgraph for Cacti in my server mail by following this link : http://www.croc-informatique.fr/2008/06 ... vec-cacti/

But that not work, when I execute the script postfixcheck.pl, It return me :

Code: Select all

./postfixcheck.pl My-Mail-Server 1 public
sent:11 received:46 bounced:0 rejected:40 spam:0 virus:0
After import the template cacti_graph_template_postfix_processing.xml and add graph in my server mail, the graph does not display.

I have put the debug mode, and I've error :

RRDTool Command:
/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="MailServer - Postfix Processing" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="messages per 5 minutes" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
AREA:#AAABA1FF:"Reject" \
GPRINT::LAST:" Current\:%8.0lf" \
GPRINT::AVERAGE:"Average\:%8.2lf %s" \
GPRINT::MAX:"Maximum\:%8.0lf\n" \
AREA:#4668E4FF:"Recieved" \
GPRINT::LAST:"Current\:%8.0lf" \
GPRINT::AVERAGE:"Average\:%8.2lf %s" \
GPRINT::MAX:"Maximum\:%8.0lf\n" \
AREA:#00CF00FF:"Sent" \
GPRINT::LAST:" Current\:%8.0lf" \
GPRINT::AVERAGE:"Average\:%8.2lf %s" \
GPRINT::MAX:"Maximum\:%8.0lf\n" \
LINE2:#8F005CFF:"Spam" \
GPRINT::LAST:" Current\:%8.0lf" \
GPRINT::AVERAGE:"Average\:%8.2lf %s" \
GPRINT::MAX:"Maximum\:%8.0lf\n" \
LINE2:#FF0000FF:"Bounce" \
GPRINT::LAST:" Current\:%8.0lf" \
GPRINT::AVERAGE:"Average\:%8.2lf %s" \
GPRINT::MAX:"Maximum\:%8.0lf\n" \
LINE2:#F24AC8FF:"Virus" \
GPRINT::LAST:" Current\:%8.0lf" \
GPRINT::AVERAGE:"Average\:%8.2lf %s" \
GPRINT::MAX:"Maximum\:%8.0lf"

RRDTool Says:
ERROR: parameter '#AAABA1FF' does not represent a number in line AREA:#AAABA1FF:Reject

By typing the snmpwalk command the machine where is Cacti, it gives me this :

Code: Select all

[...]
UCD-SNMP-MIB::extNames.1 = STRING: mailcount
UCD-SNMP-MIB::extCommand.1 = STRING: /usr/local/bin/postfixstats.sh
UCD-SNMP-MIB::extResult.1 = INTEGER: 0
UCD-SNMP-MIB::extOutput.1 = STRING: sent:0 received:0 bounced:0 rejected:0 spam:0 virus:0
[...]
Why with the SNMP request there are nothing ?

Thank you, and sorry for my English ^^
jacuro
Posts: 1
Joined: Wed Dec 15, 2010 10:19 pm
Contact:

Re: Postfix monitoring with David Schweikert's Mailgraph?

Post by jacuro »

Hi, all. I find that there's some problem of the graph template posted previously(around year 2005).So I wrote a new patch for mailgraph v1.14, and a new graph template. Hoping this will be of any help.
Contact me if you find any problem.

Code: Select all

Problems found in the original post of the Cacti forum.
* It exports the mail counters directly from mailgraph. Which is somewhat wrong.
  mailgraph only change the counter value when it get more records from mail log, 
  say that at 15:00, a counter value is 20, after 10 minutes, no  message arrive,
  so the counter remains 20 at 15:10, assuming that cacti poll interval is 5 minutes,
  this will give cacti another 20*(10/5), ie. 40 extra message count. but there is no
  message arive within that 10 minutes!
  
* Some guy suggested that reset the counter after poll, which is still wrong.
  say that a counter value is 50, cacti reset it to 0 after the first poll, then, 
  1 minute passed, mailgraph increment it to 51 because another message arrive, and
  there is no more message arrive until the next poll of cacti.
  The next time, cacti will get a counter of 51, instead of the correct value : 1 .
  
Improvements:
  1. Display a total message counter for last day/ last month.
  2. Too separate template available: 1 minute average , 5 minutes average.
  3. Can be used with all version of snmp auth, v1, v2c, and v3.
  4. The patch supplied will not break mailgraph, nor will it change the way
    mailgraph works, it just add function to it.As a result, mailgraph can still
	be used as before.
  5. In fact, you can separate the statistics to as many graph as you want,
    eg. one graph contains only mail sent and received, and another only contains
	spam msg detected. just copy and modify the existing graph template will do.
    There can be many instance of CACTI to query the status from snmpd, the don't 
    bother each other. Implement with Nagios is also possible.
Attachments
sample graph of msgs/5min
sample graph of msgs/5min
graph_image.png (61.64 KiB) Viewed 8878 times
mailstat_cacti_template_v1.1.zip
Cact Graph template and scripts for monitoring mail server
(12.65 KiB) Downloaded 1018 times
heinzelrumpel
Posts: 12
Joined: Wed Mar 30, 2011 7:09 am

Re: SuSe guide for PostFix & Mailscanner

Post by heinzelrumpel »

edgalura wrote:Hi Guys,

Thank you for the wonderful share.
I created a revision to the previous post of steve since ours is running on SuSe Ent Server.

The document includes the revise guide as well as the files that I use in order for the script to work.

Regards,

ed
Hi,

in you doc its say
6. Copy the postfixstats.sh file included with this archive to your desired directory, I uses /usr/local/bin directory and grant execute permissions to this file.
Well, this file is not included when downloading the archive from the link you provide.

Has something changed?

Heinzelrumpel
sblantipodi
Posts: 24
Joined: Fri Aug 05, 2011 9:21 am

Re: Postfix monitoring with David Schweikert's Mailgraph?

Post by sblantipodi »

jacuro wrote:Hi, all. I find that there's some problem of the graph template posted previously(around year 2005).So I wrote a new patch for mailgraph v1.14, and a new graph template. Hoping this will be of any help.
Contact me if you find any problem.

Code: Select all

Problems found in the original post of the Cacti forum.
* It exports the mail counters directly from mailgraph. Which is somewhat wrong.
  mailgraph only change the counter value when it get more records from mail log, 
  say that at 15:00, a counter value is 20, after 10 minutes, no  message arrive,
  so the counter remains 20 at 15:10, assuming that cacti poll interval is 5 minutes,
  this will give cacti another 20*(10/5), ie. 40 extra message count. but there is no
  message arive within that 10 minutes!
  
* Some guy suggested that reset the counter after poll, which is still wrong.
  say that a counter value is 50, cacti reset it to 0 after the first poll, then, 
  1 minute passed, mailgraph increment it to 51 because another message arrive, and
  there is no more message arrive until the next poll of cacti.
  The next time, cacti will get a counter of 51, instead of the correct value : 1 .
  
Improvements:
  1. Display a total message counter for last day/ last month.
  2. Too separate template available: 1 minute average , 5 minutes average.
  3. Can be used with all version of snmp auth, v1, v2c, and v3.
  4. The patch supplied will not break mailgraph, nor will it change the way
    mailgraph works, it just add function to it.As a result, mailgraph can still
	be used as before.
  5. In fact, you can separate the statistics to as many graph as you want,
    eg. one graph contains only mail sent and received, and another only contains
	spam msg detected. just copy and modify the existing graph template will do.
    There can be many instance of CACTI to query the status from snmpd, the don't 
    bother each other. Implement with Nagios is also possible.
I'm following the guide contained in this archieve and /var/tmp/mailstat is created.
cat /var/tmp/mailstat
sent:2 received:34 bounced:0 rejected:49 virus:0 spam:0

snmpwalk -On -v2c -c public localhost ucdavis.extTable
.1.3.6.1.4.1.2021.8.1.1.1 = INTEGER: 1
.1.3.6.1.4.1.2021.8.1.2.1 = STRING: mailstat
.1.3.6.1.4.1.2021.8.1.3.1 = STRING: /bin/cat
.1.3.6.1.4.1.2021.8.1.100.1 = INTEGER: 0
.1.3.6.1.4.1.2021.8.1.101.1 = STRING: sent:2 received:35 bounced:0 rejected:52 virus:0 spam:0
.1.3.6.1.4.1.2021.8.1.102.1 = INTEGER: noError(0)
.1.3.6.1.4.1.2021.8.1.103.1 = STRING:

and edited the mail_stat.pl accordingly.

I added the graph in cacti, but it neither show an empty graph, is shows blank spaces instead of graph.

RRDTool Command:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title='localhost - Mail Statistics - msgs/5min' \
--rigid \
--base=1000 \
--height=120 \
--width=600 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label='msgs/5min' \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
CDEF:cdefa=a,300,* \
LINE1:cdefa#00CF00FF:"Sent" \
GPRINT:cdefa:AVERAGE:" Average\:%8.2lf %s" \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s" \
COMMENT:"Total\: 0 msgs\n" \
AREA:cdefa#4668E4FF:"Received" \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s" \
COMMENT:"Total\: 0 msgs\n" \
AREA:cdefa#AAABA1FF:"Rejected" \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s" \
COMMENT:"Total\: 0 msgs\n" \
LINE2:cdefa#FF0000FF:"Bounced" \
GPRINT:cdefa:AVERAGE:" Average\:%8.2lf %s" \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s" \
COMMENT:"Total\: 0 msgs\n" \
LINE2:cdefa#F5F800FF:"Spam" \
GPRINT:cdefa:AVERAGE:" Average\:%8.2lf %s" \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s" \
COMMENT:"Total\: 0 msgs\n" \
LINE2:cdefa#F24AC8FF:"Viruses" \
GPRINT:cdefa:AVERAGE:" Average\:%8.2lf %s" \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s" \
COMMENT:"Total\: 0 msgs\n"

RRDTool Says:

ERROR: invalid rpn expression in: a,300,*


Please help.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest