Example #1
0
<?php 
$services = get_services();
if (count($services) > 0) {
    uasort($services, "service_name_compare");
    foreach ($services as $service) {
        if (empty($service['name'])) {
            continue;
        }
        if (empty($service['description'])) {
            $service['description'] = get_pkg_descr($service['name']);
        }
        echo "<tr><td class=\"listlr\" width=\"20%\">" . $service['name'] . "</td>\n";
        echo "<td class=\"listr\" width=\"55%\">" . $service['description'] . "</td>\n";
        // if service is running then listr else listbg
        $bgclass = null;
        if (get_service_status($service)) {
            $bgclass = "listr";
        } else {
            $bgclass = "listbg";
        }
        echo "<td class=\"" . $bgclass . "\" align=\"center\">" . get_service_status_icon($service, true, true) . "</td>\n";
        echo "<td valign=\"middle\" class=\"list nowrap\">" . get_service_control_links($service);
        $scut = get_shortcut_by_service_name($service['name']);
        if (!empty($scut)) {
            echo get_shortcut_main_link($scut, true, $service);
            echo get_shortcut_status_link($scut, true, $service);
            echo get_shortcut_log_link($scut, true);
        }
        echo "</td></tr>\n";
    }
} else {
Example #2
0
<?php

// FIXME - this could do with some performance improvements, i think. possible rearranging some tables and setting flags at poller time (nothing changes outside of then anyways)
use LibreNMS\ObjectCache;
$service_status = get_service_status();
$typeahead_limit = $config['webui']['global_search_result_limit'];
$if_alerts = dbFetchCell("SELECT COUNT(port_id) FROM `ports` WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND `ignore` = '0'");
if ($_SESSION['userlevel'] >= 5) {
    $links['count'] = dbFetchCell("SELECT COUNT(*) FROM `links`");
} else {
    $links['count'] = dbFetchCell("SELECT COUNT(*) FROM `links` AS `L`, `devices` AS `D`, `devices_perms` AS `P` WHERE `P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id` AND `L`.`local_device_id` = `D`.`device_id`", array($_SESSION['user_id']));
}
if (isset($config['enable_bgp']) && $config['enable_bgp']) {
    $bgp_alerts = dbFetchCell("SELECT COUNT(bgpPeer_id) FROM bgpPeers AS B where (bgpPeerAdminStatus = 'start' OR bgpPeerAdminStatus = 'running') AND bgpPeerState != 'established'");
}
if (isset($config['site_style']) && ($config['site_style'] == 'dark' || $config['site_style'] == 'mono')) {
    $navbar = 'navbar-inverse';
} else {
    $navbar = '';
}
?>

<nav class="navbar navbar-default <?php 
echo $navbar;
?>
 navbar-fixed-top" role="navigation">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navHeaderCollapse">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
function update_services_status_all()
{
    $result = DBselect('SELECT s.serviceid,s.algorithm,s.triggerid' . ' FROM services s' . ' WHERE s.serviceid NOT IN (' . 'SELECT DISTINCT sl.serviceupid' . ' FROM services_links sl' . ')');
    while ($row = DBfetch($result)) {
        $status = get_service_status($row['serviceid'], $row['algorithm'], $row['triggerid']);
        DBexecute('UPDATE services SET status=' . zbx_dbstr($status) . ' WHERE serviceid=' . $row['serviceid']);
        add_service_alarm($row['serviceid'], $status, time());
    }
    $result = DBselect('SELECT MAX(sl.servicedownid) AS serviceid,sl.serviceupid' . ' FROM services_links sl' . ' WHERE sl.servicedownid NOT IN (' . 'SELECT DISTINCT sl.serviceupid FROM services_links sl' . ')' . ' GROUP BY sl.serviceupid');
    while ($row = DBfetch($result)) {
        update_services_rec($row['serviceid']);
    }
}
<?php 
$skipservices = explode(",", $config['widgets']['servicestatusfilter']);
if (count($services) > 0) {
    uasort($services, "service_name_compare");
    foreach ($services as $service) {
        if (!$service['name'] || in_array($service['name'], $skipservices) || !is_service_enabled($service['name'])) {
            continue;
        }
        if (empty($service['description'])) {
            $service['description'] = get_pkg_descr($service['name']);
        }
        $service_desc = explode(".", $service['description']);
        ?>
		<tr>
			<td><i class="fa fa-<?php 
        echo get_service_status($service) ? 'check-circle text-success' : 'times-circle text-warning';
        ?>
"></i></td>
			<td><?php 
        echo $service['name'];
        ?>
</td>
			<td><?php 
        echo $service_desc[0];
        ?>
</td>
			<td><?php 
        echo get_service_control_GET_links($service);
        ?>
</td>
		</tr>
Example #5
0
<?php

$overview = 1;
$ports['total'] = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE device_id = ?", array($device['device_id']));
$ports['up'] = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE device_id = ? AND `ifOperStatus` = 'up' AND `ifAdminStatus` = 'up'", array($device['device_id']));
$ports['down'] = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE device_id = ? AND `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up'", array($device['device_id']));
$ports['disabled'] = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE device_id = ? AND `ifAdminStatus` = 'down'", array($device['device_id']));
$services = get_service_status($device['device_id']);
$services['total'] = array_sum($services);
if ($services[2]) {
    $services_colour = $warn_colour_a;
} else {
    $services_colour = $list_colour_a;
}
if ($ports['down']) {
    $ports_colour = $warn_colour_a;
} else {
    $ports_colour = $list_colour_a;
}
echo '
<div class="container-fluid">
  <div class="row">
    <div class="col-md-12">
      &nbsp;
    </div>
  </div>
  <div class="row">
    <div class="col-md-6">
';
require 'includes/dev-overview-data.inc.php';
Plugins::call('device_overview_container', array($device));
Example #6
0
function update_services_status_all()
{
    clear_parents_from_trigger();
    $result = DBselect('SELECT s.serviceid,s.algorithm,s.triggerid ' . ' FROM services s ' . ' WHERE s.serviceid NOT IN (select distinct sl.serviceupid from services_links sl)');
    while ($rows = DBfetch($result)) {
        $status = get_service_status($rows['serviceid'], $rows['algorithm'], $rows['triggerid']);
        DBexecute('UPDATE services SET status = ' . $status . ' WHERE serviceid=' . $rows['serviceid']);
        add_service_alarm($rows['serviceid'], $status, time());
    }
    $result = DBselect('SELECT MAX(sl.servicedownid) as serviceid, sl.serviceupid ' . ' FROM services_links sl ' . ' WHERE sl.servicedownid NOT IN (select distinct sl.serviceupid from services_links sl) ' . ' GROUP BY sl.serviceupid');
    while ($rows = DBfetch($result)) {
        update_services_rec($rows['serviceid']);
    }
}
<?php 
$skipservices = explode(",", $config['widgets']['servicestatusfilter']);
if (count($services) > 0) {
    uasort($services, "service_name_compare");
    foreach ($services as $service) {
        if (!$service['name'] || in_array($service['name'], $skipservices) || !is_service_enabled($service['name'])) {
            continue;
        }
        if (empty($service['description'])) {
            $service['description'] = get_pkg_descr($service['name']);
        }
        $service_desc = explode(".", $service['description']);
        ?>
		<tr>
			<td><i class="icon icon-<?php 
        echo get_service_status($service) ? 'ok' : 'remove';
        ?>
-sign"></i></td>
			<td><?php 
        echo $service['name'];
        ?>
</td>
			<td><?php 
        echo $service_desc[0];
        ?>
</td>
			<td><?php 
        echo get_service_control_links($service);
        ?>
</td>
		</tr>
Example #8
0
<?php

require_once "includes/functions.inc.php";
require_once "includes/format.inc.php";
require_once "includes/config.inc.php";
if ($_POST["client"] && ($action = $_POST["action"])) {
    $client = $_POST["client"];
    $action = $_POST["action"];
    $msj = check_action($service, $client, $action);
}
// Print Document Headers
doc_header($msj);
// Get service status
$service_status = get_service_status($service, $status_opts);
// Get playback status
$playback_status = get_playback_status();
print "<strong>now playing:</strong>";
print '<div style="width:50%;"><marquee behavior="scroll" direction="left"><pre>' . $playback_status . '</pre></marquee></div>';
print '<hr align="center" width="80%" noshade="noshade" />';
// Separate each instance
$delimiters = array("\n");
$result = multiexplode($delimiters, $service_status);
// Process each instance
foreach ($result as $pre_status) {
    // Separate name and process status
    $delimiters = array(" ");
    $info = multiexplode($delimiters, $pre_status);
    // Get usefull data
    $replace = array("(", ")");
    $name = str_replace($replace, " ", "{$info['0']}");
    $status = $info[1];
<?php 
$skipservices = explode(",", $config['widgets']['servicestatusfilter']);
if (count($services) > 0) {
    uasort($services, "service_name_compare");
    foreach ($services as $service) {
        if (!$service['name'] || in_array($service['name'], $skipservices) || !is_service_enabled($service['name'])) {
            continue;
        }
        if (empty($service['description'])) {
            $service['description'] = get_pkg_descr($service['name']);
        }
        $service_desc = explode(".", $service['description']);
        ?>
		<tr>
			<td><i class="fa fa-<?php 
        echo get_service_status($service) ? 'check' : 'times';
        ?>
-circle"></i></td>
			<td><?php 
        echo $service['name'];
        ?>
</td>
			<td><?php 
        echo $service_desc[0];
        ?>
</td>
			<td><?php 
        echo get_service_control_GET_links($service);
        ?>
</td>
		</tr>