本文整理汇总了PHP中del_dev_attrib函数的典型用法代码示例。如果您正苦于以下问题:PHP del_dev_attrib函数的具体用法?PHP del_dev_attrib怎么用?PHP del_dev_attrib使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了del_dev_attrib函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_dev_attrib
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;
}
if ($updated && $update_message) {
print_message($update_message);
示例2: foreach
}
// Fetch all MIBs we support for specific OS groups
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>
示例3: mres
if ($_POST['toggle_poller'] && isset($config['poller_modules'][$_POST['toggle_poller']])) {
$module = mres($_POST['toggle_poller']);
if (isset($attribs['poll_' . $module]) && $attribs['poll_' . $module] != $config['poller_modules'][$_POST['toggle_poller']]) {
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>
示例4: 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);
示例5: strtolower
// Known types
$update_array['type'] = strtolower($entry['prtMarkerSuppliesType']);
break;
default:
print_debug("Could not handle resource type " . $entry['prtMarkerSuppliesType']);
continue 2;
}
discover_printersupply($valid['printersupplies'], $device, $update_array);
}
// CLEANME remove after r8500 but not before CE 2016/10
del_dev_attrib($device, 'pagecounter_oid');
del_dev_attrib($device, 'transferroller_oid');
del_dev_attrib($device, 'fuser_oid');
del_dev_attrib($device, 'imagingdrum_oid');
del_dev_attrib($device, 'imagingdrum_c_oid');
del_dev_attrib($device, 'imagingdrum_m_oid');
del_dev_attrib($device, 'imagingdrum_y_oid');
del_dev_attrib($device, 'imagingdrum_k_oid');
del_dev_attrib($device, 'wastebox_oid');
del_dev_attrib($device, 'imagingdrum_c_cap_oid');
del_dev_attrib($device, 'imagingdrum_m_cap_oid');
del_dev_attrib($device, 'imagingdrum_y_cap_oid');
del_dev_attrib($device, 'imagingdrum_k_cap_oid');
del_dev_attrib($device, 'imagingdrum_cap_oid');
del_dev_attrib($device, 'transferroller_cap_oid');
del_dev_attrib($device, 'fuser_cap_oid');
del_dev_attrib($device, 'pagecount_oid');
// Pagecounter moved to Counter Sensors
// END CLEANME
echo PHP_EOL;
// EOF
示例6: 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);
示例7: array
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk>
*
* 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.
*/
if (is_admin() === false) {
$response = array('status' => 'error', 'message' => 'Need to be admin');
echo _json_encode($response);
exit;
}
$device['device_id'] = mres($_POST['device_id']);
$attrib = mres($_POST['attrib']);
$state = mres($_POST['state']);
$status = 'error';
$message = 'Error with config';
if (empty($device['device_id'])) {
$message = 'No device passed';
} else {
if ($state == true) {
set_dev_attrib($device, $attrib, $state);
} else {
del_dev_attrib($device, $attrib);
}
$status = 'ok';
$message = 'Config has been updated';
}
$response = array('status' => $status, 'message' => $message);
echo _json_encode($response);
示例8: array
}
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.';
}
$updated = -1;
} else {
$update_message = 'Device record update error.';
示例9: mres
$device_id = mres($_POST['device_id']);
$ifName = mres($_POST['ifName']);
$port_id = mres($_POST['port_id']);
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';
}
示例10: set_dev_attrib
if (!empty($wmi_username)) {
set_dev_attrib($device, 'wmi_username', $wmi_username);
} else {
del_dev_attrib($device, 'wmi_username');
}
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() {
示例11: elseif
$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]);
}
}
}
}
}
} else {
// No more EDAC app; remove row names from DB
del_dev_attrib($device, 'edac_rownames');
}
unset($edac, $edac_name);
// EOF
示例12: 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
示例13: dbUpdate
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';
}
} else {
$update_message = 'Device record unchanged. No update necessary.';
示例14: 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);
}
}
示例15: set_dev_attrib
if (is_numeric($vars['ipmi_port'])) {
set_dev_attrib($device, 'ipmi_port', $vars['ipmi_port']);
} else {
del_dev_attrib($device, 'ipmi_port');
}
// We check interface & userlevel input from the dropdown against the allowed values in the definition array.
if ($vars['ipmi_interface'] != '' && array_search($vars['ipmi_interface'], array_keys($config['ipmi']['interfaces'])) !== FALSE) {
set_dev_attrib($device, 'ipmi_interface', $vars['ipmi_interface']);
} else {
del_dev_attrib($device, 'ipmi_interface');
print_error('Invalid interface specified (' . $vars['ipmi_interface'] . ').');
}
if ($vars['ipmi_userlevel'] != '' && array_search($vars['ipmi_userlevel'], array_keys($config['ipmi']['userlevels'])) !== FALSE) {
set_dev_attrib($device, 'ipmi_userlevel', $vars['ipmi_userlevel']);
} else {
del_dev_attrib($device, 'ipmi_userlevel');
print_error('Invalid user level specified (' . $vars['ipmi_userlevel'] . ').');
}
$update_message = "Device IPMI data updated.";
$updated = 1;
} else {
include "includes/error-no-perm.inc.php";
}
}
if ($updated && $update_message) {
print_message($update_message);
} elseif ($update_message) {
print_error($update_message);
}
?>