addons:xymonmap

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
addons:xymonmap [2012/01/25 19:29] – external edit 127.0.0.1addons:xymonmap [2016/09/20 09:47] – [Changelog] b-art
Line 93: Line 93:
 use strict; use strict;
 use XML::Simple; use XML::Simple;
 +$XML::Simple::PREFERRED_PARSER = 'XML::Parser';
  
 my $XYMONHOME = "/opt/mms/server"; my $XYMONHOME = "/opt/mms/server";
 my $XYMON = "$XYMONHOME/bin/xymon"; my $XYMON = "$XYMONHOME/bin/xymon";
-my $localhost = "mms-test";+my $localhost = "localhost.localdomain";
 my $cgiloc = "mms-cgi"; my $cgiloc = "mms-cgi";
 #PO - More information for the status message #PO - More information for the status message
 my $theEpoch = time(); my $theEpoch = time();
 my $kaoDate = localtime($theEpoch); my $kaoDate = localtime($theEpoch);
- 
 #PO - Declare $machineName and $testName and concatenate them for the links on the pop-ups. #PO - Declare $machineName and $testName and concatenate them for the links on the pop-ups.
 # $XYMESSAGE is for UNIX/Linux # $XYMESSAGE is for UNIX/Linux
-my ($machineName, $testName, $YXMESSAGE);+my ($machineName, $testName, $XYMESSAGE);
  
 ######################## START CONFIG ######################## START CONFIG
-# Might need some degug+# Might need some debug
 my $DEBUG = 'N'; my $DEBUG = 'N';
  
 # You should use an FQDN or IP address of the XYMONServer # You should use an FQDN or IP address of the XYMONServer
-my $xymon_web_server = '172.29.153.62';+my $xymon_web_server =  "192.168.56.102"; 
 # The top URL directory name for the Xymon webpages # The top URL directory name for the Xymon webpages
 my $xymon_web_folder = 'mms'; my $xymon_web_folder = 'mms';
Line 125: Line 126:
  
 #-------- Define the initial lat/long to display in the report #-------- Define the initial lat/long to display in the report
-my $init_lat = '4.726811'; # +my $init_lat = '17.10430'; # 
-my $init_long = '50.848775'; # This configuration is for the Leuven view +my $init_long = '45.34530'; # This configuration is for the Servië view 
-my $init_zoom_level = '9'; #+my $init_zoom_level = '4'; #
  
 ######################## END CONFIG ######################## END CONFIG
Line 135: Line 136:
 my $testFailed; my $testFailed;
 my $COLOR = ''; my $COLOR = '';
 +my $sitecolor = "green";
 my $pin_message; my $pin_message;
 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
 $year = $year + 1900; $year = $year + 1900;
 +
 # Start a log file, if it's empty when the script ends we'll delete it - so if it's there you know something went wrong. # Start a log file, if it's empty when the script ends we'll delete it - so if it's there you know something went wrong.
 my $ERRORFILE = "/var/log/mms/xymon_geo_map.log"; my $ERRORFILE = "/var/log/mms/xymon_geo_map.log";
 open (STDERR, ">${ERRORFILE}"); open (STDERR, ">${ERRORFILE}");
- 
 open(OUT, "> $xymon_hist") or die "Can't open $xymon_hist\n"; open(OUT, "> $xymon_hist") or die "Can't open $xymon_hist\n";
  
Line 147: Line 149:
 #     report or things won't work right. So, I call html_start() in the process_data subroutine. #     report or things won't work right. So, I call html_start() in the process_data subroutine.
 #html_start(); #html_start();
- 
 process_data(); process_data();
- 
 html_end(); html_end();
 close(OUT); close(OUT);
Line 182: Line 182:
         $color = $l1x[1];         $color = $l1x[1];
  $testFailed = 0;  $testFailed = 0;
- $testFailed = 1 if ($color eq 'red' || $color eq 'purple'); + $testFailed = 1 if ($color eq 'red' || $color eq 'purple'|| $color eq 'yellow'); 
 +# $testFailed = 1 if ($color eq 'red' || $color eq 'purple');
  #PO - change commas to dots in the log file name  #PO - change commas to dots in the log file name
  ($machineName, $testName) = split(/\./, $lf, 2);  ($machineName, $testName) = split(/\./, $lf, 2);
Line 194: Line 194:
  
     if ($testFailed == 1) {     if ($testFailed == 1) {
- $COLOR = 'yellow'; + if ($color eq 'red') { 
 + $sitecolor "red"; 
 + }elsif ($color eq 'purple' && $sitecolor ne 'red'){ 
 + $sitecolor = "purple"; 
 + }elsif ($color eq 'yellow' && $sitecolor ne 'red' && $sitecolor ne 'purple'){ 
 + $sitecolor = "yellow"
 + }else {$sitecolor = "green"; 
 +
 +$COLOR = 'green';
 $machineName =~ s/\.[A-z]+$//g; $machineName =~ s/\.[A-z]+$//g;
 $machineName =~ s/\.//g; $machineName =~ s/\.//g;
  
 next if ($color eq 'green' || $color eq 'clear'); next if ($color eq 'green' || $color eq 'clear');
- #print "machineName: ${machineName} - Test: $testName - Color: $color\n";+ print "machineName: ${machineName} - Test: $testName - Color: $color\n" if ($DEBUG eq 'Y');
  
  #PO - For Windows:  #PO - For Windows:
- $pin_message .= '<html><br><font color=' . $color . '><A HREF=\\"http://' . $xymon_web_server . '/' . $cgiloc . '/svcstatus.sh?HOST=' . ${machineName} . '&SERVICE=' . ${testName} . '\\">' . $lf . ' [ '. $color . ' ]' . '</A></font></html>';+ $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;
Line 231: Line 237:
 sub html_start() { sub html_start() {
   $COLOR = 'yellow' if ($testFailed == 1);   $COLOR = 'yellow' if ($testFailed == 1);
- +  print (OUT '<img src=/mms/gifs/'$sitecolor . '.gif> ' . "${kaoDate}\n<strong>We have 1 datacenters in Hasselt and 1 in Leuven</strong>.\n");        
-  print (OUT "${COLOR} ${kaoDate}\n<strong>We have 1 datacenters in Hasselt and 1 in Leuven</strong>.\n");      +
   print (OUT '     <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>' . "\n");   print (OUT '     <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>' . "\n");
              
Line 261: Line 266:
   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 '      \'<img src="/mms/gifs/red.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");
Line 295: Line 300:
 if(-z $ERRORFILE) { unlink $ERRORFILE; } if(-z $ERRORFILE) { unlink $ERRORFILE; }
  
-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 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>\"";
  
-print "$cmd\n";+#print "$cmd\n";
 system ($cmd); system ($cmd);
  
Line 361: Line 369:
 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>
Line 375: Line 384:
   * **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.
  • addons/xymonmap.txt
  • Last modified: 2016/09/20 12:01
  • by b-art