Sendmail & Mailscanner version 2

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

Moderators: Developers, Moderators

Post Reply
taylor
Posts: 1
Joined: Mon Mar 03, 2008 6:07 pm

sendmail stats xml graph fix

Post by taylor »

after playing with the graph template - think i've managed to sort the unment
dependancy issues
i've exported the graph and data templates
from original posts includes messages rejected
running cacti 0.8.7b on opensuse 10.2

nice work on the scripts warnesj
Attachments
sendmailstats.zip
(12.64 KiB) Downloaded 763 times
mail.jpg
mail.jpg (42.03 KiB) Viewed 8236 times
jimbo
Posts: 1
Joined: Fri Apr 11, 2008 2:24 am

Re: sendmail stats xml graph fix

Post by jimbo »

Hi,

i am trying to get these templates to work. I was using 0.8.6i, but the last graph template (sendmail_mailscanner_stats.xml) had dependency issues as seen in a lot of other posts, and none of the fixes worked.

So i upgraded to cacti -0.8.7b-2 (debian), and now i get this if i enable debugging

RRDTool Command:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="host - E-Mail Statistics" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="# of Messages" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/var/lib/cacti/rra/host_mess_recv_96.rrd":mess_recv:AVERAGE \
DEF:b="/var/lib/cacti/rra/host_mess_recv_96.rrd":mess_recv:LAST \
DEF:c="/var/lib/cacti/rra/host_mess_recv_96.rrd":mess_recv:MIN \
DEF:d="/var/lib/cacti/rra/host_mess_recv_96.rrd":mess_recv:MAX \
DEF:e="/var/lib/cacti/rra/host_viruses_95.rrd":viruses:AVERAGE \
DEF:f="/var/lib/cacti/rra/host_viruses_95.rrd":viruses:LAST \
DEF:g="/var/lib/cacti/rra/host_viruses_95.rrd":viruses:MIN \
DEF:h="/var/lib/cacti/rra/host_viruses_95.rrd":viruses:MAX \
DEF:i="/var/lib/cacti/rra/host_mess_relay_98.rrd":mess_relay:AVERAGE \
DEF:j="/var/lib/cacti/rra/host_spam_94.rrd":spam:AVERAGE \
DEF:ba="/var/lib/cacti/rra/host_spam_94.rrd":spam:LAST \
DEF:bb="/var/lib/cacti/rra/host_spam_94.rrd":spam:MIN \
DEF:bc="/var/lib/cacti/rra/host_spam_94.rrd":spam:MAX \
DEF:bd="/var/lib/cacti/rra/host_mess_sent_99.rrd":mess_sent:AVERAGE \
DEF:be="/var/lib/cacti/rra/host_mess_sent_99.rrd":mess_sent:LAST \
DEF:bf="/var/lib/cacti/rra/host_mess_sent_99.rrd":mess_sent:MIN \
DEF:bg="/var/lib/cacti/rra/host_mess_sent_99.rrd":mess_sent:MAX \
DEF:bh="/var/lib/cacti/rra/host_mess_relay_98.rrd":mess_relay:LAST \
DEF:bi="/var/lib/cacti/rra/host_mess_relay_98.rrd":mess_relay:MIN \
DEF:bj="/var/lib/cacti/rra/host_mess_relay_98.rrd":mess_relay:MAX \
DEF:ca="/var/lib/cacti/rra/host_mess_rejected_97.rrd":mess_rejected:AVERAGE \
DEF:cb="/var/lib/cacti/rra/host_mess_rejected_97.rrd":mess_rejected:LAST \
DEF:cc="/var/lib/cacti/rra/host_mess_rejected_97.rrd":mess_rejected:MIN \
DEF:cd="/var/lib/cacti/rra/host_mess_rejected_97.rrd":mess_rejected:MAX \
CDEF:cdefc=a,-1,* \
CDEF:cdefdd=bd,-1,* \
COMMENT:"Sendmail Statistics\n" \
AREA:a#FFF200FF:"Messages Recieved" \
AREA:cdefc#7CB3F1FF:"Messages Sent" \
AREA:cdefc#7CB3F1FF:"Messages Sent" \
GPRINT:b:LAST:" Current\:%8.0lf" \
GPRINT::LAST:"Current\:%8.0lf" \
GPRINT::LAST:"Current\:%8.0lf" \
GPRINT:a:AVERAGE:"Average\:%8.0lf" \
GPRINT::AVERAGE:"Average\:%8.0lf" \
GPRINT:d:MAX:"Maximum\:%8.0lf\n" \
GPRINT::AVERAGE:"Average\:%8.0lf" \
AREA:e#FF0000FF:"Viruses" \
GPRINT::MAX:" Maximum\:%8.0lf\n" \
AREA:#FFFFFFFF:"" \
GPRINT:f:LAST:" Current\:%8.0lf" \
GPRINT:e:AVERAGE:"Average\:%8.0lf" \
GPRINT::LAST:"Current\:%8.0lf" \
AREA:#FFFFFFFF:"":STACK \
GPRINT:h:MAX:" Maximum\:%8.0lf\n" \
AREA:#FFFFFFFF:"":STACK \
GPRINT::AVERAGE:" Average\:%8.0lf" \
AREA:i#00CF00FF:"Messages Accepted":STACK \
GPRINT::MAX:"Maximum\:%8.0lf\n" \
AREA:j#FF00FFFF:"SPAM" \
GPRINT:ba:LAST:" Current\:%8.0lf" \
GPRINT::LAST:"Current\:%8.0lf" \
GPRINT::AVERAGE:"Average\:%8.0lf" \
GPRINT:j:AVERAGE:"Average\:%8.0lf" \
GPRINT:bc:MAX:"Maximum\:%8.0lf\n" \
GPRINT::MAX:"Maximum\:%8.0lf\n" \
AREA:#837C04FF:"Messages Rejected" \
COMMENT:"\n" \
GPRINT::LAST:"Current\:%8.0lf" \
AREA:cdefdd#4444FFFF:"Messages Sent" \
GPRINT:be:LAST:" Current\:%8.0lf" \
GPRINT::AVERAGE:"Average\:%8.0lf" \
GPRINT::MAX:"Maximum\:%8.0lf\n" \
GPRINT:bd:AVERAGE:"Average\:%8.0lf" \
AREA:#FF0000FF:"Viruses" \
COMMENT:"\n" \
GPRINT::LAST:" Current\:%8.0lf" \
GPRINT:bg:MAX:"Maximum\:%8.0lf\n" \
COMMENT:"Mailscanner Statistics\n" \
GPRINT::AVERAGE:"Average\:%8.0lf" \
AREA:i#35962BFF:"Relayed" \
AREA:#FF0000FF:"Viruses":STACK \
COMMENT:"\n" \
GPRINT:bh:LAST:" Current\:%8.0lf" \
AREA:#EA8F00FF:"SPAM":STACK \
COMMENT:"\n" \
GPRINT::LAST:" Current\:%8.0lf" \
GPRINT:i:AVERAGE:"Average\:%8.0lf" \
GPRINT::AVERAGE:"Average\:%8.0lf" \
GPRINT::LAST:"Current\:%8.0lf" \
COMMENT:" Last Updated on Fri 11 Apr 17\:20\:01 EST 2008 by SiteHosting bvba" \
GPRINT:bj:MAX:"Maximum\:%8.0lf\n" \
AREA:ca#8D00BAFF:"Rejected" \
COMMENT:" http\://www.sitehosting.be - info@sitehosting.be" \
GPRINT::AVERAGE:" Average\:%8.0lf" \
GPRINT::MAX:"Maximum\:%8.0lf\n" \
AREA:#EA8F00FF:"SPAM":STACK \
GPRINT::MAX:" Maximum\:%8.0lf\n" \
GPRINT:cb:LAST:"Current\:%8.0lf" \
GPRINT::LAST:"Current\:%8.0lf" \
GPRINT:ca:AVERAGE:"Average\:%8.0lf" \
GPRINT:cd:MAX:"Maximum\:%8.0lf\n" \
GPRINT::AVERAGE:"Average\:%8.0lf" \
GPRINT::MAX:"Maximum\:%8.0lf\n"

