| Both sides previous revision Previous revision Next revision | Previous revision |
| addons:xymonmap [2016/09/20 09:42] – [xymonmap.pl] b-art | addons:xymonmap [2016/09/20 12:01] (current) – [xymonmap.pl] b-art |
|---|
| my $testFailed; | my $testFailed; |
| my $COLOR = ''; | my $COLOR = ''; |
| | my $device = ' '; |
| my $sitecolor = "green"; | my $sitecolor = "green"; |
| my $pin_message; | my $pin_message; |
| #PO - substitute the commas for dots, but, this has to be converted back for the links to each status message on the pop-ups, PAINFUL!!! | #PO - substitute the commas for dots, but, this has to be converted back for the links to each status message on the pop-ups, PAINFUL!!! |
| $target_node =~ s/,/./g; | $target_node =~ s/,/./g; |
| print "TARGET_NODE: $target_node\n" if ($DEBUG eq 'Y'); | print "TARGET_NODE: $target_node\n" if ($DEBUG eq 'Y'); |
| | print "sitecolor: $sitecolor\n" if ($DEBUG eq 'Y'); |
| open (IN, "< " . $xymon_hist_path . $lf); | open (IN, "< " . $xymon_hist_path . $lf); |
| while (<IN>){ | while (<IN>){ |
| $lf =~ s/,/./g; | $lf =~ s/,/./g; |
| #PO - DEBUG output | #PO - DEBUG output |
| #print "Test Failed [$testFailed]: $lf - $mpart1 - $color\n\n" if ($color ne 'green' && $color ne 'clear'); | print "Test Failed [$testFailed]: $lf - $mpart1 - $color\n\n" if ($color ne 'green' && $color ne 'clear' && $DEBUG eq 'Y'); |
| } | } |
| } | } |
| |
| if ($testFailed == 1) { | if ($testFailed == 1) { |
| if ($color eq 'red') { | |
| | # $COLOR = 'yellow'; |
| | $COLOR = 'green'; |
| | |
| | $machineName =~ s/\.[A-z]+$//g; |
| | $machineName =~ s/\.//g; |
| | if ($device eq $machineName){ |
| | if ($color eq 'red' || $sitecolor eq 'red') { |
| $sitecolor = "red"; | $sitecolor = "red"; |
| }elsif ($color eq 'purple' && $sitecolor ne 'red'){ | }elsif ($color eq 'purple' && $sitecolor ne 'red'){ |
| $sitecolor = "purple"; | $sitecolor = "purple"; |
| }elsif ($color eq 'yellow' && $sitecolor ne 'red' && $sitecolor ne 'purple'){ | }elsif ($color eq 'yellow' && ($sitecolor ne 'red' || $sitecolor ne 'purple')){ |
| $sitecolor = "yellow"; | $sitecolor = "yellow"; |
| }else {$sitecolor = "green"; | }else {$sitecolor = "green"; |
| } | } |
| $COLOR = 'green'; | } else {$sitecolor = "green"; |
| $machineName =~ s/\.[A-z]+$//g; | } |
| $machineName =~ s/\.//g; | $device = $machineName; |
| next if ($color eq 'green' || $color eq 'clear'); | next if ($color eq 'green' || $color eq 'clear'); |
| | # PO DEBUG output |
| print "machineName: ${machineName} - Test: $testName - Color: $color\n" if ($DEBUG eq 'Y'); | print "machineName: ${machineName} - Test: $testName - Color: $color\n" if ($DEBUG eq 'Y'); |
| | $pin_message .= '<html><br><font color=' . $color . '><A HREF=\\"http://' . $xymon_web_server . '/' . $cgiloc . '/svcstatus.sh?HOST=' . ${machineName} . '&SERVICE=' . ${testName} . '\\">' . $lf . '<img src=\"/mms/gifs/' . $color . '.gif\">' . ' [ '. $color . ' ]' . '</A></font></html>'; |
| #PO - For Windows: | #PO DEBUG output |
| $pin_message .= '<html><br><font color=' . $color . '><A HREF=\\"http://' . $xymon_web_server . '/' . $cgiloc . '/svcstatus.sh?HOST=' . ${machineName} . '&SERVICE=' . ${testName} . '\\">' . $lf . '<img src=\"/mms/gifs/' . $color . '.gif\">' . ' [ '. $color . ' ]' . '</A></font></html>'; | |
| print "<html><br><font color=' . $color . '><A HREF=\"http://' . $xymon_web_server . '/' . '$cgiloc/svcstatus.sh?HOST=' . $lf . '\">' . $lf . ' [ '. $color . ' ]' . '</A></font></html>" if ($DEBUG eq 'Y'); | print "<html><br><font color=' . $color . '><A HREF=\"http://' . $xymon_web_server . '/' . '$cgiloc/svcstatus.sh?HOST=' . $lf . '\">' . $lf . ' [ '. $color . ' ]' . '</A></font></html>" if ($DEBUG eq 'Y'); |
| |
| $alert_locales->{$lat_long_ref->{locale}->{$target_node}->{lat}}->{$lat_long_ref->{locale}->{$target_node}->{long}}->{message} .= $pin_message; | $alert_locales->{$lat_long_ref->{locale}->{$target_node}->{lat}}->{$lat_long_ref->{locale}->{$target_node}->{long}}->{message} .= $pin_message; |
| my $tmp_locale = $lat_long_ref->{locale}->{$target_node}->{lat} . ',' . $lat_long_ref->{locale}->{$target_node}->{long}; | my $tmp_locale = $lat_long_ref->{locale}->{$target_node}->{lat} . ',' . $lat_long_ref->{locale}->{$target_node}->{long}; |
| push(@ary_alert_locales, $tmp_locale); | push(@ary_alert_locales, $tmp_locale); |
| } | } |
| } | } |
| | print "sitecolor-last: $sitecolor\n" if ($DEBUG eq 'Y'); |
| } | } |
| |
| print (OUT ' pinID, ' . "\n"); | print (OUT ' pinID, ' . "\n"); |
| print (OUT ' new VELatLong(long_in, lat_in), ' . "\n"); | print (OUT ' new VELatLong(long_in, lat_in), ' . "\n"); |
| | |
| | # print (OUT ' "/mms/gifs/red.gif", ' . "\n"); |
| print (OUT ' "/mms/gifs/' . $sitecolor . '-recent.gif", ' . "\n"); | print (OUT ' "/mms/gifs/' . $sitecolor . '-recent.gif", ' . "\n"); |
| | # print (OUT ' \'<img src="/mms/gifs/yellow.gif"> \' + device_in,' . "\n"); |
| print (OUT ' \'<img src="/mms/gifs/' . $sitecolor . '.gif"> \' + device_in,' . "\n"); | print (OUT ' \'<img src="/mms/gifs/' . $sitecolor . '.gif"> \' + device_in,' . "\n"); |
| $sitecolor = "green"; | |
| print (OUT ' alert_in,' . "\n"); | print (OUT ' alert_in,' . "\n"); |
| print (OUT ' "iconStyle",' . "\n"); | print (OUT ' "iconStyle",' . "\n"); |
| if(-z $ERRORFILE) { unlink $ERRORFILE; } | if(-z $ERRORFILE) { unlink $ERRORFILE; } |
| |
| # Embed website using iFrame | |
| #my $cmd = "$XYMON localhost \"status $localhost.xymonmap $COLOR `date`: XYMON map\n<iframe src=\"http://$xymon_web_server/$xymon_web_folder/html/xymonmap.html\" width=\"930\" height=\"522\" align=\"center\"></iframe>\""; | #my $cmd = "$XYMON localhost \"status $localhost.xymonmap $COLOR `date`: XYMON map\n<iframe src=\"http://$xymon_web_server/$xymon_web_folder/html/xymonmap.html\" width=\"930\" height=\"522\" align=\"center\"></iframe>\""; |
| # embed website using HTML5 | |
| my $cmd = "$XYMON localhost \"status $localhost.xymonmap $COLOR `date`: XYMON map\n<object data=\"http://$xymon_web_server/$xymon_web_folder/html/xymonmap.html\" width=\"930\" height=\"522\"> <embed src=http://$xymon_web_server/$xymon_web_folder/html/xymonmap.html width=\"900\" height=\"522\"> </embed> Error: Embedded data could not be displayed. </object>\""; | my $cmd = "$XYMON localhost \"status $localhost.xymonmap $COLOR `date`: XYMON map\n<object data=\"http://$xymon_web_server/$xymon_web_folder/html/xymonmap.html\" width=\"930\" height=\"522\"> <embed src=http://$xymon_web_server/$xymon_web_folder/html/xymonmap.html width=\"900\" height=\"522\"> </embed> Error: Embedded data could not be displayed. </object>\""; |
| |
| Gary Broadwater - Modified by Paul Ohashi to work as a plug-in for Big Brother. | Gary Broadwater - Modified by Paul Ohashi to work as a plug-in for Big Brother. |
| - Modified by Bart Gillis to work as a plug-in for XYMON. | - Modified by Bart Gillis to work as a plug-in for XYMON. |
| |
| |
| </code> | </code> |
| * **2012-01-20** | * **2012-01-20** |
| * Initial release | * Initial release |
| | * **2016-09-20** |
| | * Added alert color code onto the failing site. |
| | * Changed webpage embedding in the Xymon page from iFrame to HTML5 embed TAG. |