Yep.  We graph temperature and humidity (as that is the base sensor included in the package).  just queried via SNMP.<br><br>Here you go!  all of our sensors are in climate controlled rooms, so humidity is not a concern.  This reports them both on one page, but only alerts if temp is out of range.  would be a trivial update if someone wanted to alarm on humidity thresholds...<br>
<br>I have written many externals using this template.  I use the same model to pull over 500 firewalls for 10 data points each in less than 30 seconds.   <br><br>I'll leave the NCV stuff up to you. add an 'apctemp' test to your hosts and off it goes! Have fun!<br>
<br>Stewart<br><br>#!/usr/bin/perl<br><br>########################################################<br>#<br>#  Hobbit script to monitor APC Environmental monitors<br>#<br>#  Written by Stewart Larsen<br>#<br>#  Released to the public domain<br>
#<br>#  This uses bbhostgrep to figure out which hosts to <br>#  poll and then Net::SNMP to poll them Asynchronously.<br>#  This incorporates nicely into the NCV graphs As well. <br>#<br>########################################################<br>
<br>use strict;<br>use Net::SNMP qw(snmp_dispatcher ticks_to_time);<br><br># Set to 1 to print to STDOUT instead of sending messages<br>my $debug = 1;<br><br># this is the IP address of your hobbit server<br>my $BBDISP = "<a href="http://192.168.1.1">192.168.1.1</a>";<br>
<br># hosts need to have the 'apctemp' test defined on them. Or change this to whatever you want to call it.<br>my $testname="apctemp";<br><br># Path to your bb executable<br>my $BB = "/usr/lib/hobbit/server/bin/bb";<br>
<br># Path to your bbhostgrep executable<br>my $BBHG = "/usr/lib/hobbit/server/bin/bbhostgrep";<br><br># SNMP Community String<br>my $snmpc = 'public';<br><br># Temperature thresholds<br>my $temp_warn = 90;<br>
my $temp_panic = 92;<br><br>my $contact = "Emergency Contact:\n\t1) Facilities\n\t\t850-555-1212\n\t2) Facilities On Call\n\t\t850-555-1111";<br><br>my @HOSTS = ();<br>my %hosts_hash = ();<br>my %ip_hash = ();<br>
my $now_string = localtime;<br><br>open (INPUT, "$BBHG $testname |" ) or die "Cannot open input: $!\n"; <br>while(<INPUT>)<br>{<br>        my ($ip,$hostname) = split(/\s/,$_);<br>        print "Adding $ip to polled hosts\n" if $debug;<br>
        push @HOSTS,$hostname;<br>        $hosts_hash{$hostname} = $ip;<br>        $ip_hash{$ip} = $hostname;<br>}<br><br>close INPUT;<br><br>          # Poll interval (in seconds).  This value should be greater<br>          # than the number of retries plus one, times the timeout value.<br>
<br>          my $INTERVAL  = 20;<br><br>          # Maximum number of polls, including the initial poll.<br><br>          my $MAX_POLLS = 1;<br><br>          my $temperature       = '.1.3.6.1.4.1.318.1.1.10.3.13.1.1.3.1';<br>
          my $humidity          = '.1.3.6.1.4.1.318.1.1.10.3.13.1.1.6.1';<br>          my $location          = '.1.3.6.1.4.1.318.1.1.10.3.12.1.0';<br><br>          # Create a session for each host and queue the first get-request.<br>
<br>          foreach my $host (@HOSTS) {<br><br>             my ($session, $error) = Net::SNMP->session(<br>                -hostname    => $hosts_hash{$host},<br>                -nonblocking => 0x1,   # Create non-blocking objects<br>
                -timeout     => 5,<br>#               -debug       => 0xFF,<br>                -retries     => 1,<br>                -version     => '1',<br>                -community   => $snmpc<br>
             );<br>             if (!defined($session)) {<br>                printf("ERROR: %s.\n", $error);<br>                exit 1;<br>             }<br><br>             # Queue the get-request, passing references to variables that<br>
             # will be used to store the last sysUpTime and the number of<br>            # polls that this session has performed.<br><br>             my ($last_uptime, $num_polls) = (0, 0);<br><br>             $session->get_request(<br>
                 -varbindlist => [$temperature,$humidity,$location],<br>                 -callback    => [<br>                    \&validate_sysUpTime_cb<br>                 ]<br>             );<br><br>          }<br>
