Skip to content
Permalink
Browse files

Merge branch 'master' of https://github.com/cat5tv/nems-scripts

  • Loading branch information...
NEMS Linux
NEMS Linux committed Aug 23, 2019
2 parents 69d144a + 3732ec3 commit cd6c27d9ce078fbaa0cb257353743b291a69eecb
Showing with 24 additions and 19 deletions.
  1. +24 −19 stats-livestatus-all.sh
@@ -142,34 +142,39 @@ EOQ;
while ( list(, $row) = each($hosts) ) {
// services with info
$services = array();
if (is_array($row[9])) foreach ($row[9] as $service) {
$services[] = array(
'service'=>$service[0],
'state'=>$service[1],
'output'=>$service[3]
);
}
} else {
$services[] = array(); // for hosts that don't have any service checks
}
$nems->hosts[] = array(
'host_name'=>$row[0],
'alias'=>$row[1],
'address'=>$row[2],
'check_command'=>$row[3],
'display_name'=>$row[4],
'hard_state'=>$row[5],
'is_flapping'=>$row[6],
'last_check'=>$row[7],
'state'=>$row[8],
'services'=>$services,
);
'host_name'=>$row[0],
'alias'=>$row[1],
'address'=>$row[2],
'check_command'=>$row[3],
'display_name'=>$row[4],
'hard_state'=>$row[5],
'is_flapping'=>$row[6],
'last_check'=>$row[7],
'state'=>$row[8],
'services'=>$services,
);
}
if (!isset($nems->hosts)) {
$nems->hosts = array();
}
}
// quickstate is used by NCS Dashboard to display a very fast overview of how many hosts/services are in each state
$nems->quickstate = json_decode(trim(shell_exec('/usr/local/bin/nems-info state')));
echo json_encode($nems);
if (!isset($nems->hosts)) {
$nems->hosts = array();
}
// quickstate is used by NCS Dashboard to display a very fast overview of how many hosts/services are in each state
$nems->quickstate = json_decode(trim(shell_exec('/usr/local/bin/nems-info state')));
echo json_encode($nems);
?>

0 comments on commit cd6c27d

Please sign in to comment.
You can’t perform that action at this time.