• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP set_dev_attrib函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: array_merge

 }
 $update = array_merge($update, $v3);
 $device_tmp = deviceArray($device['hostname'], $community, $snmpver, $port, $transport, $v3, $port_assoc_mode);
 if (isSNMPable($device_tmp)) {
     $rows_updated = dbUpdate($update, 'devices', '`device_id` = ?', array($device['device_id']));
     $max_repeaters_set = false;
     $max_oid_set = false;
     if (is_numeric($max_repeaters) && $max_repeaters != 0) {
         set_dev_attrib($device, 'snmp_max_repeaters', $max_repeaters);
         $max_repeaters_set = true;
     } else {
         del_dev_attrib($device, 'snmp_max_repeaters');
         $max_repeaters_set = true;
     }
     if (is_numeric($max_oid) && $max_oid != 0) {
         set_dev_attrib($device, 'snmp_max_oid', $max_oid);
         $max_oid_set = true;
     } else {
         del_dev_attrib($device, 'snmp_max_oid');
         $max_oid_set = true;
     }
     if ($rows_updated > 0) {
         $update_message = $rows_updated . ' Device record updated.';
         $updated = 1;
     } elseif ($rows_updated = '-1') {
         if ($max_repeaters_set === true || $max_repeaters_set === true) {
             if ($max_repeaters_set === true) {
                 $update_message = 'SNMP Max repeaters updated, no other changes made';
             }
             if ($max_oid_set === true) {
                 $update_message .= '<br />SNMP Max OID updated, no other changes made';
开发者ID:awlx,项目名称:librenms,代码行数:31,代码来源:snmp.inc.php


示例2: del_dev_attrib

 * @author     Adam Armstrong <[email protected]>
 * @copyright  (C) 2006-2015 Adam Armstrong
 *
 */
if ($vars['editing']) {
    if ($_SESSION['userlevel'] > "7") {
        $agent_port = $vars['agent_port'];
        if ($agent_port == "") {
            del_dev_attrib($device, 'agent_port');
            $updated = 1;
            $update_message = "代理设置更新.";
        } elseif (!is_numeric($agent_port)) {
            $update_message = "代理端口必须是数字!";
            $updated = 0;
        } else {
            set_dev_attrib($device, 'agent_port', $agent_port);
            $updated = 1;
            $update_message = "代理设置更新.";
        }
    }
}
$device = dbFetchRow("SELECT * FROM `devices` WHERE `device_id` = ?", array($device['device_id']));
$descr = $device['purpose'];
if ($updated && $update_message) {
    print_message($update_message);
    log_event('Device Agent configuration changed.', $device['device_id'], 'device', $device, 5);
    // severity 5, for logging user info
} elseif ($update_message) {
    print_error($update_message);
}
?>
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:agent.inc.php


示例3: array

     $update['timeout'] = $timeout;
 } else {
     $update['timeout'] = array('NULL');
 }
 if ($_POST['retries']) {
     $update['retries'] = $retries;
 } else {
     $update['retries'] = array('NULL');
 }
 $update = array_merge($update, $v3);
 $device_tmp = deviceArray($device['hostname'], $community, $snmpver, $port, $transport, $v3, $port_assoc_mode);
 if (isSNMPable($device_tmp)) {
     $rows_updated = dbUpdate($update, 'devices', '`device_id` = ?', array($device['device_id']));
     $max_repeaters_set = false;
     if (is_numeric($max_repeaters) && $max_repeaters != 0) {
         set_dev_attrib($device, 'snmp_max_repeaters', $max_repeaters);
         $max_repeaters_set = true;
     } else {
         del_dev_attrib($device, 'snmp_max_repeaters');
         $max_repeaters_set = true;
     }
     if ($rows_updated > 0) {
         $update_message = $rows_updated . ' Device record updated.';
         $updated = 1;
     } else {
         if ($rows_updated = '-1') {
             if ($max_repeaters_set === true) {
                 $update_message = 'SNMP Max repeaters updated, no other changes made';
             } else {
                 $update_message = 'Device record unchanged. No update necessary.';
             }
开发者ID:pblasquez,项目名称:librenms,代码行数:31,代码来源:snmp.inc.php


示例4: header

<?php

/*
 * LibreNMS
 *
 * Copyright (c) 2015 Søren Friis Rosiak <[email protected]>
 * 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.
 */
header('Content-type: application/json');
$status = 'error';
$message = 'unknown error';
$device_id = mres($_POST['device_id']);
$port_id_notes = mres($_POST['port_id_notes']);
$attrib_value = $_POST['notes'];
if (isset($attrib_value) && set_dev_attrib(array('device_id' => $device_id), $port_id_notes, $attrib_value)) {
    $status = 'ok';
    $message = 'Updated';
} else {
    $status = 'error';
    $message = 'ERROR: Could not update';
}
die(json_encode(array('status' => $status, 'message' => $message, 'attrib_type' => $port_id_notes, 'attrib_value' => $attrib_value, 'device_id' => $device_id)));
开发者ID:awlx,项目名称:librenms,代码行数:26,代码来源:update-port-notes.inc.php


示例5: foreach

foreach ($config['os_group'] as $os => $data) {
    foreach ($data['mibs'] as $mib) {
        if (in_array($mib, array_keys($mibs)) === FALSE) {
            $other_mibs[$mib]++;
        }
    }
}
// Sort alphabetically
ksort($other_mibs);
$attribs = get_dev_attribs($device['device_id']);
if ($_POST['toggle_mib'] && isset($mibs[$_POST['toggle_mib']])) {
    $mib = $_POST['toggle_mib'];
    if (isset($attribs['mib_' . $mib])) {
        del_dev_attrib($device, 'mib_' . $mib);
    } else {
        set_dev_attrib($device, 'mib_' . $mib, "0");
    }
    $attribs = get_dev_attribs($device['device_id']);
}
print_message("This page allows you to disable certain MIBs to be polled for a device. This configuration disables all discovery modules using this MIB.");
?>

<div class="row"> <!-- begin row -->

  <div class="col-md-6"> <!-- begin poller options -->

<fieldset>
  <legend>Device MIBs</legend>
</fieldset>

<table class="table table-bordered table-striped table-condensed table-rounded">
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:mibs.inc.php


示例6: print_r

    echo " ";
    // Delete removed toners
    if ($debug) {
        echo "\n Checking ... \n";
        print_r($valid_toner);
    }
    $sql = "SELECT * FROM toner WHERE device_id = '" . $device['device_id'] . "'";
    if ($query = mysql_query($sql)) {
        while ($test_toner = mysql_fetch_assoc($query)) {
            $toner_index = $test_toner['toner_index'];
            $toner_type = $test_toner['toner_type'];
            if (!$valid_toner[$toner_type][$toner_index]) {
                echo "-";
                mysql_query("DELETE FROM `toner` WHERE toner_id = '" . $test_toner['toner_id'] . "'");
                log_event("Toner removed: type " . mres($toner_type) . " index " . mres($toner_index) . " descr " . mres($test_toner['toner_descr']), $device, 'toner', $test_toner['toner_id']);
            }
        }
    }
    unset($valid_toner);
    // Discover other counters and monitored values
    $pagecounters = array("1.3.6.1.2.1.43.10.2.1.4.1.1");
    foreach ($pagecounters as $oid) {
        if (snmp_get($device, $oid, "-OUqnv")) {
            echo " Pagecounter";
            set_dev_attrib($device, "pagecount_oid", $oid);
            break;
        }
    }
    echo "\n";
}
# if ($config['enable_printers'])
开发者ID:RomanBogachev,项目名称:observium,代码行数:31,代码来源:toner.inc.php


示例7: foreach

 echo 'EDAC ';
 foreach (explode("\n", $agent_data['edac']) as $line) {
     list($mc, $data) = explode(': ', $line, 2);
     // mc0: 0 Uncorrected Errors with no DIMM info
     if (preg_match("/^(.*) Uncorrected Errors with no DIMM info\$/", $data, $matches)) {
         $edac[$mc]['row']['unknown']['all']['ue'] = $matches[1];
     } elseif (preg_match("/^(.*) Corrected Errors with no DIMM info\$/", $data, $matches)) {
         $edac[$mc]['row']['unknown']['all']['ce'] = $matches[1];
     } elseif (preg_match("/^csrow(.*): (.*) Uncorrected Errors\$/", $data, $matches)) {
         $edac[$mc]['row'][$matches[1]]['all']['ue'] = $matches[2];
     } elseif (preg_match("/^csrow(.*): (.*): (.*) Corrected Errors\$/", $data, $matches)) {
         $edac[$mc]['row'][$matches[1]][$matches[2]]['ce'] = $matches[3];
         $edac_name[$mc]['rowname'][$matches[1]][$matches[2]] = $matches[2];
     }
 }
 set_dev_attrib($device, 'edac_rownames', serialize($edac_name));
 $graphs['edac_errors'] = TRUE;
 foreach ($edac as $mc => $data) {
     foreach ($data['row'] as $row => $channels) {
         foreach ($channels as $channel => $errors) {
             foreach (array('ce', 'ue') as $errortype) {
                 if (isset($errors[$errortype])) {
                     $row_id = $row === 'unknown' ? 'unknown' : "csrow{$row}";
                     // Yes, ===, otherwise PHP thinks unknown means 0.
                     $rrd_filename = "edac-errors-{$mc}-{$row_id}-{$channel}-{$errortype}.rrd";
                     rrdtool_create($device, $rrd_filename, " \\\n                DS:errors:GAUGE:600:0:125000000000 ");
                     rrdtool_update($device, $rrd_filename, "N:" . $errors[$errortype]);
                 }
             }
         }
     }
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:edac.inc.php


示例8: header

 * 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.
*/
header('Content-type: application/json');
$status = 'error';
$descr = mres($_POST['descr']);
$device_id = mres($_POST['device_id']);
$ifName = mres($_POST['ifName']);
$port_id = mres($_POST['port_id']);
logfile($descr . ',' . $device_id . ',' . $ifName . ',' . $port_id);
if (!empty($ifName) && is_numeric($port_id)) {
    // We have ifName and  port id so update ifAlias
    if (empty($descr)) {
        $descr = 'repoll';
        // Set to repoll so we avoid using ifDescr on port poll
    }
    if (dbUpdate(array('ifAlias' => $descr), 'ports', '`port_id`=?', array($port_id)) > 0) {
        $device = device_by_id_cache($device_id);
        if ($descr === 'repoll') {
            del_dev_attrib($device, 'ifName:' . $ifName);
        } else {
            set_dev_attrib($device, 'ifName:' . $ifName, 1);
        }
        $status = 'ok';
    } else {
        $status = 'na';
    }
}
$response = array('status' => $status);
echo _json_encode($response);
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:update-ifalias.inc.php


示例9: rename_rrd

            }
            break;
        case 'wastetoner':
            $old_rrd = 'wastebox.rrd';
            rename_rrd($device, $old_rrd, $supply_rrd);
            break;
        case 'fuser':
            $old_rrd = 'fuser.rrd';
            rename_rrd($device, $old_rrd, $supply_rrd);
            break;
    }
    // END CLEANME
    echo $supplyperc . " %\n";
    rrdtool_update_ng($device, 'toner', array('level' => $supplyperc), $supply['supply_index']);
    if ($supplyperc > $supply['supply_value']) {
        log_event('Printer supply ' . $supply['supply_descr'] . ' (type ' . nicecase($supply['supply_type']) . ') was replaced (new level: ' . $supplyperc . '%)', $device, 'toner', $supply['supply_id']);
    }
    dbUpdate(array('supply_value' => $supplyperc, 'supply_capacity' => $supply['supply_capacity']), 'printersupplies', '`supply_id` = ?', array($supply['supply_id']));
    check_entity('printersupply', $supply, array('supply_value' => $supplyperc));
    $graphs['printersupplies'] = TRUE;
}
// Old stuff, to replace?
$oid = get_dev_attrib($device, 'pagecount_oid');
if ($oid) {
    echo "Checking page count... ";
    $pages = snmp_get($device, $oid, "-OUqnv");
    set_dev_attrib($device, "pagecounter", $pages);
    rrdtool_update_ng($device, 'pagecount', array('pagecount' => $pages));
    echo "{$pages}\n";
}
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:printersupplies.inc.php


示例10: snmp_get

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$version = snmp_get($device, 'productVersion.0', '-Ovq', 'GEIST-V4-MIB');
$hardware = 'Geist ' . snmp_get($device, 'productTitle.0', '-Ovq', 'GEIST-V4-MIB');
$ra_url_http = snmp_get($device, 'productUrl.0', '-Ovq', 'GEIST-V4-MIB');
// Can be either STRING or IpAddress, check for leading http://
if (substr($ra_url_http, 0, 7) != 'http://') {
    $ra_url_http = "http://{$ra_url_http}";
}
if ($ra_url_http != '') {
    set_dev_attrib($device, 'ra_url_http', $ra_url_http);
} else {
    del_dev_attrib($device, 'ra_url_http');
}
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:25,代码来源:geist-climate.inc.php


示例11: set_dev_attrib

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage poller
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
set_dev_attrib($device, 'poll_storage', 0);
echo " Storage WMI: ";
foreach ($wmi['disk']['logical'] as $disk) {
    echo ".";
    $storage_name = $disk['DeviceID'] . "\\\\ Label:" . $disk['VolumeName'] . "  Serial Number " . strtolower($disk['VolumeSerialNumber']);
    $storage_id = dbFetchCell("SELECT `storage_id` FROM `storage` WHERE `storage_descr`= ?", array($storage_name));
    $used = $disk['Size'] - $disk['FreeSpace'];
    $percent = round($used / $disk['Size'] * 100);
    rrdtool_update_ng($device, 'storage', array('used' => $used, 'free' => $disk['FreeSpace']), "host-resources-mib-" . $storage_name);
    dbUpdate(array('storage_polled' => time(), 'storage_used' => $used, 'storage_free' => $disk['FreeSpace'], 'storage_size' => $disk['Size'], 'storage_perc' => $percent), 'storage-state', '`storage_id` = ?', array($storage_id));
}
echo PHP_EOL;
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:25,代码来源:wmi.inc.php


示例12: snmpwalk_cache_multi_oid

// eqlMemberName.1.1664046123 = hostname-2
$eqlgrpmembers = snmpwalk_cache_multi_oid($device, 'eqlMemberName', array(), 'EQLMEMBER-MIB');
foreach ($eqlgrpmembers as $index => $entry) {
    // Find member id and name in results
    if (!empty($entry['eqlMemberName']) && strtolower($entry['eqlMemberName']) == $poll_device['sysName']) {
        list(, $eqlgrpmemid) = explode('.', $index);
        break;
    }
}
if (!isset($eqlgrpmemid)) {
    // Fall-back to old method.
    $eqlgrpmemid = snmp_get($device, 'eqliscsiLocalMemberId.0', '-OQv', 'EQLVOLUME-MIB');
}
if (is_numeric($eqlgrpmemid) && $eqlgrpmemid != $attribs['eqlgrpmemid']) {
    // Store member id when detected
    set_dev_attrib($device, 'eqlgrpmemid', $eqlgrpmemid);
    $attribs['eqlgrpmemid'] = $eqlgrpmemid;
    print_debug("\neqlgrpmemid: {$eqlgrpmemid}");
}
// EQLMEMBER-MIB::eqlMemberProductFamily.1.$eqlgrpmemid = STRING: PS6500
// EQLMEMBER-MIB::eqlMemberControllerMajorVersion.1.$eqlgrpmemid = Gauge32: 6
// EQLMEMBER-MIB::eqlMemberControllerMinorVersion.1.$eqlgrpmemid = Gauge32: 0
// EQLMEMBER-MIB::eqlMemberControllerMaintenanceVersion.1.$eqlgrpmemid = Gauge32: 2
// EQLMEMBER-MIB::eqlMemberSerialNumber.1.$eqlgrpmemid = STRING: XXXNNNNNNNXNNNN
// EQLMEMBER-MIB::eqlMemberServiceTag.1.$eqlgrpmemid = STRING: XXXXXXX
$hardware = 'Dell EqualLogic ' . trim(snmp_get($device, 'eqlMemberProductFamily.1.' . $eqlgrpmemid, '-OQv', 'EQLMEMBER-MIB'), '" ');
$serial = trim(snmp_get($device, 'eqlMemberSerialNumber.1.' . $eqlgrpmemid, '-OQv', 'EQLMEMBER-MIB'), '" ');
$serial .= ' [' . trim(snmp_get($device, 'eqlMemberServiceTag.1.' . $eqlgrpmemid, '-OQv', 'EQLMEMBER-MIB'), '" ') . ']';
$eqlmajor = snmp_get($device, 'eqlMemberControllerMajorVersion.1.' . $eqlgrpmemid, '-OQv', 'EQLMEMBER-MIB');
$eqlminor = snmp_get($device, 'eqlMemberControllerMinorVersion.1.' . $eqlgrpmemid, '-OQv', 'EQLMEMBER-MIB');
$eqlmaint = snmp_get($device, 'eqlMemberControllerMaintenanceVersion.1.' . $eqlgrpmemid, '-OQv', 'EQLMEMBER-MIB');
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:equallogic.inc.php


示例13: array

        $drums = array('Cyan' => 'c', 'Magenta' => 'm', 'Yellow' => 'y', 'Black' => 'k');
        foreach ($drums as $drum => $letter) {
            $oid = get_dev_attrib($device, 'imagingdrum_' . $letter . '_oid');
            if ($oid) {
                echo "Checking {$drum} Imaging Drum... ";
                $capacity = snmp_get($device, get_dev_attrib($device, 'imagingdrum_' . $letter . '_cap_oid'), '-OUqnv');
                $level = round(snmp_get($device, $oid, "-OUqnv") / $capacity * 100);
                $drumrrd = "drum-" . $letter . ".rrd";
                rrdtool_create($device, $drumrrd, " \\\n          DS:drum:GAUGE:600:0:100 ");
                set_dev_attrib($device, "drum-" . $letter, $level);
                rrdtool_update($device, $drumrrd, "N:{$level}");
                echo "{$level}%\n";
            }
        }
        $levels = array('Waste Toner Box' => 'wastebox', 'Fuser' => 'fuser', 'Transfer roller' => 'transferroller');
        foreach ($levels as $key => $value) {
            $oid = get_dev_attrib($device, $value . '_oid');
            if ($oid) {
                echo "Checking {$key}... ";
                $capacity = snmp_get($device, get_dev_attrib($device, $value . '_cap_oid'), '-OUqnv');
                $level = round(snmp_get($device, $oid, "-OUqnv") / $capacity * 100);
                $rrd = "{$value}.rrd";
                rrdtool_create($device, $rrd, " \\\n          DS:level:GAUGE:600:0:100 ");
                set_dev_attrib($device, $value, $level);
                rrdtool_update($device, $rrd, "N:{$level}");
                echo "{$level}%\n";
            }
        }
    }
}
// EOF
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:toner.inc.php


示例14: mres

 * 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.
*/
$status = 'error';
$descr = mres($_POST['descr']);
$device_id = mres($_POST['device_id']);
$ifName = mres($_POST['ifName']);
$port_id = mres($_POST['port_id']);
logfile($descr . ',' . $device_id . ',' . $ifName . ',' . $port_id);
if (!empty($ifName) && is_numeric($port_id)) {
    // We have ifName and  port id so update ifAlias
    if (empty($descr)) {
        $descr = 'repoll';
        // Set to repoll so we avoid using ifDescr on port poll
    }
    if (dbUpdate(array('ifAlias' => $descr), 'ports', '`port_id`=?', array($port_id)) > 0) {
        $device = device_by_id_cache($device_id);
        if ($descr === 'repoll') {
            del_dev_attrib($device, 'ifName');
        } else {
            set_dev_attrib($device, 'ifName', $ifName);
        }
        $status = 'ok';
    } else {
        $status = 'na';
    }
}
$response = array('status' => $status);
echo _json_encode($response);
开发者ID:n-st,项目名称:librenms,代码行数:31,代码来源:update-ifalias.inc.php


示例15: foreach

        # [usedPercentage] => 96
        # [freeBytes] => 673289601024
        # [freePercentage] => 4
        # [coldBytes] => 3762904182328
        # [coldPercentageOfUsed] => 23
        # [coldPercentageOfTotal] => 22
        # [archiveBytes] => 11678769817966
        # [selectedBytes] => 19313807393642
        # [remainingBytes] => 379281681813
        # [inboundBandwidth] => 53
        # [outboundBandwidth] => 67
        # [orgCount] => 1
        # [userCount] => 83
        # [computerCount] => 97
        # [onlineComputerCount] => 27
        # [backupSessionCount] => 0
        foreach ($crashplan_data['data']['servers'] as $crashplan_server) {
            $crashplan_servers[] = $crashplan_server['serverName'];
            $rrd_filename = "app-crashplan-" . $crashplan_server['serverName'] . ".rrd";
            unset($rrd_values);
            foreach (array('totalBytes', 'usedBytes', 'usedPercentage', 'freeBytes', 'freePercentage', 'coldBytes', 'coldPercentageOfUsed', 'coldPercentageOfTotal', 'archiveBytes', 'selectedBytes', 'remainingBytes', 'inboundBandwidth', 'outboundBandwidth', 'orgCount', 'userCount', 'computerCount', 'onlineComputerCount', 'backupSessionCount') as $key) {
                $rrd_values[] = is_numeric($crashplan_server[$key]) ? $crashplan_server[$key] : "U";
            }
            rrdtool_create($device, $rrd_filename, " \\\n          DS:totalBytes:GAUGE:600:0:125000000000 \\\n          DS:usedBytes:GAUGE:600:0:125000000000 \\\n          DS:usedPercentage:GAUGE:600:0:100 \\\n          DS:freeBytes:GAUGE:600:0:125000000000 \\\n          DS:freePercentage:GAUGE:600:0:100 \\\n          DS:coldBytes:GAUGE:600:0:125000000000 \\\n          DS:coldPctOfUsed:GAUGE:600:0:100 \\\n          DS:coldPctOfTotal:GAUGE:600:0:100 \\\n          DS:archiveBytes:GAUGE:600:0:125000000000 \\\n          DS:selectedBytes:GAUGE:600:0:125000000000 \\\n          DS:remainingBytes:GAUGE:600:0:125000000000 \\\n          DS:inboundBandwidth:GAUGE:600:0:125000000000 \\\n          DS:outboundBandwidth:GAUGE:600:0:125000000000 \\\n          DS:orgCount:GAUGE:600:0:125000000000 \\\n          DS:userCount:GAUGE:600:0:125000000000 \\\n          DS:computerCount:GAUGE:600:0:125000000000 \\\n          DS:onlineComputerCount:GAUGE:600:0:125000000000 \\\n          DS:backupSessionCount:GAUGE:600:0:125000000000 ");
            rrdtool_update($device, $rrd_filename, "N:" . implode(':', $rrd_values));
        }
        # Set list of servers as device attribute so we can use it in the web interface
        set_dev_attrib($device, 'crashplan_servers', json_encode($crashplan_servers));
    }
}
// EOF
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:crashplan.inc.php