<br>          # Define a reference point for all of the polls<br>          my $EPOC = time();<br><br>          # Enter the event loop<br>          snmp_dispatcher();<br>        $now_string = localtime;<br>        #print STDERR "$now_string: Processing Complete\n";<br>
<br>          exit 0;<br>sub validate_sysUpTime_cb<br>{<br>        my ($session) = @_;<br>        if (!defined($session->var_bind_list)) <br>        {<br>                printf("%-15s  ERROR: %s\n", $session->hostname, $session->error) if $debug;<br>
                system("$BB $BBDISP \"status ".$ip_hash{$session->hostname}.".$testname clear $now_string - Communication Failure\n".$session->error."\"\n") if !$debug;<br>        } <br>
        else <br>        {<br><br>                # Validate the sysUpTime<br><br>                my $temperature = $session->var_bind_list->{$temperature};<br>                my $humidity    = $session->var_bind_list->{$humidity};<br>
                my $location    = $session->var_bind_list->{$location};<br><br>                my $line = sprintf("Service on %-15s is Ok \n\ntemp : %s\nhumidity: %s\n\n",<br>                                $session->hostname,<br>
                                $temperature,<br>                                $humidity);<br><br><br><br><br>                my $cmd = "";<br>                my $color = "";<br>                my $mark = "";<br>
                if ($temperature >= $temp_panic)<br>                {<br>                        # Panic on CPU test<br>                        $mark="PANIC";<br>                        $color="red";<br>
                }<br>                elsif ($temperature >= $temp_warn)<br>                {<br>                        # Warn on CPU test<br>                        $mark="WARNING";<br>                        $color="yellow";<br>
                }<br>                else<br>                {<br>                        # CPU test OK<br>                        $mark="OK";<br>                        $color="green";<br>                        $contact = "";<br>
                }<br>                my $line="Environmental Monitoring\n\n$mark: Location: $location\n\ntemp : $temperature\nhumidity : $humidity\n\n$contact";<br>                $cmd = "$BB $BBDISP \"status ".$ip_hash{$session->hostname}.".$testname $color $now_string $line\n\"";<br>
                print STDOUT "********************\n$cmd" if $debug;<br>                system($cmd) if !$debug;<br><br>                $session->error_status;<br>        }<br>}<br><br><br><br><div class="gmail_quote">
On Thu, Jun 26, 2008 at 11:37 AM, Eric Boyd <<a href="mailto:eric@iconla.com">eric@iconla.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Stewart,<br>
I'd love to see your script.<br>
Have you set up graphing for it?<br>
-Eric<br>
<br>
Stewart L wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I use some APC environmental monitors (model AP9319) and I have an external script I'd be happy to provide to the community.<br>
<br>
they seem to retail for about $200 now.<br>
<br>
Stewart<br>
<br>
<br>
<br>
On Thu, Jun 26, 2008 at 8:01 AM, McDonald, Dan <<a href="mailto:Dan.McDonald@austinenergy.com" target="_blank">Dan.McDonald@austinenergy.com</a> <mailto:<a href="mailto:Dan.McDonald@austinenergy.com" target="_blank">Dan.McDonald@austinenergy.com</a>>> wrote:<br>

<br>
    On Thu, 2008-06-26 at 10:12 +0200, Buchan Milne wrote:<br>
    > On Wednesday 25 June 2008 23:52:49 White, Bruce wrote:<br>
<br>
    > > I have never been able to get custom graphs working, so I am<br>
    not graphing<br>
    > > the output. But getting custom graphs is not high on my<br>
    priority list.<br>
    ><br>
    > Well, devmon could be a convenient method to poll the device,<br>
    and would make<br>
    > getting graphs and alerts quite easy.<br>
<br>
    It might be, but since it doesn't support snmp v3 I have not been able<br>
    to use it.  mrtg does support snmp v3, has templates, and bbmrtg.pl is<br>
    pretty stable for importing the states into hobbit.<br>
<br>
    --<br>
    Daniel J McDonald, CCIE #2495, CISSP #78281, CNX<br>
    Austin Energy<br>
    <a href="http://www.austinenergy.com" target="_blank">http://www.austinenergy.com</a><br>
<br>
<br>
<br>
<br>
-- <br>
Stewart<br>
--<br>
You only lose what you cling to. <br>
</blockquote>
<br>
<br>
To unsubscribe from the hobbit list, send an e-mail to<br>
<a href="mailto:hobbit-unsubscribe@hswn.dk" target="_blank">hobbit-unsubscribe@hswn.dk</a><br>
<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>Stewart<br>--<br>You only lose what you cling to.