Page 1 of 1
Nagios Fusion Host Group Dashlet
Posted: Mon May 04, 2020 12:22 pm
by bpennin
All,
I have a host group with 1,452 hosts and the dashlet is dropping the 4th digit...showing 452. I have deleted and re-added with the same results of 3 digits? I can view the same host group on the Nagios XI server and it shows the correct number of 1,452. Am i missing something...
Re: Nagios Fusion Host Group Dashlet
Posted: Mon May 04, 2020 3:16 pm
by ssax
I labbed this up and it's working properly on mine. What version of Fusion are you running?
Try running this command and then waiting 15 minutes for the data to rebuild:
Code: Select all
/usr/local/nagiosfusion/scripts/truncate_polled.php
Then logout of your account in Fusion, then re-login again.
Re: Nagios Fusion Host Group Dashlet
Posted: Tue May 05, 2020 6:46 am
by bpennin
Thanks for your reply...I tried the command and waited 15 minutes and have the same result. I am on version 4.1.7 for Fusion and 5.6.6 for Nagios XI.
In your lab did you create a host group that had over 1,400 hosts? The dashlet works fine on host counts under 4 digits for me.
Re: Nagios Fusion Host Group Dashlet
Posted: Tue May 05, 2020 3:04 pm
by ssax
Yes, I created 1850 hosts and added them to a single hostgroup, the number showed properly.
Do this, run this command as root on the fusion server and leave it running:
Code: Select all
tail -Fn0 /var/log/httpd/error_log /var/log/httpd/ssl_error_log
Then open the page that shows that dashlet and once it loads send us the full output of the still running tail command.
Re: Nagios Fusion Host Group Dashlet
Posted: Tue May 05, 2020 3:28 pm
by bpennin
[root@lnxvnaghq004 scripts]# tail -Fn0 /var/log/httpd/error_log /var/log/httpd/ssl_error_log
==> /var/log/httpd/error_log <==
==> /var/log/httpd/ssl_error_log <==
[Tue May 05 16:22:34.169864 2020] [:error] [pid 29307] [client 10.13.163.30:54088] PHP Notice: Undefined index: auth_token in /usr/local/nagiosfusion/html/includes/components/fusioncore/fusioncore.inc.php on line 239, referer:
https://lnxvnaghq004.cinfin.com/nagiosf ... ervers.php
[Tue May 05 16:22:41.956342 2020] [:error] [pid 30215] [client 10.13.163.30:54091] PHP Notice: Undefined index: auth_token in /usr/local/nagiosfusion/html/includes/components/fusioncore/fusioncore.inc.php on line 239, referer:
https://lnxvnaghq004.cinfin.com/nagiosfusion/
I clicked on Home and then I tried to refresh the screen. This is all of the output.
Re: Nagios Fusion Host Group Dashlet
Posted: Tue May 05, 2020 3:47 pm
by ssax
Is the user you logged into the Fusion web interface as an Admin on that XI server?
Please attach this file:
Code: Select all
/usr/local/nagiosfusion/html/includes/dashlets/hostgroup_summary/hostgroup_summary.php
Re: Nagios Fusion Host Group Dashlet
Posted: Wed May 06, 2020 1:39 pm
by bpennin
Yes - admin level id accessing.
File below:
Code: Select all
[root@lnxvnaghq004 ~]# cat /usr/local/nagiosfusion/html/includes/dashlets/hostgroup_summary/hostgroup_summary.php
<?php
require_once(dirname(__FILE__) . '/../dashlet-helper.inc.php');
dashlets_data_check();
hostgroup_summary_dashlet();
function hostgroup_summary_dashlet() {
$server = grab_request_var('server');
$hostgroup = grab_request_var('hostgroup', 0);
$server = get_server($server);
if ($server === false) {
echo '<h3>' . _('Invalid server selection!') . '</h3>';
exit();
}
$hostgroup_members = get_server_polled_key($server, 'hostgroup_members', $limit = 1);
$host_status = get_server_polled_key($server, 'host_status', $limit = 1);
$service_status = get_server_polled_key($server, 'service_status', $limit = 1);
if (!isset($hostgroup_members[0]['hostgroup_members'])) {
echo '<h3>' . _('No recent data found for specified server!') . '</h3>';
exit();
}
$polled_time = date('Y-m-d H:i:s', $hostgroup_members[0]['polled_time']);
$polled_time = convert_server_timestring_to_local_timestring($server, $polled_time);
$hostgroup_members = unpack_array($hostgroup_members[0]['hostgroup_members']);
$host_status = unpack_array($host_status[0]['host_status']);
$service_status = unpack_array($service_status[0]['service_status']);
if (!isset($hostgroup_members[$hostgroup])) {
echo '<h3>' . _('No hostgroup data found!') . '</h3>';
exit();
}
$host_counts = array(
STATE_UP => 0,
STATE_DOWN => 0,
STATE_UNREACHABLE => 0
);
$service_counts = array(
STATE_OK => 0,
STATE_WARNING => 0,
STATE_CRITICAL => 0,
STATE_UNKNOWN => 0,
);
$members = $hostgroup_members[$hostgroup]['members'];
if (is_array($members) && count($members) > 0) {
foreach ($members as $host_name) {
if (isset($host_status[$host_name])) {
$host = $host_status[$host_name];
$host_counts[$host['current_state']]++;
if (isset($service_status[$host_name])) {
foreach ($service_status[$host_name] as $service) {
$service_counts[$service['current_state']]++;
}
}
}
}
}
$host_output = '';
$service_output = '';
if (array_sum($host_counts) == 0) {
$host_output = '0 ' . _('hosts');
} else {
foreach ($host_counts as $state => $value) {
$class = $verb = '';
$link_xi = $link_core = '';
$noun = _('hosts');
if ($value == 1)
$noun = _('host');
switch ($state) {
case STATE_UP:
$class = 'hostup';
$verb = _('up');
$link_xi = 'includes/components/xicore/status.php?show=hosts&hostgroup=' . urlencode($hostgroup) . '&hoststatustypes=2';
$link_core = 'status.cgi?hostgroup=' . urlencode($hostgroup) . '&style=hostdetail&&hoststatustypes=2&hostprops=0';
break;
case STATE_DOWN:
$class = 'hostdown';
$verb = _('down');
$link_xi = 'includes/components/xicore/status.php?show=hosts&hostgroup=' . urlencode($hostgroup) . '&hoststatustypes=4';
$link_core = 'status.cgi?hostgroup=' . urlencode($hostgroup) . '&style=hostdetail&hoststatustypes=4&hostprops=0';
break;
case STATE_UNREACHABLE:
$class = 'hostunreachable';
$verb = _('unreachable');
$link_xi = 'includes/components/xicore/status.php?show=hosts&hostgroup=' . urlencode($hostgroup) . '&hoststatustypes=8';
$link_core = 'status.cgi?hostgroup=' . urlencode($hostgroup) . '&style=hostdetail&hoststatustypes=8&hostprops=0';
break;
}
if ($value > 0) {
$host_value = "{$value} {$noun} {$verb}";
$host_link = get_tactical_link($host_value, $server, $link_xi, $link_core);
$host_output .= "<div class=\"{$class}\">{$host_link}</div>";
}
}
}
if (array_sum($service_counts) == 0) {
$service_output = '0 ' . _('services');
} else {
foreach ($service_counts as $state => $value) {
$class = $verb = '';
$link_xi = $link_core = '';
$noun = _('services');
if ($value == 1)
$noun = _('service');
switch ($state) {
case STATE_OK:
$class = 'serviceok';
$verb = _('ok');
$link_xi = 'includes/components/xicore/status.php?show=services&hostgroup=' . urlencode($hostgroup) . '&servicestatustypes=2';
$link_core = 'status.cgi?hostgroup=' . urlencode($hostgroup) . '&style=detail&&servicestatustypes=2&hoststatustypes=15&serviceprops=0&hostprops=0';
break;
case STATE_WARNING:
$class = 'servicewarning';
$verb = _('warning');
$link_xi = 'includes/components/xicore/status.php?show=services&hostgroup=' . urlencode($hostgroup) . '&servicestatustypes=4';
$link_core = 'status.cgi?hostgroup=' . urlencode($hostgroup) . '&style=detail&servicestatustypes=4&hoststatustypes=15&serviceprops=0&hostprops=0';
break;
case STATE_CRITICAL:
$class = 'servicecritical';
$verb = _('critical');
$link_xi = 'includes/components/xicore/status.php?show=services&hostgroup=' . urlencode($hostgroup) . '&servicestatustypes=16';
$link_core = 'status.cgi?hostgroup=' . urlencode($hostgroup) . '&style=detail&servicestatustypes=16&hoststatustypes=15&serviceprops=0&hostprops=0';
break;
case STATE_UNKNOWN:
$class = 'serviceunknown';
$verb = _('unknown');
$link_xi = 'includes/components/xicore/status.php?show=services&hostgroup=' . urlencode($hostgroup) . '&servicestatustypes=8';
$link_core = 'status.cgi?hostgroup=' . urlencode($hostgroup) . '&style=detail&servicestatustypes=8&hoststatustypes=15&serviceprops=0&hostprops=0';
break;
}
if ($value > 0) {
$service_value = "{$value} {$noun} {$verb}";
$service_link = get_tactical_link($service_value, $server, $link_xi, $link_core);
$service_output .= "<div class=\"{$class}\">{$service_link}</div>";
}
}
}
$hostgroup = get_tactical_link($hostgroup, $server,
'includes/components/xicore/status.php?show=services&hostgroup=' . urlencode($hostgroup),
'status.cgi?hostgroup=' . urlencode($hostgroup) . '&style=overview');
?>
<table class="table table-condensed table-striped table-bordered hoststatustable servicestatustable tactical">
<tr>
<th>
<?php echo _('Hostgroup'); ?>
</th>
<th>
<?php echo _('Hosts'); ?>
</th>
<th>
<?php echo _('Services'); ?>
</th>
</tr>
<tr>
<td>
<?php echo $hostgroup; ?>
</td>
<td>
<?php echo $host_output; ?>
</td>
<td>
<?php echo $service_output; ?>
</td>
</tr>
</table>
<?php
Re: Nagios Fusion Host Group Dashlet
Posted: Wed May 06, 2020 5:05 pm
by ssax
Same as mine, I think we'll need to debug this on a remote session as the tables are pretty big.
Please create a ticket for this and include a link back to this forum thread so we can get a remote session setup:
https://support.nagios.com/tickets/
Re: Nagios Fusion Host Group Dashlet
Posted: Thu May 07, 2020 8:15 am
by bpennin
Created - Thanks for your help and looking forward to getting to the root of this.
Ticket info:
Fusion Dashlet Not Reporting 4 digits of host data #278014
Re: Nagios Fusion Host Group Dashlet
Posted: Thu May 07, 2020 8:38 am
by scottwilkerson
Great
Locking forum thread, moving to ticket