示例16: del_dev_attrib

        del_dev_attrib($device, 'poll_' . $module);
    } elseif ($config['poller_modules'][$_POST['toggle_poller']] == 0) {
        set_dev_attrib($device, 'poll_' . $module, "1");
    } else {
        set_dev_attrib($device, 'poll_' . $module, "0");
    }
    $attribs = get_dev_attribs($device['device_id']);
}
if ($_POST['toggle_discovery'] && isset($config['discovery_modules'][$_POST['toggle_discovery']])) {
    $module = mres($_POST['toggle_discovery']);
    if (isset($attribs['discover_' . $module]) && $attribs['discover_' . $module] != $config['discovery_modules'][$_POST['toggle_discovery']]) {
        del_dev_attrib($device, 'discover_' . $module);
    } elseif ($config['discovery_modules'][$_POST['toggle_discovery']] == 0) {
        set_dev_attrib($device, 'discover_' . $module, "1");
    } else {
        set_dev_attrib($device, 'discover_' . $module, "0");
    }
    $attribs = get_dev_attribs($device['device_id']);
}
?>

<div class="row-fluid">
    <div class="row-fluid">
      <div class="span6">

<fieldset>
  <legend>Poller Modules</legend>
</fieldset>

<table class="table table-bordered table-striped table-condensed table-rounded">
  <thead>
