Page 1 of 2
Problems with NagMap 1.1
Posted: Thu Oct 10, 2013 3:36 pm
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?
Re: Problems with NagMap 1.1
Posted: Thu Oct 10, 2013 3:47 pm
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:
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?
Re: Problems with NagMap 1.1
Posted: Fri Oct 11, 2013 10:18 am
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.
Re: Problems with NagMap 1.1
Posted: Fri Oct 11, 2013 12:13 pm
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.
Re: Problems with NagMap 1.1
Posted: Fri Oct 11, 2013 1:35 pm
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 [email protected] 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 [email protected] for free assistance.</h3>";
}
?>
</body>
</html>
Re: Problems with NagMap 1.1
Posted: Fri Oct 11, 2013 1:53 pm
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.
Re: Problems with NagMap 1.1
Posted: Mon Oct 14, 2013 7:15 am
by samuelvitorino
You found anything?
Ty
Re: Problems with NagMap 1.1
Posted: Mon Oct 14, 2013 9:16 am
by tmcdonald
I replied to you via PM. The file you attached is not what I needed.
Re: Problems with NagMap 1.1
Posted: Mon Oct 14, 2013 9:39 am
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.
Re: Problems with NagMap 1.1
Posted: Mon Oct 14, 2013 9:57 am
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