Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Fri Apr 19, 2019 6:28 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: How to get the number of items in a MTA's queue remotly
PostPosted: Sun Sep 19, 2004 4:43 am 
Offline

Joined: Fri Dec 19, 2003 3:16 am
Posts: 11
Just my perl version of the bash script that you can find on this website:

Code:
#!/usr/bin/perl -w
use strict;

my $mailqbin = '/usr/bin/mailq';

open(MAILQ, "$mailqbin|");

while (<MAILQ>) {
    if ($_ =~ m/^.*Kbytes.*Requests.*$/) {
        my @temp = split(/ /, $_);
        print $temp[4];
    }
}


Should work with postfix's/sendmail's syntax.

add the following line to your snmpd.conf:
Code:
exec .1.3.6.1.4.1.2021.53.101.0 mailq /usr/local/sbin/getmailq.pl

and now you can do a SNMP query using this OID and you'll get the number of items currently on the queue.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 22, 2004 4:01 pm 
Hello,

You have tamplete to graph mailq?


Thanks.

HellBoy


Top
  
 
 Post subject:
PostPosted: Sat Sep 25, 2004 7:46 am 
Offline

Joined: Fri Dec 19, 2003 3:16 am
Posts: 11
Anonymous wrote:
Hello,

You have tamplete to graph mailq?


Thanks.

HellBoy


actually, I do. I will post it tomorrow


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 26, 2004 3:43 am 
Offline

Joined: Fri Dec 19, 2003 3:16 am
Posts: 11
falcon10 wrote:
Anonymous wrote:
Hello,

You have tamplete to graph mailq?


Thanks.

HellBoy


actually, I do. I will post it tomorrow


OK, here is the templates.

by the way, i forgot a small elsif there, so this is the right script:

Code:
#!/usr/bin/perl -w
use strict;

my $mailqbin = '/usr/bin/mailq';

open(MAILQ, "$mailqbin|");

while (<MAILQ>) {
    if ($_ =~ m/^.*Kbytes.*Requests.*$/) {
        my @temp = split(/ /, $_);
        print $temp[4];
    } elsif ($_ =~ m/^Mail queue is empty$/) {
    print 0;
    }
}


Attachments:
cacti_graph_template_postfix_queue.xml [9.37 KiB]
Downloaded 3338 times
cacti_data_template_postfix_queue.xml [5.51 KiB]
Downloaded 2754 times
Top
 Profile  
 
 Post subject:
PostPosted: Tue May 19, 2009 10:13 am 
Offline

Joined: Tue May 19, 2009 10:12 am
Posts: 1
Newer versions of Net-SNMP no longer support "exec." Has anyone gotten this to work with "extend"? If so, what changes do I have to make to get this working?


Top
 Profile  
 
 Post subject: extend is the same as exec
PostPosted: Thu Aug 20, 2009 5:23 am 
Offline

Joined: Mon Aug 17, 2009 10:14 am
Posts: 6
Location: Amsterdam - The Netherland
Just replace 'exec' with 'extend':

extend .1.3.6.1.4.1.2021.53.101.1 mailq /usr/local/bin/mailq.pl


Top
 Profile  
 
 Post subject: Where to find bash script
PostPosted: Mon May 17, 2010 7:00 am 
Offline

Joined: Mon May 17, 2010 6:57 am
Posts: 1
Hello, can you tell me where to find the bash script you mentioned in your post below

"Just my perl version of the bash script that you can find on this website: "

Thanks for your help

Regards
DK


Top
 Profile  
 
 Post subject: Re: How to get the number of items in a MTA's queue remotly
PostPosted: Fri Jan 28, 2011 10:41 am 
Offline
User avatar

Joined: Thu Feb 24, 2005 4:29 pm
Posts: 40
Location: Groningen, NL
OID .1.3.6.1.4.1.2021.53.101.0.101.1 seems wrong:
Code:
# snmpwalk -c foobar -v 2c 192.168.0.x .1.3.6.1.4.1.2021.53.101.0.101.1
UCD-SNMP-MIB::ucdavis.53.101.0.101.1 = No Such Object available on this agent at this OID


OID ucdavis.53.101.1.4.1.2.5.109.97.105.108.113.1 seems right:
Code:
# snmpwalk -c foobar -v 2c 192.168.0.x ucdavis.53.101.1.4.1.2.5.109.97.105.108.113.1
UCD-SNMP-MIB::ucdavis.53.101.1.4.1.2.5.109.97.105.108.113.1 = STRING: "7"


Any clues / thoughts? In the end it creates graphs with the last one...

_________________
This is my sick nature...


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 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