RRDTool Says:

ERROR: Could not parse line 'GPRINT::LAST:Current\:%8.0lf'

Any help greatly appreciated.
User avatar
east_cost
Posts: 35
Joined: Tue Jan 22, 2008 5:33 am

Post by east_cost »

hello

i am getting problem in snmp step.. where we add custom snmp oids for the script.


when i snmpwalk on the machine on which i am running mailserver it returns nothing.

like if run it for messege relay oid it returns nothing

[root@-i ~]# snmpwalk -v 1 -c public [IP address] .1.3.6.1.4.100.7
End of MIB


but if i manually run the script it shows me data ..

[root@viper ~]# /opt/watchmaillog/readcounters.sh mess_relay
.1.3.6.1.4.100.7
gauge
536

only because of this problem my graph is empty and showing 0 0 statistics.
what may be the problem and wht will be solution?

any help will highly be obliged.

thnkz
ariesow
Posts: 2
Joined: Sun Aug 19, 2007 8:44 am
Location: Malaysia

SNMP.CONF misconfigured ?

Post by ariesow »

Hi,

I have followed the instructions and i am very close to get everything work but the SNMP part make me very unsure.

From the CACTI server, i 'snmpwalk' to my mail server and get this

Code: Select all

[root@mum-its-netmon2 var]# snmpwalk -v1 -cpublickey xxx.xxx.xxx.xxx .1.3.6.1.4.100
SNMPv2-SMI::private.100.2 = Gauge32: 0
SNMPv2-SMI::private.100.2 = Gauge32: 0
Error: OID not increasing: SNMPv2-SMI::private.100.2
 >= SNMPv2-SMI::private.100.2