开发者ID:RomanBogachev,项目名称:observium,代码行数:31,代码来源:modules.inc.php


示例17: array

if (!empty($ifName) && is_numeric($port_id) && is_numeric($port_id)) {
    // We have ifName and  port id so update ifAlias
    if (empty($speed)) {
        $speed = array('NULL');
        $high_speed = array('NULL');
        // Set to 999999 so we avoid using ifDescr on port poll
    } else {
        $high_speed = $speed / 1000000;
    }
    if (dbUpdate(array('ifSpeed' => $speed, 'ifHighSpeed' => $high_speed), 'ports', '`port_id`=?', array($port_id)) > 0) {
        $device = device_by_id_cache($device_id);
        if (is_array($speed)) {
            del_dev_attrib($device, 'ifSpeed:' . $ifName);
            log_event("{$ifName} Port speed cleared manually", $device, 'interface', $port_id);
        } else {
            set_dev_attrib($device, 'ifSpeed:' . $ifName, 1);
            log_event("{$ifName} Port speed set manually: {$speed}", $device, 'interface', $port_id);
            $port_tune = get_dev_attrib($device, 'ifName_tune:' . $ifName);
            $device_tune = get_dev_attrib($device, 'override_rrdtool_tune');
            if ($port_tune == "true" || $device_tune == "true" && $port_tune != 'false' || $config['rrdtool_tune'] == "true" && $port_tune != 'false' && $device_tune != 'false') {
                $rrdfile = get_port_rrdfile_path($device['hostname'], $port_id);
                rrdtool_tune('port', $rrdfile, $speed);
            }
        }
        $status = 'ok';
    } else {
        $status = 'na';
    }
}
$response = array('status' => $status);
echo _json_encode($response);
开发者ID:pblasquez,项目名称:librenms,代码行数:31,代码来源:update-ifspeed.inc.php


示例18: set_dev_attrib

 } else {
     $override_sysContact_bool = $vars['override_sysContact'];
     if (isset($vars['sysContact'])) {
         $override_sysContact_string = $vars['sysContact'];
     }
     $disable_notify = $vars['disable_notify'];
     if ($override_sysContact_bool) {
         set_dev_attrib($device, 'override_sysContact_bool', '1');
     } else {
         del_dev_attrib($device, 'override_sysContact_bool');
     }
     if (isset($override_sysContact_string)) {
         set_dev_attrib($device, 'override_sysContact_string', $override_sysContact_string);
     }
     if ($disable_notify) {
         set_dev_attrib($device, 'disable_notify', '1');
     } else {
         del_dev_attrib($device, 'disable_notify');
     }
     // 2019-12-05 23:30:00
     if (isset($vars['ignore_until']) && $vars['ignore_until_enable']) {
         $update['ignore_until'] = $vars['ignore_until'];
         $device['ignore_until'] = $vars['ignore_until'];
     } else {
         $update['ignore_until'] = array('NULL');
         $device['ignore_until'] = '';
     }
     dbUpdate($update, 'devices', '`device_id` = ?', array($device['device_id']));
     $update_message = "Device alert settings updated.";
     $updated = 1;
 }
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:alerts.inc.php


示例19: set_dev_attrib

        }
        if (!empty($wmi_password)) {
            set_dev_attrib($device, 'wmi_password', $wmi_password);
        } else {
            del_dev_attrib($device, 'wmi_password');
        }
        $update_message = "Device WMI data updated.";
        $updated = 1;
        if ($vars['toggle_poller'] && isset($GLOBALS['config']['wmi']['modules'][$vars['toggle_poller']])) {
            $module = $vars['toggle_poller'];
            if (isset($attribs['wmi_poll_' . $module]) && $attribs['wmi_poll_' . $module] != $GLOBALS['config']['wmi']['modules'][$vars['toggle_poller']]) {
                del_dev_attrib($device, 'wmi_poll_' . $module);
            } elseif ($GLOBALS['config']['wmi']['modules'][$vars['toggle_poller']] == 0) {
                set_dev_attrib($device, 'wmi_poll_' . $module, "1");
            } else {
                set_dev_attrib($device, 'wmi_poll_' . $module, "0");
            }
            $attribs = get_dev_attribs($device['device_id']);
        }
    }
}
?>

<script type="text/javascript">
  $(document).ready(function() {
    toggleDisable();
    $("#wmi_override").change(function() {
      toggleDisable();
    });
  });
开发者ID:Natolumin,项目名称:observium,代码行数:30,代码来源:wmi.inc.php


示例20: die

<?php

if (is_admin() === false) {
    die('ERROR: You need to be admin');
}
// FUA
$device['device_id'] = $_POST['device_id'];
$module = 'poll_' . $_POST['poller_module'];
if (!isset($module) && validate_device_id($device['device_id']) === false) {
    echo 'error with data';
    exit;
} else {
    if ($_POST['state'] == 'true') {
        $state = 1;
    } else {
        if ($_POST['state'] == 'false') {
            $state = 0;
        } else {
            $state = 0;
        }
    }
    if (isset($attribs['poll_' . $module]) && $attribs['poll_' . $module] != $config['poller_modules'][$module]) {
        del_dev_attrib($device, $module);
    } else {
        set_dev_attrib($device, $module, $state);
    }
}
开发者ID:samyscoub,项目名称:librenms,代码行数:27,代码来源:poller-module-update.inc.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP set_dynamic_cache函数代码示例发布时间:2022-05-15
下一篇:
PHP set_dependencies函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap