Beispiel #1
0
<?php

echo 'Power: ';
// Include all discovery modules
$include_dir = 'includes/discovery/power';
require 'includes/include-dir.inc.php';
d_echo($valid['sensor']['power']);
check_valid_sensors($device, 'power', $valid['sensor']);
echo "\n";
Beispiel #2
0
<?php

echo 'Frequencies: ';
// Include all discovery modules
$include_dir = 'includes/discovery/frequencies';
require 'includes/include-dir.inc.php';
if ($debug) {
    print_r($valid['sensor']['frequency']);
}
check_valid_sensors($device, 'frequency', $valid['sensor']);
echo "\n";
            }
        }
        // MySQL
        if (!empty($agent_data['app']['mysql'])) {
            $app_found['mysql'] = TRUE;
            if (dbFetchCell("SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ?", array($device['device_id'], 'mysql')) == "0") {
                echo "Found new application 'MySQL'\n";
                dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'mysql'), 'applications');
            }
        }
        // DRBD
        if (!empty($agent_data['drbd'])) {
            $agent_data['app']['drbd'] = array();
            foreach (explode("\n", $agent_data['drbd']) as $drbd_entry) {
                list($drbd_dev, $drbd_data) = explode(":", $drbd_entry);
                if (preg_match("/^drbd/", $drbd_dev)) {
                    $agent_data['app']['drbd'][$drbd_dev] = $drbd_data;
                    if (dbFetchCell("SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ? AND `app_instance` = ?", array($device['device_id'], 'drbd', $drbd_dev)) == "0") {
                        echo "Found new application 'DRBD' {$drbd_dev}\n";
                        dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'drbd', 'app_instance' => $drbd_dev), 'applications');
                    }
                }
            }
        }
    }
    echo "Sensors: ";
    foreach (array_keys($config['sensor_classes']) as $sensor_class) {
        check_valid_sensors($device, $sensor_class, $valid['sensor'], 'agent');
    }
    echo "\n";
}
Beispiel #4
0
<?php

echo 'Current: ';
// Include all discovery modules
$include_dir = 'includes/discovery/current';
require 'includes/include-dir.inc.php';
if ($debug) {
    print_r($valid['sensor']['current']);
}
check_valid_sensors($device, 'current', $valid['sensor']);
echo "\n";
Beispiel #5
0
            foreach ($agent_data['app']['memcached'] as $memcached_host => $memcached_data) {
                if (dbFetchCell('SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ? AND `app_instance` = ?', array($device['device_id'], 'memcached', $memcached_host)) == '0') {
                    echo "Found new application 'Memcached' {$memcached_host}\n";
                    dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'memcached', 'app_status' => '', 'app_instance' => $memcached_host), 'applications');
                }
            }
        }
        // DRBD
        if (!empty($agent_data['drbd'])) {
            $agent_data['app']['drbd'] = array();
            foreach (explode("\n", $agent_data['drbd']) as $drbd_entry) {
                list($drbd_dev, $drbd_data) = explode(':', $drbd_entry);
                if (preg_match('/^drbd/', $drbd_dev)) {
                    $agent_data['app']['drbd'][$drbd_dev] = $drbd_data;
                    if (dbFetchCell('SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ? AND `app_instance` = ?', array($device['device_id'], 'drbd', $drbd_dev)) == '0') {
                        echo "Found new application 'DRBd' {$drbd_dev}\n";
                        dbInsert(array('device_id' => $device['device_id'], 'app_type' => 'drbd', 'app_status' => '', 'app_instance' => $drbd_dev), 'applications');
                    }
                }
            }
        }
    }
    //end if
    if (!empty($agent_sensors)) {
        echo 'Sensors: ';
        check_valid_sensors($device, 'temperature', $valid['sensor'], 'agent');
        echo "\n";
    }
    echo "\n";
}
//end if
Beispiel #6
0
/// FIXME. From this uses only check_valid_sensors(), maybe need move to global functions or copy to polling. --mike
include_once "includes/discovery/functions.inc.php";
if ($ipmi['host'] = get_dev_attrib($device, 'ipmi_hostname')) {
    $ipmi['user'] = get_dev_attrib($device, 'ipmi_username');
    $ipmi['password'] = get_dev_attrib($device, 'ipmi_password');
    $ipmi['port'] = get_dev_attrib($device, 'ipmi_port');
    $ipmi['interface'] = get_dev_attrib($device, 'ipmi_interface');
    $ipmi['userlevel'] = get_dev_attrib($device, 'ipmi_userlevel');
    if (!is_numeric($ipmi['port'])) {
        $ipmi['port'] = 623;
    }
    if ($ipmi['userlevel'] == '') {
        $ipmi['userlevel'] = 'USER';
    }
    if (array_search($ipmi['interface'], array_keys($config['ipmi']['interfaces'])) === FALSE) {
        $ipmi['interface'] = 'lan';
    }
    // Also triggers on empty value
    if ($config['own_hostname'] != $device['hostname'] || $ipmi['host'] != 'localhost') {
        $remote = " -I " . escapeshellarg($ipmi['interface']) . " -p " . $ipmi['port'] . " -H " . escapeshellarg($ipmi['host']) . " -L " . escapeshellarg($ipmi['userlevel']) . " -U " . escapeshellarg($ipmi['user']) . " -P " . escapeshellarg($ipmi['password']);
    }
    $results = external_exec($config['ipmitool'] . $remote . " sensor 2>/dev/null");
    $ipmi_sensors = parse_ipmitool_sensor($device, $results);
}
if (OBS_DEBUG) {
    print_vars($ipmi_sensors);
}
foreach ($config['ipmi_unit'] as $type) {
    check_valid_sensors($device, $type, $ipmi_sensors, 'ipmi');
}
// EOF
Beispiel #7
0
<?php

echo 'Load: ';
// Include all discovery modules
$include_dir = 'includes/discovery/load';
require 'includes/include-dir.inc.php';
d_echo($valid['sensor']['load']);
check_valid_sensors($device, 'load', $valid['sensor']);
echo "\n";
Beispiel #8
0
<?php

echo "dBm: ";
// Include all discovery modules
$include_dir = "includes/discovery/dbm";
include "includes/include-dir.inc.php";
if ($debug) {
    print_r($valid['sensor']['dbm']);
}
check_valid_sensors($device, 'dbm', $valid['sensor']);
echo "\n";
Beispiel #9
0
<?php

echo 'Voltages: ';
// Include all discovery modules
$include_dir = 'includes/discovery/voltages';
require 'includes/include-dir.inc.php';
if ($debug) {
    print_r($valid['sensor']['voltage']);
}
check_valid_sensors($device, 'voltage', $valid['sensor']);
echo "\n";
Beispiel #10
0
<?php

echo 'Fanspeeds : ';
// Include all discovery modules
$include_dir = 'includes/discovery/fanspeeds';
require 'includes/include-dir.inc.php';
if ($debug) {
    print_r($valid['sensor']['fanspeed']);
}
check_valid_sensors($device, 'fanspeed', $valid['sensor']);
echo "\n";
Beispiel #11
0
<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @author     Adam Armstrong <*****@*****.**>
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
$valid['sensor'] = array();
echo "Sensors: ";
$include_dir = "includes/discovery/sensors";
include $config['install_dir'] . "/includes/include-dir-mib.inc.php";
// Always include ENTITY-SENSOR-MIB
// Do this after the above include, as it checks for duplicates from CISCO-ENTITY-SENSOR-MIB
include $config['install_dir'] . "/includes/discovery/sensors/entity-sensor-mib.inc.php";
if ($debug && count($valid['sensor'])) {
    print_vars($valid['sensor']);
}
foreach (array_keys($config['sensor_types']) as $type) {
    check_valid_sensors($device, $type, $valid['sensor']);
}
echo PHP_EOL;
// EOF
Beispiel #12
0
<?php

echo 'Runtime: ';
// Include all discovery modules
$include_dir = 'includes/discovery/sensors/runtime';
require 'includes/include-dir.inc.php';
d_echo($valid['sensor']['runtime']);
check_valid_sensors($device, 'runtime', $valid['sensor']);
echo "\n";
Beispiel #13
0
<?php

echo 'Battery Charge: ';
// Include all discovery modules
$include_dir = 'includes/discovery/sensors/charge';
require 'includes/include-dir.inc.php';
d_echo($valid['sensor']['charge']);
check_valid_sensors($device, 'charge', $valid['sensor']);
echo "\n";
Beispiel #14
0
<?php

echo 'Signal: ';
// Include all discovery modules
$include_dir = 'includes/discovery/sensors/signal';
require 'includes/include-dir.inc.php';
d_echo($valid['sensor']['signal']);
check_valid_sensors($device, 'signal', $valid['sensor']);
echo "\n";
Beispiel #15
0
<?php

/*
 * LibreNMS
 *
 * Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.  Please see LICENSE.txt at the top level of
 * the source code distribution for details.
 */
echo 'States: ';
$include_dir = 'includes/discovery/states';
require 'includes/include-dir.inc.php';
d_echo($valid['sensor']['states']);
check_valid_sensors($device, 'states', $valid['sensor']);
echo "\n";
Beispiel #16
0
if ($ipmi['host'] = get_dev_attrib($device, 'ipmi_hostname')) {
    echo 'IPMI : ';
    $ipmi['user'] = get_dev_attrib($device, 'ipmi_username');
    $ipmi['password'] = get_dev_attrib($device, 'ipmi_password');
    if ($config['own_hostname'] != $device['hostname'] || $ipmi['host'] != 'localhost') {
        $remote = " -H " . $ipmi['host'] . " -U '" . $ipmi['user'] . "' -P '" . $ipmi['password'] . "' -L USER";
    }
    foreach ($config['ipmi']['type'] as $ipmi_type) {
        $results = external_exec($config['ipmitool'] . " -I {$ipmi_type}" . $remote . ' sensor 2>/dev/null|sort');
        if ($results != '') {
            set_dev_attrib($device, 'ipmi_type', $ipmi_type);
            break;
        }
    }
    echo $ipmi_type;
    $index = 0;
    foreach (explode("\n", $results) as $sensor) {
        // BB +1.1V IOH     | 1.089      | Volts      | ok    | na        | 1.027     | 1.054     | 1.146     | 1.177     | na
        list($desc, $current, $unit, $state, $low_nonrecoverable, $low_limit, $low_warn, $high_warn, $high_limit, $high_nonrecoverable) = explode('|', $sensor);
        $index++;
        if (trim($current) != 'na' && $config['ipmi_unit'][trim($unit)]) {
            discover_sensor($valid['sensor'], $config['ipmi_unit'][trim($unit)], $device, trim($desc), $index, 'ipmi', trim($desc), '1', '1', trim($low_limit) == 'na' ? null : trim($low_limit), trim($low_warn) == 'na' ? null : trim($low_warn), trim($high_warn) == 'na' ? null : trim($high_warn), trim($high_limit) == 'na' ? null : trim($high_limit), $current, 'ipmi');
        }
    }
    echo "\n";
}
check_valid_sensors($device, 'voltage', $valid['sensor'], 'ipmi');
check_valid_sensors($device, 'temperature', $valid['sensor'], 'ipmi');
check_valid_sensors($device, 'fanspeed', $valid['sensor'], 'ipmi');
check_valid_sensors($device, 'power', $valid['sensor'], 'ipmi');
Beispiel #17
0
<?php

echo "Humidity : ";
// Include all discovery modules
$include_dir = "includes/discovery/humidity";
include "includes/include-dir.inc.php";
if ($debug) {
    print_r($valid['sensor']['humidity']);
}
check_valid_sensors($device, 'humidity', $valid['sensor']);
echo "\n";