当前位置: 首页>>代码示例>>PHP>>正文


PHP check_valid_sensors函数代码示例

本文整理汇总了PHP中check_valid_sensors函数的典型用法代码示例。如果您正苦于以下问题:PHP check_valid_sensors函数的具体用法?PHP check_valid_sensors怎么用?PHP check_valid_sensors使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了check_valid_sensors函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: d_echo

<?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";
开发者ID:sfromm,项目名称:librenms,代码行数:9,代码来源:power.inc.php

示例2: print_r

<?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";
开发者ID:rasssta,项目名称:librenms,代码行数:11,代码来源:frequencies.inc.php

示例3: dbInsert

            }
        }
        // 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";
}
开发者ID:RomanBogachev,项目名称:observium,代码行数:31,代码来源:unix-agent.inc.php

示例4: foreach

            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
开发者ID:runborg,项目名称:librenms,代码行数:31,代码来源:unix-agent.inc.php

示例5: get_dev_attrib

/// 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
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:ipmi.inc.php

示例6: print_r

<?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";
开发者ID:RomanBogachev,项目名称:observium,代码行数:11,代码来源:dbm.inc.php

示例7: array

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage discovery
 * @author     Adam Armstrong <adama@memetic.org>
 * @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
开发者ID:skive,项目名称:observium,代码行数:28,代码来源:sensors.inc.php

示例8: d_echo

<?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";
开发者ID:samyscoub,项目名称:librenms,代码行数:19,代码来源:states.inc.php

示例9: get_dev_attrib

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');
开发者ID:awlx,项目名称:librenms,代码行数:30,代码来源:ipmi.inc.php


注:本文中的check_valid_sensors函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。