mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Nagios Services
- Moved check-services.php to a poller module - Added performance data collection to the poller - Centralised DB functions to includes/services.inc.php - Created add/edit/delete functions off the device, services page - Removed legacy edit/delete interfaces. - Moved and modified check.inc scripts - Documentation Updates - Modified services table
This commit is contained in:
@@ -1,49 +1,44 @@
|
||||
<?php
|
||||
|
||||
if ($services['total']) {
|
||||
echo '<div class="container-fluid">';
|
||||
echo '<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">';
|
||||
echo "<img src='images/16/cog.png'><strong> Services</strong>";
|
||||
echo ' </div>
|
||||
<table class="table table-hover table-condensed table-striped">';
|
||||
|
||||
echo "
|
||||
<tr>
|
||||
<td><img src='images/16/cog.png'> $services[total]</td>
|
||||
<td><img src='images/16/cog_go.png'> $services[up]</td>
|
||||
<td><img src='images/16/cog_error.png'> $services[down]</td>
|
||||
<td><img src='images/16/cog_disable.png'> $services[disabled]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='4'>";
|
||||
|
||||
foreach (dbFetchRows('SELECT * FROM services WHERE device_id = ? ORDER BY service_type', array($device['device_id'])) as $data) {
|
||||
if ($data['service_status'] == '0' && $data['service_ignore'] == '1') {
|
||||
$status = 'grey';
|
||||
}
|
||||
|
||||
if ($data['service_status'] == '1' && $data['service_ignore'] == '1') {
|
||||
$status = 'green';
|
||||
}
|
||||
|
||||
if ($data['service_status'] == '0' && $data['service_ignore'] == '0') {
|
||||
// Build the string.
|
||||
foreach (service_get ($device['device_id']) as $data) {
|
||||
if ($data['service_status'] == '1') {
|
||||
// Ok
|
||||
$status = 'green';
|
||||
} elseif ($data['service_status'] == '0') {
|
||||
// Critical
|
||||
$status = 'red';
|
||||
} elseif ($data['service_status'] == '2') {
|
||||
// Warning
|
||||
$status = 'red';
|
||||
} else {
|
||||
// Unknown
|
||||
$status = 'grey';
|
||||
}
|
||||
|
||||
if ($data['service_status'] == '1' && $data['service_ignore'] == '0') {
|
||||
$status = 'blue';
|
||||
}
|
||||
|
||||
echo "$break<a class=$status>".strtolower($data['service_type']).'</a>';
|
||||
$string .= $break . '<a class=' . $status . '>' . strtolower ($data['service_type']) . '</a>';
|
||||
$break = ', ';
|
||||
}
|
||||
|
||||
echo '</td></tr></table>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}//end if
|
||||
?>
|
||||
<div class="container-fluid">
|
||||
<div class="row col-md-12">
|
||||
<div class="panel panel-default panel-condensed">
|
||||
<div class="panel-heading">
|
||||
<img src='images/16/cog.png'><strong> Services</strong>
|
||||
</div>
|
||||
<table class="table table-hover table-condensed table-striped">
|
||||
<tr>
|
||||
<td title="Total"><img src='images/16/cog.png'> <?=$services['total']?></td>
|
||||
<td title="Status - Ok"><img src='images/16/cog_add.png'> <?=$services[1]?></td>
|
||||
<td title="Status - Critical"><img src='images/16/cog_delete.png'> <?=$services[0]?></td>
|
||||
<td title="Status - Unknown"><img src='images/16/cog_error.png'> <?=$services[2]?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='4'><?=$string?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
Reference in New Issue
Block a user