Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Mon Jun 17, 2019 8:06 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 85 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject:
PostPosted: Thu Jul 13, 2006 4:42 am 
Offline

Joined: Mon Mar 13, 2006 5:40 am
Posts: 12
Location: France
In my opinon, all the values for MINRES are good if they meet the following requierement :

MINRES < pooling period

Mathieu


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 13, 2006 4:50 pm 
Offline

Joined: Wed May 31, 2006 3:34 pm
Posts: 14
Location: France
hello, it's again me...sorry to bother you again :)

Well, i attentively read the perl script and i saw that the maillog file is cleanly scan with the perl fonctions tell() and seek() : $MINRES=50s means that the values collected are in the format : "msgs / 50s" instead of "msgs / 60s"?no?

With my cacti's config (polling all 5 minutes) :
-> I think the value of $MINRES must be exactly 5*60 = 300 secondes
-> And to have a format in "mgs/minutes" in the graphs i have to divise all the values by 6?no?

grrr! I can't make head or tail of it

EDIT: i think it's OK
To get a good estimation of "msgs/60s" i wrote :
$MINRES=60 (and the cacti's polling is always 5 minutes)



Thanks


Last edited by @ryaz on Sat Jul 15, 2006 5:35 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 14, 2006 6:38 pm 
Offline

Joined: Wed Jul 12, 2006 10:51 pm
Posts: 3
Mathieu wrote:
You migth have done some modification on the fetch perl script. Could you attach your version of the script to a forum post ?

Mathieu


Mathieu, I have made no modification to the original script posted on this thread. For some reason, when I run the script manually, I can then do an snmpwalk to view the statistics. After the MINRESET expires, those statistics are no longer accessible via snmpwalk.

The problem I can't seem to solve is getting it to work in the snmpd.conf. I use the "pass" directive the way the instructions show, but for some reason everytime I do the snmpwalk to the OID, it doesn't give me any results.

Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 17, 2006 10:20 am 
Offline

Joined: Wed Jun 21, 2006 3:28 am
Posts: 21
@ryaz wrote:
hello, it's again me...sorry to bother you again :)

Well, i attentively read the perl script and i saw that the maillog file is cleanly scan with the perl fonctions tell() and seek() : $MINRES=50s means that the values collected are in the format : "msgs / 50s" instead of "msgs / 60s"?no?

With my cacti's config (polling all 5 minutes) :
-> I think the value of $MINRES must be exactly 5*60 = 300 secondes
-> And to have a format in "mgs/minutes" in the graphs i have to divise all the values by 6?no?

grrr! I can't make head or tail of it

EDIT: i think it's OK
To get a good estimation of "msgs/60s" i wrote :
$MINRES=60 (and the cacti's polling is always 5 minutes)



Thanks


Hi @riaz,

First sorry for my english, i try to improve it :D

I do a test. I install a simple postfix on a test environment. I put logs manually in postfix logs.

If you have 1 message sent in the first minute and 1 message sent in the last minute before cacti run the poll you will collecte 2 messages sent. So $MINRES don't occur.

But if you have 1 message sent in the first minute and you call the script (manually for example) you will collect 1 message sent during 50s (if you call the script few times in 50s).

So at the 2nd minutes you will have 0 message sent.

I don't know if you understand. I think it's the explication you can test it and send me an email to confirm this.

regards!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 17, 2006 1:23 pm 
Offline

Joined: Wed May 31, 2006 3:34 pm
Posts: 14
Location: France
Giorgio wrote:
Hi @riaz,

First sorry for my english, i try to improve it :D

I do a test. I install a simple postfix on a test environment. I put logs manually in postfix logs.

If you have 1 message sent in the first minute and 1 message sent in the last minute before cacti run the poll you will collecte 2 messages sent. So $MINRES don't occur.

But if you have 1 message sent in the first minute and you call the script (manually for example) you will collect 1 message sent during 50s (if you call the script few times in 50s).

So at the 2nd minutes you will have 0 message sent.

I don't know if you understand. I think it's the explication you can test it and send me an email to confirm this.

regards!


hello thanks for the reply giorgio!
i don't understand all you say... sorry.

my configuration is ok (for good) :
$MINRES= 298 (nearly 5 minutes like my cacti's polling)

in my graph the scale is simply : msgs / 5 minutes !

now i try to get, in the legend of the cacti's graph, the total of the messages (sent, receive, spam...) near current, average and maximum...i don't really see how to do...

bye


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 18, 2006 3:09 pm 
Offline

Joined: Wed May 31, 2006 3:34 pm
Posts: 14
Location: France
Hello!
In fact, i think i don't really understand the end of the fetch_mail_statistics.pl script. Anyone could help me please?
thanks.

Code:
# Return archived data.
open( DBFILE, $dbFile ) || die( "Cannot open db file `".$dbFile."'!" );
@data = ();
while( <DBFILE> ) { chomp; push @data, $_; }

$reqMethod = $ARGV[3];
$reqOid    = $ARGV[4];

if ( $reqMethod eq "-n" ) {
  # SNMP getNext request.
  if ( $reqOid eq $baseOid ) {
    print $baseOid.".0\ninteger\n".$data[1]."\n";
  } elsif ( $reqOid eq $baseOid.".0" ) {
    print $baseOid.".1\ninteger\n".$data[2]."\n";
  } elsif ( $reqOid eq $baseOid.".1" ) {
    print $baseOid.".2\ninteger\n".$data[3]."\n";
  } elsif ( $reqOid eq $baseOid.".2" ) {
    print $baseOid.".3\ninteger\n".$data[4]."\n";
  } elsif ( $reqOid eq $baseOid.".3" ) {
    print $baseOid.".4\ninteger\n".$data[5]."\n";
  } elsif ( $reqOid eq $baseOid.".4" ) {
    print $baseOid.".5\ninteger\n".$data[6]."\n";
  } elsif ( $reqOid eq $baseOid.".5" ) {
    print $baseOid.".6\ninteger\n".$data[7]."\n";
  } elsif ( $reqOid eq $baseOid.".6" ) {
    print $baseOid.".7\ninteger\n".$data[8]."\n";
  } elsif ( $reqOid eq $baseOid.".7" ) {
    print $baseOid.".8\ninteger\n".$data[9]."\n";
  } elsif ( $reqOid eq $baseOid.".8" ) {
    print $baseOid.".9\ninteger\n".$data[10]."\n";
  } elsif ( $reqOid eq $baseOid.".9" ) {
    print $baseOid.".10\ninteger\n".$data[11]."\n";
  }
} elsif ( $reqMethod eq "-g" ) {
  # SNMP get request.
  if ( $reqOid eq $baseOid || $reqOid eq $baseOid.".0" ) {
    print $baseOid.".0\ninteger\n".$data[1]."\n";
  } elsif( $reqOid eq $baseOid.".1" ) {
    print $baseOid.".1\ninteger\n".$data[2]."\n";
  } elsif( $reqOid eq $baseOid.".2" ) {
    print $baseOid.".2\ninteger\n".$data[3]."\n";
  } elsif( $reqOid eq $baseOid.".3" ) {
    print $baseOid.".3\ninteger\n".$data[4]."\n";
  } elsif( $reqOid eq $baseOid.".4" ) {
    print $baseOid.".4\ninteger\n".$data[5]."\n";
  } elsif( $reqOid eq $baseOid.".5" ) {
    print $baseOid.".5\ninteger\n".$data[6]."\n";
  } elsif( $reqOid eq $baseOid.".6" ) {
    print $baseOid.".6\ninteger\n".$data[7]."\n";
  } elsif( $reqOid eq $baseOid.".7" ) {
    print $baseOid.".7\ninteger\n".$data[8]."\n";
  } elsif( $reqOid eq $baseOid.".8" ) {
    print $baseOid.".8\ninteger\n".$data[9]."\n";
  } elsif( $reqOid eq $baseOid.".9" ) {
    print $baseOid.".9\ninteger\n".$data[10]."\n";
  } elsif( $reqOid eq $baseOid.".10" ) {
    print $baseOid.".10\ninteger\n".$data[11]."\n";
  }
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 30, 2006 3:38 am 
Offline
Cacti User

Joined: Mon Jan 09, 2006 11:33 am
Posts: 54
Location: SE of LIML
very nice got it working without too much problems... thanks.

Has anybody gotten this to work together with sophos pure message for unix to get spam and virus counts too?

Thank you, Luca


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 31, 2006 5:16 am 
Offline
Cacti User

Joined: Mon Jan 09, 2006 11:33 am
Posts: 54
Location: SE of LIML
has anybody made a SUM function to show the toal received / sent emails in the graph timeperiod? i tried starting from the |sum:auto:current:2:auto| which is used for bandwidth but it doesn't seem to work... i get very high numbers...

Thank you, Luca

EDIT: problem is it takes te value for each second so the total needs to be divided by 300. :)


Top
 Profile  
 
 Post subject: Problem getting it to work
PostPosted: Wed Sep 27, 2006 2:41 am 
Offline

Joined: Wed Sep 27, 2006 2:15 am
Posts: 1
Hi, I have been playing around, trying to get the script to work.

Quote:
snmpwalk -v 1 -c public <host> .1.3.6.1.4.1.2021.255


The funny thing is that is I do a snmpwalk I get en error:

snmpwalk -v 2c -c casalogic localhost .1.3.6.1.4.1.2021.255

UCD-SNMP-MIB::ucdavis.255 = No Such Instance currently exists at this OID

Quote:
computer01:/usr/local/bin# ./fetch_mail_statistics.pl /var/log/mail.log /var/log/mailstats.db .1.3.6.1.4.1.2021.255 -n .1.3.6.1.4.1.2021.255.1
.1.3.6.1.4.1.2021.255.2
integer
0


Now the funny thing comes to life. If I type:
Code:
fetch_mail_stat.pl mail.log mailstats.db .1.3.6.1.4.1.2021.255 -n .1.3.6.1.4.1.2021.255.1


I get:
Code:
.1.3.6.1.4.1.2021.255.2
integer
0


In my snmpd.conf I have:

Code:
pass .1.3.6.1.4.1.2021.255 /var/cacti-mailgraph/fetch_mail_stat.pl /var/cacti-mailgraph/mail.log /var/cacti-mailgraph/mailstats.db .1.3.6.1.4.1.2021.255

also, every time I do an snmpwalk, and do a
Code:
ps aux | grep snmp
I get one extra running process in form of:
Code:
snmp      9197  0.0  0.0      0     0 ?        Z    09:36   0:00 [fetch_mail_stat] <defunct>


Anybody have any sort of idear, of how to get any further?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 14, 2006 7:06 pm 
Offline

Joined: Tue Nov 14, 2006 6:56 pm
Posts: 2
-bump-

Hello - I have followed this thread, and have not been able to get the darn thing to work properly! :(

I am mostly new to linux, and am "less than new" to perl, so I am basically banging my head over here! :lol:

Can someone help me out?

Here is the issue; my postfix/amavisd-new/spamassassin/clamav is configured and works properly (has been for months). I want to do logging on the box, but my mailstats section is blank on Cacti (other graphs come in just fine - CPU/memory/load/etc).

I think that is has something to do with how amavisd writes the logs, but need some more experienced minds to help me out.

Here is the section of amavisd.conf that handles logging:
Code:
#
# Section III - Logging
#

# true (e.g. 1) => syslog;  false (e.g. 0) => logging to file
$DO_SYSLOG = 1;                   # (defaults to 0)
$SYSLOG_LEVEL = 'mail.debug';     # (facility.priority, default 'mail.info')

# Log file (if not using syslog)
$LOGFILE = "$MYHOME/amavis.log";  # (defaults to empty, no log)

#NOTE: levels are not strictly observed and are somewhat arbitrary
# 0: startup/exit/failure messages, viruses detected
# 1: args passed from client, some more interesting messages
# 2: virus scanner output, timing
# 3: server, client
# 4: decompose parts
# 5: more debug details
$log_level = 5;        # (defaults to 0)

# Customizable template for the most interesting log file entry (e.g. with
# $log_level=0) (take care to properly quote Perl special characters like '\')
# For a list of available macros see README.customize .

# $log_templ = undef;      # undef disables by-message level-0 log entries
# $log_recip_templ = undef;  # undef disables by-recipient level-0 log entries


# log both infected and noninfected messages (new default):
# (remove the leading '#' and a space in the following lines to activate)

# $log_templ = '
# [? [?%#D|#|Passed #
# [? [?%#V|1] |INFECTED (%V)|#
# [? [?%#F|1] |BANNED (%F)|#
# [? [? %2|1] |SPAM|#
# [? [?%#X|1] |BAD-HEADER|CLEAN]]]]#
# , [? %p ||%p ][?%a||[?%l||LOCAL ]\[%a\] ][?%e||\[%e\] ]<%o> -> [%D|,]#
# [? %q ||, quarantine: %q]#
# [? %Q ||, Queue-ID: %Q]#
# [? %m ||, Message-ID: %m]#
# [? %r ||, Resent-Message-ID: %r]#
# , mail_id: %i#
# , Hits: %c#
# #, size: %z#
# #[? %j ||, Subject: "%j"]#
# #[? %#T ||, Tests: \[[%T|,]]\]#
# , %y ms#
# ]
# [?%#O|#|Blocked #
# [? [?%#V|1] |INFECTED (%V)|#
# [? [?%#F|1] |BANNED (%F)|#
# [? [? %2|1] |SPAM|#
# [? [?%#X|1] |BAD-HEADER|CLEAN]]]]#
# , [? %p ||%p ][?%a||[?%l||LOCAL ]\[%a\] ][?%e||\[%e\] ]<%o> -> [%O|,]#
# [? %q ||, quarantine: %q]#
# [? %Q ||, Queue-ID: %Q]#
# [? %m ||, Message-ID: %m]#
# [? %r ||, Resent-Message-ID: %r]#
# , mail_id: %i#
# , Hits: %c#
# #, size: %z#
# #[? %j ||, Subject: "%j"]#
# #[? %#T ||, Tests: \[[%T|,]]\]#
# , %y ms#
# ]';

# log template compatible with amavisd-new-20030616-p10:
# $log_recip_templ = undef;
# $log_templ = '[? %#V |[? %#F |[?%#D|Not-Delivered|Passed]|BANNED name/type (%F)]|INFECTED (%V)], #
# <%o> -> [<%R>|,][? %q ||, quarantine %q], Message-ID: %m, Hits: %c';

$log_templ = '[?%#D|Not-Delivered|Passed] [? %#V |[? %#F |[? %#X |CLEAN|BAD-HEADER]|BANNED name/type (%F)]|INFECTED (%V)], #
[?%o|(?)|<%o>] -> [<%R>|,][? %i ||, quarantine %i], Message-ID: %m, Hits: %c';


Here is my snmpd.conf
Code:
### Setup security names

com2sec local        localhost      password
com2sec internalNet   1.1.1.1/128      password

### Map groups to security names

group ROGroup   any   local
group ROGroup   any   internalNet

view viewEverything    included  .1   80

### grant groups access to the view

access ROGroup ""      any       noauth    exact  viewEverything    none   none
pass .1.3.6.1.4.1.2021.255 /usr/local/sbin/fetch_mail_statistics.pl /var/log/mail.log /var/log/mailstats.db .1.3.6.1.4.1.2021.255


(attached is the pl script I use)

please help!!!

if you need anything else posted, please let me know.

thanks!

-edit- someone mentioned earlier in the thread that the perl script ignores "local" messages - how do i know if my amavis is doing things "locally"...?


Attachments:
File comment: my current perl script
fetch_mail_statistics.pl [5.8 KiB]
Downloaded 1005 times
Top
 Profile  
 
 Post subject: Re: Problem getting it to work
PostPosted: Fri Nov 24, 2006 9:45 am 
Offline

Joined: Fri Nov 24, 2006 9:40 am
Posts: 1
idledk wrote:
Hi, I have been playing around, trying to get the script to work.

Quote:
snmpwalk -v 1 -c public <host> .1.3.6.1.4.1.2021.255


The funny thing is that is I do a snmpwalk I get en error:

snmpwalk -v 2c -c casalogic localhost .1.3.6.1.4.1.2021.255

UCD-SNMP-MIB::ucdavis.255 = No Such Instance currently exists at this OID

Quote:
computer01:/usr/local/bin# ./fetch_mail_statistics.pl /var/log/mail.log /var/log/mailstats.db .1.3.6.1.4.1.2021.255 -n .1.3.6.1.4.1.2021.255.1
.1.3.6.1.4.1.2021.255.2
integer
0


Now the funny thing comes to life. If I type:
Code:
fetch_mail_stat.pl mail.log mailstats.db .1.3.6.1.4.1.2021.255 -n .1.3.6.1.4.1.2021.255.1


I get:
Code:
.1.3.6.1.4.1.2021.255.2
integer
0


In my snmpd.conf I have:

Code:
pass .1.3.6.1.4.1.2021.255 /var/cacti-mailgraph/fetch_mail_stat.pl /var/cacti-mailgraph/mail.log /var/cacti-mailgraph/mailstats.db .1.3.6.1.4.1.2021.255

also, every time I do an snmpwalk, and do a
Code:
ps aux | grep snmp
I get one extra running process in form of:
Code:
snmp      9197  0.0  0.0      0     0 ?        Z    09:36   0:00 [fetch_mail_stat] <defunct>


Anybody have any sort of idear, of how to get any further?


Hello,
I have the same problem and I've found the solution.

You need to change the rights on the file Fetch_Mail_Statistics.pl
I've used the following command

chmod 777 fetch_mail_statistics.pl

Now it's OK

server:/usr/local/bin # snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.255
UCD-SNMP-MIB::ucdavis.255.0 = INTEGER: 58
UCD-SNMP-MIB::ucdavis.255.1 = INTEGER: 20
UCD-SNMP-MIB::ucdavis.255.2 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.3 = INTEGER: 16
UCD-SNMP-MIB::ucdavis.255.4 = INTEGER: 229
UCD-SNMP-MIB::ucdavis.255.5 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.6 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.7 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.8 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.9 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.10 = INTEGER: 0


Bye


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 5:48 am 
Offline

Joined: Tue Dec 05, 2006 5:44 am
Posts: 1
Hi,

i followed the thread an set it all up.

# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.255
UCD-SNMP-MIB::ucdavis.255.0 = INTEGER: 83
UCD-SNMP-MIB::ucdavis.255.1 = INTEGER: 5
UCD-SNMP-MIB::ucdavis.255.2 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.3 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.4 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.5 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.6 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.7 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.8 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.9 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.10 = INTEGER: 0

put if the poller runs i got
CMDPHP: Host[1] DS[10] WARNING: Result from SNMP not valid. Partial Result

if i use directly fetch_mail_statistics.pl:

# /usr/local/bin/fetch_mail_statistics.pl /var/log/amavis.log /var/log/mailstats.db .1.3.6.1.4.1.2021.255 -n .1.3.6.1.4.1.2021.255.1
.1.3.6.1.4.1.2021.255.2
integer
0


anyone an idea whats wrong ?
TIA
Rufinus


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 13, 2007 11:28 am 
Offline

Joined: Sun May 13, 2007 11:26 am
Posts: 1
hi all,
sorry to bump, but i have the same problem, does someone resolve it ?
Thanks for your help.
regards
Cyb

rufinus wrote:
Hi,

i followed the thread an set it all up.

# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.255
UCD-SNMP-MIB::ucdavis.255.0 = INTEGER: 83
UCD-SNMP-MIB::ucdavis.255.1 = INTEGER: 5
UCD-SNMP-MIB::ucdavis.255.2 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.3 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.4 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.5 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.6 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.7 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.8 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.9 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.255.10 = INTEGER: 0

put if the poller runs i got
CMDPHP: Host[1] DS[10] WARNING: Result from SNMP not valid. Partial Result

if i use directly fetch_mail_statistics.pl:

# /usr/local/bin/fetch_mail_statistics.pl /var/log/amavis.log /var/log/mailstats.db .1.3.6.1.4.1.2021.255 -n .1.3.6.1.4.1.2021.255.1
.1.3.6.1.4.1.2021.255.2
integer
0


anyone an idea whats wrong ?
TIA
Rufinus


Top
 Profile  
 
 Post subject: mailstat.db
PostPosted: Wed Sep 12, 2007 11:08 am 
Offline

Joined: Wed Sep 12, 2007 11:03 am
Posts: 1
Hi

check the rigths on the mailstat.db file.
I changed it to 766 and I got the rigth numbers.
bg.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 25, 2007 12:49 am 
Offline

Joined: Thu Oct 25, 2007 12:47 am
Posts: 1
Hi,

I am a problem trying to show data that is over 1024. I have already changed to the maximum value in the data template to 100000, but my graph still won't graph anything higher than 1000.

Please help. thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 85 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group