Enjoy...you can ignore certain T1/E1 ports if you pass in the name of the port as an argument (I use this on ports that aren't yet connected to a telco, but I don't want to get an alert on). I execute it via NRPE on the Asterisk box. It will give you descriptions of which ports are bad, so you don't need to guess. :)<br>
<br><br>#!/usr/bin/perl -w<br>#<br># Copyright (C) 2010 Local Matters, Inc.<br># <a href="http://www.localmatters.com/">http://www.localmatters.com/</a><br># Author: Joel C. Maslak<br># <br># Licensed under GPL version 3<br>
#<br><br>use strict;<br><br>use Carp;<br><br>my %ignore;<br><br>MAIN: {<br> my @out = `/usr/sbin/dahdi_scan`;<br><br> for my $ig (@ARGV) {<br> $ignore{$ig} = 1;<br> }<br><br> my $alarm;<br>
my $desc;<br> my @alarms;<br><br> for my $line (@out) {<br> chomp($line);<br><br> if ($line =~ /^alarms=/) {<br> $alarm = $line;<br> $alarm =~ s/^alarms=//;<br>
}<br> if ($line =~ /^description=/) {<br> $desc = $line;<br> $desc =~ s/^description=//;<br> if (!defined($ignore{$desc})) {<br>
if ($alarm ne 'OK') {<br> push @alarms, "$desc: $alarm Alarm";<br> }<br> }<br>
}<br> }<br><br> if (scalar(@alarms) > 0) {<br> my $out = join '; ', @alarms;<br> print "Circuits in alarm: $out\n";<br> exit(2);<br>
} else {<br> print "All monitored circuits OK\n";<br> exit(0);<br> }<br><br>}<br><br><br><div class="gmail_quote">On Tue, Sep 28, 2010 at 9:17 AM, Mark Deneen <span dir="ltr"><<a href="mailto:mdeneen@gmail.com">mdeneen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Are you monitoring some dahdi hardware or a separate "black box"?<br>
<br>
If dahdi, you could write a nagios plugin in shell with something like this:<br>
<br>
ALARMS=`dahdi_scan | grep alarms | grep -v OK | wc -l`<br>
<br>
and then set the appropriate exit code if ALARMS is not 0.<br>
<font color="#888888"><br>
<br>
-M<br>
</font><div class="im"><br>
On Tue, Sep 28, 2010 at 9:22 AM, Dario Quiroz <<a href="mailto:darioquiroz@gmail.com">darioquiroz@gmail.com</a>> wrote:<br>
</div><div><div></div><div class="h5">> We need to monitorate the E1 with nagios, somebody did this? any ideia?<br>
> Thanks in advance!<br>
><br>
> --<br>
> Atenciosamente,<br>
><br>
> -------------------------------------------------------<br>
><br>
> Dario Quiroz<br>
><br>
> (71) 9275-9080<br>
> gtalk: <a href="mailto:darioquiroz@gmail.com">darioquiroz@gmail.com</a><br>
><br>
> -------------------------------------------------------<br>
><br>
</div></div><div><div></div><div class="h5">> --<br>
> _____________________________________________________________________<br>
> -- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
> New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
> <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
><br>
> asterisk-users mailing list<br>
> To UNSUBSCRIBE or update options visit:<br>
> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
><br>
<br>
--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</div></div></blockquote></div><br>