From: Michael Traxler Date: Thu, 6 Nov 2014 16:40:50 +0000 (+0100) Subject: added script to ping all TRB X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=24fcb0dfa18717ad25541c29d5b6151e00c40c85;p=daqtools.git added script to ping all TRB --- diff --git a/dmon/scripts/dmon_ping.pl b/dmon/scripts/dmon_ping.pl new file mode 100755 index 0000000..de05b39 --- /dev/null +++ b/dmon/scripts/dmon_ping.pl @@ -0,0 +1,36 @@ +#!/usr/bin/perl -w + +use warnings; +use POSIX qw(strftime); +use FileHandle; +use lib "./code"; +use lib "../tools"; +use HADES::TrbNet; +use Time::HiRes qw(usleep); +use Dmon; +use Net::Ping; + +my %config = Dmon::StartUp(); + + +my $ping = Net::Ping->new(); +while(1) { + my $found = 0; + my $notavail = 0; + my $list = ""; + my $total = scalar @{$config{TrbIP}}; + foreach my $p (@{$config{TrbIP}}) { + my $r = $ping->ping($p,1); + $found += $r || 0; + $notavail += 1-($r||0); + $list .= " $p" unless $r; + } + + my $title = "Ping"; + my $value = sprintf("%i / %i",$found,$total); + my $longtext = sprintf("Total in list: %i. Boards reacting: %i. Boards not found: %s.",$total,$found,$list); + my $status = Dmon::GetQAState('above',$found,($total,$total,$total-1)); + Dmon::WriteQALog($config{flog},"ping",30,$status,$title,$value,$longtext,""); + + sleep(15); + } \ No newline at end of file