And the i couldn't get the graph show up. Seem like the RRDs are not created.

Help please :)
phalen00
Posts: 1
Joined: Thu Aug 14, 2008 1:50 pm

SNMP.CONF misconfigured ?

Post by phalen00 »

I am having the same issue:

SNMPv2-SMI::private.100.2 = Gauge32: 0
SNMPv2-SMI::private.100.2 = Gauge32: 0
Error: OID not increasing: SNMPv2-SMI::private.100.2
>= SNMPv2-SMI::private.100.2

I believe I have SNMP configured correctly but no graph for sendmail stats is showing up. Any ideas?
waeltec
Posts: 7
Joined: Thu Aug 14, 2008 2:32 am

Post by waeltec »

Dear,

Many thanks for your great efforts, but who should be the owner for the mentioned scripts


Thank You,
jefframsey
Posts: 11
Joined: Mon Aug 25, 2008 6:24 pm

Post by jefframsey »

I am trying to get this setup on Cacti 0.87b-2ubuntu1 and it is just not working. If I use the 0.87 template from the first post, I get the 'Unmet Dependency' errors while importing the graph template for the sendmail and mailscanner template, and the messages waiting template imports and works fine.

If I try the file from the top post of page 8 in this thread, I get a successful import, and then I have to go and manually link all of the data templates to the graph. Then the graph does in fact show, but it contains no data.

Anyone have any ideas for me?

[UPDATE] OK. I am able to get either one to show the graph, but all graphs are blank.

If I run the 'snmpwalk -v 2c -c 2x4snmp 65.174.242.12 .1.3.6.1.4.100.7' command from my cacti server, I get this:

SNMPv2-SMI::private.100.7 = Gauge32: 0
Error: OID not increasing: SNMPv2-SMI::private.100.7
>= SNMPv2-SMI::private.100.7


If I run the '/opt/watchmaillog/readcounters.sh spam' command on the mailscanner machine, I get this:

.1.3.6.1.4.100.2
guage
0

So I obviously do not have snmp setup correctly on my mailscanner machine.

My watchmaillog_counters file is counting on all cylinders.

Here is my snmpd.conf file:

####
# First, map the community name (COMMUNITY) into a security name
# (local and mynetwork, depending on where the request is coming
# from):

# sec.name source community
#com2sec paranoid 65.174.242.0/24 2x4snmp
com2sec readonly 65.174.242.0/24 2x4snmp
#com2sec readwrite 65.174.242.0/24 2x4snmp

####
# Second, map the security names into group names:

# sec.model sec.name
#group MyROSystem v1 paranoid
#group MyROSystem v2c paranoid
#group MyROSystem usm paranoid
group MyROGroup v1 readonly
group MyROGroup v2c readonly
group MyROGroup usm readonly
#group MyRWGroup v1 readwrite
#group MyRWGroup v2c readwrite
#group MyRWGroup usm readwrite

####
# Third, create a view for us to let the groups have rights to:

# incl/excl subtree mask
view all included .1 80
view system included .iso.org.dod.internet.mgmt.mib-2.system

####
# Finally, grant the 2 groups access to the 1 view with different
# write permissions:

# context sec.model sec.level match read write notif
#access MyROSystem "" any noauth exact system none none
access MyROGroup "" any noauth exact all none none
#access MyRWGroup "" any noauth exact all all none

###
# -----------------------------------------------------------------------------


###############################################################################
# System contact information
#

# It is also possible to set the sysContact and sysLocation system
# variables through the snmpd.conf file. **PLEASE NOTE** that setting
# the value of these objects here makes these objects READ-ONLY
# (regardless of any access control settings). Any attempt to set the
# value of an object whose value is given here will fail with an error
# status of notWritable.

syslocation Unknown (configure /etc/snmp/snmpd.local.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmpd.local.conf)

###############################################################################
# Further Information
#
# See the snmpd.conf manual page, and the output of "snmpd -H".
# MUCH more can be done with the snmpd.conf than is shown as an
# example here.

pass .1.3.6.1.4.100.2 /opt/watchmaillog/readcounters.sh spam
pass .1.3.6.1.4.100.4 /opt/watchmaillog/readcounters.sh virus
pass .1.3.6.1.4.100.5 /opt/watchmaillog/readcounters.sh mess_recv
pass .1.3.6.1.4.100.6 /opt/watchmaillog/readcounters.sh mess_sent
pass .1.3.6.1.4.100.7 /opt/watchmaillog/readcounters.sh mess_relay
pass .1.3.6.1.4.100.8 /opt/watchmaillog/readcounters.sh mess_waiting
pass .1.3.6.1.4.100.9 /opt/watchmaillog/readcounters.sh mess_rejected
jefframsey
Posts: 11
Joined: Mon Aug 25, 2008 6:24 pm

Post by jefframsey »

I got it working. Finally.

I am using Cacti 0.87-b on Ubuntu 8.04 LTS.
I am using the templates that Taylor posted for 0.87b.

I imported all of the templates from the first post in the thread. I got the unmet dependencies and everything. Then I imported Taylor's files right over top of those files and I got a message that it updated the data sources and graph. After that, I added the graph to my device. Then I had to manually create the data sources for my device under 'Data Sources' - 'Add' for each data source. Then I opened the graph un Graph Management and linked the data sources to the graph. Finally, I restarted my watchmaillog.sh script and the snmpd daemon on the mailscanner/sendmail server and viola! It started counting every stat. Well, it has yet to count a virus because it is a secondary virus scanner. My firewall scans for them first.

Thanks for writing such a nice graph. I really learned a lot about cacti and snmp just debugging this graph.

Now, on to the MySQL graphs.
jefframsey
Posts: 11
Joined: Mon Aug 25, 2008 6:24 pm

Post by jefframsey »

Where does the

Code: Select all

/bin/kill -HUP `cat /var/run/watchmaillog.pid 2> /dev/null` 2> /dev/null || true
go on a debian/ubuntu distro?

Debian-based distros use sysklogd to rotate the syslog. They use logrotate for other logs, but not for the syslog.

I put the kill command in the sysklogd script, right after it calls the /etc/init.d/sysklogd restart command, and it shows the mailscanner stats, but it only shows them for like 5 min out of every hour, then it shows blanks for the rest of the time. The Queued Messages and Messages Waiting graphs are fine.

Has anyone done this on Ubuntu? Where do you put the 'kill watchmaillog' command?
adameros
Posts: 7
Joined: Tue Nov 06, 2007 1:19 pm
Location: Bellevue, WA, USA

No graph?

Post by adameros »

I must be missing something really simple....

I'm imported the 8.7b templates and the loaded with no problem (no dependency errors).

I add the E-Mail statistics graph to my my mail host's device in Cacti.

I verify that the watchmaillog.sh is running and updating the counter file.

I verify that from the Cacti host I can snmpwalk to the mail server and get the the vaules for the new oids that were configured for this.

But....

The poller runs every 5 minutes and It's had an hour. No rrd files have been generated for the mail data and no graph has been drawn.

Do I need to do something else to get the poller to query the mail host for the mail data?
warnesj
Cacti User
Posts: 173
Joined: Sun May 29, 2005 7:34 pm

Post by warnesj »

jefframsey wrote:Has anyone done this on Ubuntu? Where do you put the 'kill watchmaillog' command?
Sorry jefframsey, I use the Fedora distribution so I'm not sure where the kill goes in Ubuntu.
adameros wrote:The poller runs every 5 minutes and It's had an hour. No rrd files have been generated for the mail data and no graph has been drawn.

Do I need to do something else to get the poller to query the mail host for the mail data?
This is going to sound stupid, but are you sure that you have write access to your RRD directory? Can you add other new hosts and new RRD's show up okay?
adameros
Posts: 7
Joined: Tue Nov 06, 2007 1:19 pm
Location: Bellevue, WA, USA

Post by adameros »

As all the other graphs (system load, number of processes, etc) seem fine, I'm guessing the ownership is fine.

As a test, I just created a new load graph for another host, and the files were created and the graphing is working for that load graph.
warnesj
Cacti User
Posts: 173
Joined: Sun May 29, 2005 7:34 pm

Post by warnesj »

adameros wrote:As a test, I just created a new load graph for another host, and the files were created and the graphing is working for that load graph.
Okay, great. I just needed to ask. Is there anything showing up in your Cacti logs about these OID's being queried? You may need to turn on higher detailed logging to see.
adameros
Posts: 7
Joined: Tue Nov 06, 2007 1:19 pm
Location: Bellevue, WA, USA

Post by adameros »

Just to be sure, I changed the permissions on the rra directory to 777 and let the poller run and still no luck.

I've also noticed, when I snmpwalk the oid, the values in the watchmaillog_counters reset to zero. When the poller runs the values are not reset, so I don't think the poller is even trying to get the mail stats.

When I look in the poller log, I don't see any errors coming up.
adameros
Posts: 7
Joined: Tue Nov 06, 2007 1:19 pm
Location: Bellevue, WA, USA

Post by adameros »

I tuened the logging all the way up. The only lines for the mail host I'm testing with are:

09/25/2008 03:45:14 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /u
sr/local/www/cacti/rra/smtp5_load_1min_5776.rrd --template load_1min:load_5min:l
oad_15min 1222382713:0.18:0.06:0.01
09/25/2008 03:45:14 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /u
sr/local/www/cacti/rra/smtp5_proc_5775.rrd --template proc 1222382713:97


I also grepped through the file for "sent" and "spam" with no results.

I see the spot on the the smtp5 graph page where the graph should be, tso the templates are in cacti, but I don't think the poller is cluing in to this.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest