Problems with NagMap 1.1

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
samuelvitorino
Posts: 7
Joined: Thu Oct 10, 2013 3:16 pm

Problems with NagMap 1.1

Post by samuelvitorino »

The NagMap was operating normally today, now it no longer carries the Google Maps is just a white screen. Already restarted apache, I set another version of NagMap but without success.

Does anyone have an idea what to do?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Problems with NagMap 1.1

Post by tmcdonald »

Oddly enough, I *just* wrote a draft of some documentation for NagMap.

Things to check:

Make sure each host note ONLY has the string "latlng: <latitude>,<longitude>" like so:

Code: Select all

latlng: 66.174082,-13.119136
Single space after the colon, no space after the comma, no space at the end. If there is anything else in the Notes section, NagMap will fail. I've contacted the author about getting this fixed.

Also make sure your status.dat and nagios.cfg paths are correct. NagMap is not very forgiving of misconfigurations.

Care to PM me your config.inc.php?
Former Nagios employee
samuelvitorino
Posts: 7
Joined: Thu Oct 10, 2013 3:16 pm

Re: Problems with NagMap 1.1

Post by samuelvitorino »

As I said earlier, Nagios was running normally. I even used the version of NagMap that has a sidebar with all hosts, it loads normally but the map does not load it is blank, the part of the map shows nothing it is just a white window! I checked the coordinates are correct and I really do not know what the problem is.
Last edited by slansing on Fri Oct 11, 2013 10:47 am, edited 1 time in total.
Reason: Please do not "BUMP" your posts, it only places you lower on our internal tracking system.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Problems with NagMap 1.1

Post by tmcdonald »

Did you make any changes in-between the time it was working and the time it failed? Any new hosts or services?

I'd like to take a look at the index.php and config.php files from your NagMap directory. Can you post them in code tags please? There shouldn't be any sensitive information by default, but if you don't want to post your GPS coords publicly, you can PM everything to me.
Former Nagios employee
samuelvitorino
Posts: 7
Joined: Thu Oct 10, 2013 3:16 pm

Re: Problems with NagMap 1.1

Post by samuelvitorino »

I dont make any change on nagios, it just stop.

Config.php

Code: Select all

<?php

//set these two lines - they are very important
//in linux run `updatedb` and `locate nagios.cfg` and `locate status.dat` to find these files
$nagios_cfg_file = "/usr/local/nagios/etc/nagios.cfg";
$nagios_status_dat_file = "/usr/local/nagios/var/status.dat";

//set to the centre of your map
$nagmap_map_centre = '-23.030150,-46.975551';
//default zoom level of the map
$nagmap_map_zoom = 9;
//show some additional links in the bubbles? 1=yes, 0=no
$nagmap_bubble_links = 1;
//show sidebar with hosts and their statuses? 1=yes, 0=no
$nagmap_sidebar = 0; 
//which google maps type to use?
$nagmap_map_type = 'ROADMAP'; //you can use any of these: ROADMAP or SATELLITE or HYBRID or TERRAIN
//use this only to generate extra information for support - this will add a lot of information into the rendered index file
$nagmap_debug = 0;

?>
Index.php

Code: Select all

<?php
$page = $_SERVER['PHP_SELF'];
$sec = "300"; 
header("Refresh: $sec; url=$page");
$nagmap_version = '1.1';
include('./config.php');
include('./call.php');


//get all data to display this page here:
include('marker.php');
?>
<html>
  <head>
    <link rel="shortcut icon" href="favicon.ico" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
	<link rel=StyleSheet href="style.css" type="text/css" media=screen>
    <title>NagMap <?php echo $nagmap_version ?></title>
    <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
    <script type="text/javascript">

    //static code from index.pnp
    function initialize() {
      var myOptions = {
        zoom: <?php echo ("$nagmap_map_zoom"); ?>, 
        center: new google.maps.LatLng(<?php echo $nagmap_map_centre ?>),
        mapTypeId: google.maps.MapTypeId.<?php echo $nagmap_map_type ?>
      };
      window.map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);

      //defining marker images
      var red_blank = new google.maps.MarkerImage(
        'http://www.google.com/mapfiles/marker.png', 
        new google.maps.Size(20,34), 
        new google.maps.Point(10,34));

      var blue_blank = new google.maps.MarkerImage(
        'http://www.google.com/mapfiles/marker_white.png',
        new google.maps.Size(20,34),
        new google.maps.Point(10,34));

      var green_blank = new google.maps.MarkerImage(
        'http://www.google.com/mapfiles/marker_green.png',
        new google.maps.Size(20,34),
        new google.maps.Point(10,34));

      var yellow_blank = new google.maps.MarkerImage(
        'http://www.google.com/mapfiles/marker_yellow.png',
        new google.maps.Size(20,34),
        new google.maps.Point(10,34));

      var grey_blank = new google.maps.MarkerImage(
        'http://www.google.com/mapfiles/marker_grey.png',
        new google.maps.Size(20,34),
        new google.maps.Point(10,34));

// generating dynamic code from here... 
// if the page ends here, there is something seriously wrong, please contact maco@blava.net for help

<?php 
  // print the body of the page here
  if ($javascript != "") { 
    echo $javascript; 
    echo '};'; //end of initialize function
    echo '
      </script>
      </head>
      <body style="margin:0px; padding:0px;" onload="initialize()">';
    if ($nagmap_sidebar == '1') {
      sort($sidebar['ok']);
      sort($sidebar['warning']);
      sort($sidebar['critical']);
      sort($sidebar['unknown']);
      echo '<div id="map_canvas" style="width:85%; height:100%; float: left"></div>';
      echo '<div id="sidebar" class="sidebar" style="padding-left: 10px; background: black; height:100%; overflow:auto;">'
        .'<span class="ok">ok:'.$stats['ok']
          ." (".round((100/($stats['warning']+$stats['critical']+$stats['unknown']+$stats['ok']))*($stats['ok']))."%)</span><br>"
        .'<span class="problem">problem:'.($stats['warning']+$stats['critical']+$stats['unknown'])
          ." (".round((100/($stats['warning']+$stats['critical']+$stats['unknown']+$stats['ok']))*($stats['warning']+$stats['critical']+$stats['unknown']))."%)</span><hr noshade>";
      foreach (array('critical','unknown','warning','ok') as $severity) { 
        foreach ($sidebar[$severity] as $entry) {
          echo $entry;
        }
      }
      echo '</div>';
    } else {
      echo '<div id="map_canvas" style="width:100%; height:100%; float: left"></div>';
    }
  } else {
    
    echo '};'; //end of initialize function
    echo '</script><head><body>';
    echo "<br><h3>There is no data to display. You either did not set NagMap properly or there is a software bug. Please contact maco@blava.net for free assistance.</h3>";
  }

?>

</body>
</html>

tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Problems with NagMap 1.1

Post by tmcdonald »

In your config.php at the very bottom, change $nagmap_debug to 1 and reload the page. There will be a ton of text on the screen and it won't be pretty, but it might help. Right click and view the page source, save it and PM the file to me. I'll dig a bit and see if I can find anything.
Former Nagios employee
samuelvitorino
Posts: 7
Joined: Thu Oct 10, 2013 3:16 pm

Re: Problems with NagMap 1.1

Post by samuelvitorino »

You found anything?

Ty
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Problems with NagMap 1.1

Post by tmcdonald »

I replied to you via PM. The file you attached is not what I needed.
Former Nagios employee
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Problems with NagMap 1.1

Post by tmcdonald »

Could you try running the following and paste the output?

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
And let's keep the discussions on the forums instead of email, so others that might have this problem can follow the thread.
Former Nagios employee
samuelvitorino
Posts: 7
Joined: Thu Oct 10, 2013 3:16 pm

Re: Problems with NagMap 1.1

Post by samuelvitorino »

I use this commando another time, but follow the output
Checking hosts...
Warning: Host '3com-Franceschi' has no services associated with it!
Warning: Host 'Central Plaza Shopping' has no services associated with it!
Warning: Host 'Prefeitura de Cabreuva' has no services associated with it!
Checked 20 hosts.
Checking host groups...
Checked 4 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 27 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 3
Total Errors: 0
Locked