Exemplo n.º 1
0
<?php

/* Observium Network Management and Monitoring System
 * Copyright (C) 2006-2013, Observium Developers - http://www.observium.org
 *
 * @package    observium
 * @subpackage poller
 * @author     Adam Armstrong <*****@*****.**>
 * @copyright  (C) 2006 - 2013 Adam Armstrong
 *
 */
// Call poll_sensor for each sensor type that we support.
foreach ($config['sensor_classes'] as $sensor_class => $sensor_unit) {
    poll_sensor($device, $sensor_class, $sensor_unit);
}
/* Observium Network Management and Monitoring System
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
global $graphs;
if (dbFetchCell('SELECT COUNT(*) FROM `sensors` WHERE `device_id` = ? AND `sensor_deleted` = ?;', array($device['device_id'], '0')) > 0) {
    echo '传感器: ' . PHP_EOL;
    // Cache data for use by polling modules
    foreach (dbFetchRows("SELECT `sensor_type` FROM `sensors` WHERE `device_id` = ? AND `poller_type` = 'snmp' AND `sensor_deleted` = '0' GROUP BY `sensor_type`", array($device['device_id'])) as $s_type) {
        if (is_array($config['sensor']['cache_oids'][$s_type['sensor_type']])) {
            echo '缓存中: ' . $s_type['sensor_type'] . ' ';
            foreach ($config['sensor']['cache_oids'][$s_type['sensor_type']] as $oid_to_cache) {
                if (!$oids_cached[$oid_to_cache]) {
                    echo $oid_to_cache . ' ';
                    $oids_cached[$oid_to_cache] = TRUE;
                    $oid_cache = snmpwalk_numericoids($device, $oid_to_cache, $oid_cache);
                    $oids_cached[$oid_to_cache] = TRUE;
                }
            }
            echo PHP_EOL;
        }
    }
    // Call poll_sensor for each sensor type that we support.
    foreach ($config['sensor_types'] as $sensor_class => $sensor_class_data) {
        poll_sensor($device, $sensor_class, $sensor_class_data['symbol'], $oid_cache);
    }
}
// EOF
Exemplo n.º 3
0
<?php

/* Observium Network Management and Monitoring System
 * Copyright (C) 2006-2011, Observium Developers - http://www.observium.org
 *
 * 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.
 *
 * See COPYING for more details.
 */
// Call poll_sensor for each sensor type that we support.
$supported_sensors = array('current' => 'A', 'frequency' => 'Hz', 'humidity' => '%', 'fanspeed' => 'rpm', 'power' => 'W', 'voltage' => 'V', 'temperature' => 'C', 'dbm' => 'dBm', 'charge' => '%', 'load' => '%', 'state' => '#');
foreach ($supported_sensors as $sensor_type => $sensor_unit) {
    poll_sensor($device, $sensor_type, $sensor_unit);
}