worked one out myself... Let me know if there is an easier way...<br><br>#!/usr/bin/perl<br><br>##########################################################################################<br>#<br># no-alerts.pl - This script uses bbhostgrep to get a list of sevrers, then fetches their<br>
#       info test.  It then parses this looking for 'No Alerts Defined' It then outputs<br>#       hostname of the machines that are missing alert config.<br>#<br>#       Created by Stewart Larsen <br>#<br>##########################################################################################<br>
<br><br>use strict;<br>use LWP::Simple;<br><br># Set debug to 1 to see the hosts and URL as you loop through.<br>my $debug = 0;<br><br>#Token in bb-hosts to indicate we need to run firewall tests on this device<br>my $test_name = '*';<br>
<br>#server to poll for information<br>my $BBDISP = "<a href="http://192.168.1.1">192.168.1.1</a>";<br><br><br># Paths - Fetch all hosts and trim for just the host name.  Then sort and unique the list<br>my $BBHOSTGREP="/usr/lib/hobbit/server/bin/bbhostgrep '*'| /bin/cut -d' ' -f2 | /bin/sort  | /usr/bin/uniq";<br>
<br>open (INPUT, "-|",$BBHOSTGREP ) or die "Cannot open input: $!\n";<br>while(<INPUT>)<br>{<br>        chomp (my $host = $_);<br>        my $fetch_URL = 'http://'.$BBDISP.'/hobbit-cgi/bb-hostsvc.sh?HOST='.$host.'&SERVICE=info';<br>
        print "$host: $fetch_URL\n" if $debug;<br><br>        my $content = get $fetch_URL;<br>        if (!defined $content)<br>        {<br>                warn "Couldn't get $fetch_URL";<br>                next;<br>
        }<br><br>        if($content =~ m/No Alerts Defined/i)<br>        {<br>                print "$host has no alerts defined\n";<br>        }<br>}<br>close INPUT;<br><br><br><br><br><div class="gmail_quote">
On Mon, Jun 2, 2008 at 8:53 AM, Stewart L <<a href="mailto:stewartl42@gmail.com">stewartl42@gmail.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;">
Is there an easy way to check for hosts without alerts defined?   I have about 4000 hosts being monitored and some do not have alerts defined.   I would hate to have to check the info test for each of those manually.<br><font color="#888888"><br clear="all">

<br>-- <br>Stewart<br><br>You only lose what you cling to.
</font></blockquote></div><br><br clear="all"><br>-- <br>Stewart<br><br>You only lose what you cling to.