本文整理汇总了PHP中get_dev_attrib函数的典型用法代码示例。如果您正苦于以下问题:PHP get_dev_attrib函数的具体用法?PHP get_dev_attrib怎么用?PHP get_dev_attrib使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_dev_attrib函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: d_echo
}
// Set VLAN and Trunk from Q-BRIDGE-MIB
if (!isset($this_port['ifVlan']) && isset($this_port['dot1qPvid'])) {
$this_port['ifVlan'] = $this_port['dot1qPvid'];
}
// FIXME use $q_bridge_mib[$this_port['ifIndex']] to see if it is a trunk (>1 array count)
echo 'VLAN == ' . $this_port['ifVlan'];
// When devices do not provide ifAlias data, populate with ifDescr data if configured
if ($this_port['ifAlias'] == '' || $this_port['ifAlias'] == NULL || $config['os'][$device['os']]['descr_to_alias'] == 1) {
$this_port['ifAlias'] = $this_port['ifDescr'];
d_echo('Using ifDescr as ifAlias');
}
// Update IF-MIB data
foreach ($data_oids as $oid) {
if ($oid == 'ifAlias') {
if (get_dev_attrib($device, 'ifName:' . $port['ifName'], 1)) {
$this_port['ifAlias'] = $port['ifAlias'];
}
}
if ($port[$oid] != $this_port[$oid] && !isset($this_port[$oid])) {
$port['update'][$oid] = array('NULL');
log_event($oid . ': ' . $port[$oid] . ' -> NULL', $device, 'interface', $port['port_id']);
if ($debug) {
d_echo($oid . ': ' . $port[$oid] . ' -> NULL ');
} else {
echo $oid . ' ';
}
} else {
if ($port[$oid] != $this_port[$oid]) {
$port['update'][$oid] = $this_port[$oid];
log_event($oid . ': ' . $port[$oid] . ' -> ' . $this_port[$oid], $device, 'interface', $port['port_id']);
开发者ID:rkojedzinszky,项目名称:librenms,代码行数:31,代码来源:ports.inc.php
示例2: dbFetchRow
$updated = 0;
}
}
//end if
}
//end if
$device = dbFetchRow('SELECT * FROM `devices` WHERE `device_id` = ?', array($device['device_id']));
$descr = $device['purpose'];
if ($updated && $update_message) {
print_message($update_message);
} else {
if ($update_message) {
print_error($update_message);
}
}
$max_repeaters = get_dev_attrib($device, 'snmp_max_repeaters');
echo "\n <form id='edit' name='edit' method='post' action='' role='form' class='form-horizontal'>\n <input type=hidden name='editing' value='yes'>\n <div class='form-group'>\n <label for='snmpver' class='col-sm-2 control-label'>SNMP Details</label>\n <div class='col-sm-1'>\n <select id='snmpver' name='snmpver' class='form-control input-sm' onChange='changeForm();'>\n <option value='v1'>v1</option>\n <option value='v2c' " . ($device['snmpver'] == 'v2c' ? 'selected' : '') . ">v2c</option>\n <option value='v3' " . ($device['snmpver'] == 'v3' ? 'selected' : '') . ">v3</option>\n </select>\n </div>\n <div class='col-sm-2'>\n <input type='text' name='port' placeholder='port' class='form-control input-sm' value='" . ($device['port'] == $config['snmp']['port'] ? "" : $device['port']) . "'>\n </div>\n <div class='col-sm-1'>\n <select name='transport' id='transport' class='form-control input-sm'>";
foreach ($config['snmp']['transports'] as $transport) {
echo "<option value='" . $transport . "'";
if ($transport == $device['transport']) {
echo " selected='selected'";
}
echo '>' . $transport . '</option>';
}
echo " </select>\n </div>\n </div>\n <div class='form-group'>\n <div class='col-sm-2'>\n </div>\n <div class='col-sm-1'>\n <input id='timeout' name='timeout' class='form-control input-sm' value='" . ($device['timeout'] ? $device['timeout'] : '') . "' placeholder='seconds' />\n </div>\n <div class='col-sm-1'>\n <input id='retries' name='retries' class='form-control input-sm' value='" . ($device['timeout'] ? $device['retries'] : '') . "' placeholder='retries' />\n </div>\n </div>\n <div class='form-group'>\n <label for='port_assoc_mode' class='col-sm-2 control-label'>Port Association Mode</label>\n <div class='col-sm-1'>\n <select name='port_assoc_mode' id='port_assoc_mode' class='form-control input-sm'>\n";
foreach (get_port_assoc_modes() as $pam) {
$pam_id = get_port_assoc_mode_id($pam);
echo " <option value='{$pam_id}'";
if ($pam_id == $device['port_association_mode']) {
echo " selected='selected'";
}
开发者ID:pblasquez,项目名称:librenms,代码行数:31,代码来源:snmp.inc.php
示例3: dynamic_override_config
function dynamic_override_config($type, $name, $device)
{
$attrib_val = get_dev_attrib($device, $name);
if ($attrib_val == 'true') {
$checked = 'checked';
} else {
$checked = '';
}
if ($type == 'checkbox') {
return '<input type="checkbox" id="override_config" name="override_config" data-attrib="' . $name . '" data-device_id="' . $device['device_id'] . '" data-size="small" ' . $checked . '>';
}
}
开发者ID:RobsanInc,项目名称:librenms,代码行数:12,代码来源:functions.inc.php
示例4: is_mib_poller_enabled
function is_mib_poller_enabled($device)
{
$val = get_dev_attrib($device, 'poll_mib');
if ($val == null) {
return is_module_enabled('poller', 'mib');
}
return $val;
}
开发者ID:greggcz,项目名称:librenms,代码行数:8,代码来源:common.php
示例5: get_dev_attrib
<?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.
*/
$pagetitle[] = 'Notes';
$port_id_notes = 'port_id_notes:' . $port['port_id'];
$device_id = $device['device_id'];
$data = get_dev_attrib($device, $port_id_notes);
?>
<form class="form-horizontal" action="" method="post">
<h3>Port Notes</h3>
<hr>
<div class="form-group">
<div class="col-sm-10">
<textarea class="form-control" rows="6" name="notes" id="port-notes"><?php
echo htmlentities($data);
?>
</textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
开发者ID:awlx,项目名称:librenms,代码行数:31,代码来源:notes.inc.php
示例6: notify
function notify($device, $title, $message)
{
global $config;
if ($config['alerts']['email']['enable']) {
if (!get_dev_attrib($device, 'disable_notify')) {
if ($config['alerts']['email']['default_only']) {
$email = $config['alerts']['email']['default'];
} else {
if (get_dev_attrib($device, 'override_sysContact_bool')) {
$email = get_dev_attrib($device, 'override_sysContact_string');
} elseif ($device['sysContact']) {
$email = $device['sysContact'];
} else {
$email = $config['alerts']['email']['default'];
}
}
$emails = parse_email($email);
if ($emails) {
$message_header = $config['page_title_prefix'] . "\n\n";
// FIXME: use different config element
$message_footer = "\n\nE-mail sent to: ";
$i = 0;
$count = count($emails);
foreach ($emails as $email => $email_name) {
$i++;
$message_footer .= $email;
if ($i < $count) {
$message_footer .= ", ";
} else {
$message_footer .= "\n";
}
}
$message_footer .= "E-mail sent at: " . date($config['timestamp_format']) . "\n";
if (($err = send_mail($emails, $title, $message_header . $message . $message_footer)) !== true) {
echo "Mailer Error: " . $err . "\n";
}
}
}
}
}
开发者ID:rasssta,项目名称:librenms,代码行数:40,代码来源:functions.php
示例7: str_replace
$poll_device['sysContact'] = str_replace("\"", "", $poll_device['sysContact']);
// Remove leading & trailing backslashes added by VyOS/Vyatta/EdgeOS
$poll_device['sysContact'] = trim($poll_device['sysContact'], "\\");
if ($poll_device['sysLocation'] == "not set") {
$poll_device['sysLocation'] = "";
}
if ($poll_device['sysContact'] == "not set") {
$poll_device['sysContact'] = "";
}
if ($poll_device['sysContact'] && $poll_device['sysContact'] != $device['sysContact']) {
$update_array['sysContact'] = $poll_device['sysContact'];
log_event("Contact -> " . $poll_device['sysContact'], $device, 'system');
}
if ($poll_device['sysObjectID'] && $poll_device['sysObjectID'] != $device['sysObjectID']) {
$update_array['sysObjectID'] = $poll_device['sysObjectID'];
log_event("ObjectID -> " . $poll_device['sysObjectID'], $device, 'system');
}
if ($poll_device['sysName'] && $poll_device['sysName'] != $device['sysName']) {
$update_array['sysName'] = $poll_device['sysName'];
log_event("sysName -> " . $poll_device['sysName'], $device, 'system');
}
if ($poll_device['sysDescr'] && $poll_device['sysDescr'] != $device['sysDescr']) {
$update_array['sysDescr'] = $poll_device['sysDescr'];
log_event("sysDescr -> " . $poll_device['sysDescr'], $device, 'system');
}
if ($poll_device['sysLocation'] && $device['location'] != $poll_device['sysLocation']) {
if (!get_dev_attrib($device, 'override_sysLocation_bool')) {
$update_array['location'] = $poll_device['sysLocation'];
log_event("Location -> " . $poll_device['sysLocation'], $device, 'system');
}
}
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:system.inc.php
示例8: unserialize
*
* This file is part of Observium.
*
* @package observium
* @subpackage graphs
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
include_once $config['html_dir'] . "/includes/graphs/common.inc.php";
$scale_min = 0;
$colours = "mixed";
$unit_text = "Errors";
$nototal = 1;
$i = 0;
$colourset = "mixed";
$rownames = unserialize(get_dev_attrib($device, 'edac_rownames'));
foreach ($rownames as $mc => $data) {
$data['rowname']['unknown']['unknown'] = 'unknown';
// Add 'unknown' line to every memory controller; we don't have unknown-unknown but unknown-all is added below
foreach ($data['rowname'] as $row => $channels) {
array_unshift($channels, 'all');
// Add 'all' to front of array
foreach ($channels as $channel) {
foreach (array('ue', 'ce') as $errortype) {
switch ((string) $row) {
case 'unknown':
case 'all':
$row_id = $row;
break;
default:
$row_id = "csrow{$row}";
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:edac_errors.inc.php
示例9: foreach
}
echo ">" . $descr['text'] . "</option>";
}
?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="ipmi_interface">IPMI Interface</label>
<div class="controls">
<select class="selectpicker" name="ipmi_interface">
<?php
foreach ($config['ipmi']['interfaces'] as $type => $descr) {
echo "<option value='" . $type . "'";
if ($type == get_dev_attrib($device, 'ipmi_interface')) {
echo " selected='selected'";
}
echo ">" . $descr['text'] . "</option>";
}
?>
</select>
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary" name="submit" value="save"><i class="icon-ok icon-white"></i> Save Changes</button>
<span class="help-inline">To disable IPMI polling, please clear the setting fields and click <strong>Save Changes</strong>.</span>
</div>
</fieldset>
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:ipmi.inc.php
示例10: print_message
if ($updated && $update_message) {
print_message($update_message);
} else {
if ($update_message) {
print_error($update_message);
}
}
}
if (!file_exists($config['ipmitool'])) {
print_warning("The ipmitool binary was not found at the configured path (" . $config['ipmitool'] . "). IPMI polling will not work.");
}
$ipmi_userlevels = array();
foreach ($config['ipmi']['userlevels'] as $type => $descr) {
$ipmi_userlevels[$type] = array('name' => $descr['text']);
}
$ipmi_interfaces = array();
foreach ($config['ipmi']['interfaces'] as $type => $descr) {
$ipmi_interfaces[$type] = array('name' => $descr['text']);
}
$form = array('type' => 'horizontal', 'id' => 'edit', 'title' => 'IPMI Settings', 'fieldset' => array('edit' => ''));
$form['row'][0]['editing'] = array('type' => 'hidden', 'value' => 'yes');
$form['row'][1]['ipmi_hostname'] = array('type' => 'text', 'name' => 'IPMI Hostname', 'width' => '250px', 'readonly' => $readonly, 'value' => escape_html(get_dev_attrib($device, 'ipmi_hostname')));
$form['row'][2]['ipmi_port'] = array('type' => 'text', 'name' => 'IPMI Port', 'width' => '250px', 'readonly' => $readonly, 'value' => escape_html(get_dev_attrib($device, 'ipmi_port')));
$form['row'][3]['ipmi_username'] = array('type' => 'text', 'name' => 'IPMI Username', 'width' => '250px', 'readonly' => $readonly, 'value' => escape_html(get_dev_attrib($device, 'ipmi_username')));
$form['row'][4]['ipmi_password'] = array('type' => 'password', 'name' => 'IPMI Password', 'width' => '250px', 'readonly' => $readonly, 'show_password' => !$readonly, 'value' => escape_html(get_dev_attrib($device, 'ipmi_password')));
$form['row'][5]['ipmi_userlevel'] = array('type' => 'select', 'name' => 'IPMI Userlevel', 'width' => '250px', 'readonly' => $readonly, 'values' => $ipmi_userlevels, 'value' => escape_html(get_dev_attrib($device, 'ipmi_userlevel')));
$form['row'][6]['ipmi_interface'] = array('type' => 'select', 'name' => 'IPMI Interface', 'width' => '250px', 'readonly' => $readonly, 'values' => $ipmi_interfaces, 'value' => escape_html(get_dev_attrib($device, 'ipmi_interface')));
$form['row'][7]['submit'] = array('type' => 'submit', 'name' => 'Save Changes', 'icon' => 'icon-ok icon-white', 'class' => 'btn-primary', 'readonly' => $readonly, 'value' => 'save');
print_form($form);
unset($form);
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:ipmi.inc.php
示例11: get_dev_attrib
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage discovery
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
// Note, device attrib 'eqlgrpmemid' sets in equallogic 'os' module.
$eqlgrpmemid = get_dev_attrib($device, 'eqlgrpmemid');
if (is_numeric($eqlgrpmemid)) {
$oids = snmpwalk_cache_oid($device, 'eqlMemberHealthDetailsFanTable', array(), 'EQLMEMBER-MIB');
// copy of eqlMemberHealthDetailsFanIndex
$sensorname = array('emm0fan0', 'emm0fan1', 'emm1fan0', 'emm1fan1', 'emm2fan0', 'emm2fan1', 'emm3fan0', 'emm3fan1');
$sensorid = array(1, 2, 3, 4, 5, 6, 7, 8);
foreach ($oids as $index => $entry) {
# EQLMEMBER-MIB returns sensors for all members. only process sensors that match our member id
if (strstr($index, $eqlgrpmemid)) {
$numindex = str_replace($sensorname, $sensorid, $index);
$entry['oid'] = ".1.3.6.1.4.1.12740.2.1.7.1.3.{$numindex}";
$limits = array('limit_high' => $entry['eqlMemberHealthDetailsFanHighCriticalThreshold'], 'limit_low' => $entry['eqlMemberHealthDetailsFanLowCriticalThreshold'], 'limit_high_warn' => $entry['eqlMemberHealthDetailsFanHighWarningThreshold'], 'limit_low_warn' => $entry['eqlMemberHealthDetailsFanLowWarningThreshold']);
if ($entry['eqlMemberHealthDetailsFanValue'] != 0) {
discover_sensor($valid['sensor'], 'fanspeed', $device, $entry['oid'], $numindex, 'equallogic', $entry['eqlMemberHealthDetailsFanName'], 1, $entry['eqlMemberHealthDetailsFanValue'], $limits);
}
}
}
$oids = snmpwalk_cache_oid($device, 'eqlMemberHealthDetailsTemperatureTable', array(), 'EQLMEMBER-MIB');
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:eqlmember-mib.inc.php
示例12: escape_html
<div class="control-group">
<label class="control-label" for="wmi_username">WMI Username</label>
<div class="controls">
<input name="wmi_username" type="text" size="32" value="<?php
echo escape_html(get_dev_attrib($device, 'wmi_username'));
?>
" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="wmi_password">WMI Password</label>
<div class="controls">
<input name="wmi_password" type="password" size="32" value="<?php
echo escape_html(get_dev_attrib($device, 'wmi_password'));
// FIXME. For passwords we should use filter instead escape!
?>
" />
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary" name="submit" value="save"><i class="icon-ok icon-white"></i> Save Changes</button>
</div>
</fieldset>
</form>
</div>
</div>
</div>
<div class="col-md-6">
开发者ID:Natolumin,项目名称:observium,代码行数:30,代码来源:wmi.inc.php
示例13: foreach
}
} else {
echo '<div class="panel panel-default panel-condensed">
<div class="table-responsive">
<table class="table table-condensed">';
if ($subformat == "detail" || $subformat == "basic") {
echo '<tr>
<th></th>
<th></th>
<th>Device</th>
<th></th>
<th>Platform</th>
<th>Operating System</th>
<th>Uptime/Location</th>
</tr>';
}
foreach (dbFetchRows($query, $sql_param) as $device) {
if (device_permitted($device['device_id'])) {
if (!$location_filter || (get_dev_attrib($device, 'override_sysLocation_bool') && get_dev_attrib($device, 'override_sysLocation_string') == $location_filter || $device['location'] == $location_filter)) {
if ($subformat == "detail") {
include "includes/hostbox.inc.php";
} else {
include "includes/hostbox-basic.inc.php";
}
}
}
}
echo "</table>";
echo '</div>';
echo '</div>';
}
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:31,代码来源:devices.inc.php
示例14: get_dev_attrib
*
* @package observium
* @subpackage poller
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
global $debug, $ipmi_sensors;
include_once "includes/polling/functions.inc.php";
/// 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";
echo "IPMI: ";
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');
if (!is_numeric($ipmi['port'])) {
$ipmi['port'] = 623;
}
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 USER -U " . escapeshellarg($ipmi['user']) . " -P " . escapeshellarg($ipmi['password']);
}
$ipmi_start = utime();
$results = external_exec($config['ipmitool'] . $remote . " sensor 2>/dev/null");
$ipmi_end = utime();
$ipmi_time = round(($ipmi_end - $ipmi_start) * 1000);
echo '(' . $ipmi_time . 'ms) ';
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:ipmi.inc.php
示例15: array
if (!isset($sort) || empty($sort)) {
$sort = '`ifIndex` ASC';
}
$sql .= " ORDER BY {$sort}";
if (isset($current)) {
$limit_low = $current * $rowCount - $rowCount;
$limit_high = $rowCount;
}
if ($rowCount != -1) {
$sql .= " LIMIT {$limit_low},{$limit_high}";
}
$sql = "SELECT * {$sql}";
$response[] = array('ifIndex' => "<button id='save-form' type='submit' value='Save' class='btn btn-success btn-sm' title='Save current port disable/ignore settings'>Save</button><button type='submit' value='Reset' class='btn btn-danger btn-sm' id='form-reset' title='Reset form to previously-saved settings'>Reset</button>", 'label' => '', 'ifAdminStatus' => '', 'ifOperStatus' => "<button type='submit' value='Alerted' class='btn btn-default btn-sm' id='alerted-toggle' title='Toggle alerting on all currently-alerted ports'>Alerted</button><button type='submit' value='Down' class='btn btn-default btn-sm' id='down-select' title='Disable alerting on all currently-down ports'>Down</button>", 'disabled' => "<button type='submit' value='Toggle' class='btn btn-default btn-sm' id='disable-toggle' title='Toggle polling for all ports'>Toggle</button><button type='submit' value='Select' class='btn btn-default btn-sm' id='disable-select' title='Disable polling on all ports'>Select All</button>", 'ignore' => "<button type='submit' value='Toggle' class='btn btn-default btn-sm' id='ignore-toggle' title='Toggle alerting for all ports'>Toggle</button><button type='submit' value='Select' class='btn btn-default btn-sm' id='ignore-select' title='Disable alerting on all ports'>Select All</button>", 'ifAlias' => '');
foreach (dbFetchRows($sql, $param) as $port) {
$port = ifLabel($port);
// Mark interfaces which are OperDown (but not AdminDown) yet not ignored or disabled, or up yet ignored or disabled
// - as to draw the attention to a possible problem.
$isportbad = $port['ifOperStatus'] == 'down' && $port['ifAdminStatus'] != 'down' ? 1 : 0;
$dowecare = $port['ignore'] == 0 && $port['disabled'] == 0 ? $isportbad : !$isportbad;
$outofsync = $dowecare ? " class='red'" : '';
$checked = '';
if (get_dev_attrib($device_id, 'ifName_tune:' . $port['ifName']) == "true") {
$checked = 'checked';
}
$response[] = array('ifIndex' => $port['ifIndex'], 'ifName' => $port['label'], 'ifAdminStatus' => $port['ifAdminStatus'], 'ifOperStatus' => '<span name="operstatus_' . $port['port_id'] . '"' . $outofsync . '>' . $port['ifOperStatus'] . '</span>', 'disabled' => '<input type="checkbox" class="disable-check" name="disabled_' . $port['port_id'] . '"' . ($port['disabled'] ? 'checked' : '') . '>
<input type="hidden" name="olddis_' . $port['port_id'] . '" value="' . ($port['disabled'] ? 1 : 0) . '"">', 'ignore' => '<input type="checkbox" class="ignore-check" name="ignore_' . $port['port_id'] . '"' . ($port['ignore'] ? 'checked' : '') . '>
<input type="hidden" name="oldign_' . $port['port_id'] . '" value="' . ($port['ignore'] ? 1 : 0) . '"">', 'port_tune' => '<input type="checkbox" id="override_config" name="override_config" data-attrib="ifName_tune:' . $port['ifName'] . '" data-device_id="' . $port['device_id'] . '" data-size="small" ' . $checked . '>', 'ifAlias' => '<div class="form-group"><input class="form-control input-sm" id="if-alias" name="if-alias" data-device_id="' . $port['device_id'] . '" data-port_id="' . $port['port_id'] . '" data-ifName="' . $port['ifName'] . '" value="' . $port['ifAlias'] . '"><span class="glyphicon form-control-feedback" aria-hidden="true"></span></div>');
}
//end foreach
$output = array('current' => $current, 'rowCount' => $rowCount, 'rows' => $response, 'total' => $total);
echo _json_encode($output);
开发者ID:jcbailey2,项目名称:librenms,代码行数:31,代码来源:edit-ports.inc.php
示例16: elseif
// severity 5, for logging user info
} elseif ($update_message) {
print_error($update_message);
}
?>
<form id="edit" name="edit" method="post" class="form-horizontal" action="">
<input type=hidden name="editing" value="yes">
<div id="agent">
<fieldset>
<legend>代理连接</legend>
<div class="control-group">
<label class="control-label" for="agent_port">代理端口</label>
<div class="controls">
<input type=text name="agent_port" size="32" value="<?php
echo escape_html(get_dev_attrib($device, 'agent_port'));
?>
"/>
</div>
</div>
</fieldset>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary" name="submit" value="save"><i class="icon-ok icon-white"></i> 保存变化</button>
</div>
</form>
<?php
// EOF
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:agent.inc.php
示例17: dbFetchRows
<?php
$ipmi_rows = dbFetchRows("SELECT * FROM sensors WHERE device_id = ? AND poller_type='ipmi'", array($device['device_id']));
d_echo($ipmi_rows);
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['type'] = get_dev_attrib($device, 'ipmi_type');
echo 'Fetching IPMI sensor data...';
if ($config['own_hostname'] != $device['hostname'] || $ipmi['host'] != 'localhost') {
$remote = ' -H ' . $ipmi['host'] . ' -U ' . $ipmi['user'] . ' -P ' . $ipmi['password'];
}
$results = external_exec($config['ipmitool'] . ' -I ' . $ipmi['type'] . ' -c ' . $remote . ' sdr 2>/dev/null');
d_echo($results);
echo " done.\n";
foreach (explode("\n", $results) as $row) {
list($desc, $value, $type, $status) = explode(',', $row);
$ipmi_sensor[$desc][$config['ipmi_unit'][$type]]['value'] = $value;
$ipmi_sensor[$desc][$config['ipmi_unit'][$type]]['unit'] = $type;
}
foreach ($ipmi_rows as $ipmisensors) {
echo 'Updating IPMI sensor ' . $ipmisensors['sensor_descr'] . '... ';
$sensor = $ipmi_sensor[$ipmisensors['sensor_descr']][$ipmisensors['sensor_class']]['value'];
$unit = $ipmi_sensor[$ipmisensors['sensor_descr']][$ipmisensors['sensor_class']]['unit'];
echo $sensor . " {$unit}\n";
$rrd_name = get_sensor_rrd_name($device, $ipmisensors);
$rrd_def = 'DS:sensor:GAUGE:600:-20000:20000';
$fields = array('sensor' => $sensor);
$tags = array('sensor_class' => $sensor['sensor_class'], 'sensor_type' => $sensor['sensor_type'], 'sensor_descr' => $sensor['sensor_descr'], 'sensor_index' => $sensor['sensor_index'], 'rrd_name' => $rrd_name, 'rrd_def' => $rrd_def);
data_update($device, 'ipmi', $tags, $fields);
// FIXME warnings in event & mail not done here yet!
开发者ID:Tatermen,项目名称:librenms,代码行数:31,代码来源:ipmi.inc.php
示例18: get_dev_attrib
<?php
if ($device['os_group'] == 'unix') {
echo $config['project_name'] . ' UNIX Agent: ';
$agent_port = get_dev_attrib($device, 'override_Unixagent_port');
if (empty($agent_port)) {
$agent_port = $config['unix-agent']['port'];
}
if (empty($config['unix-agent']['connection-timeout'])) {
$config['unix-agent']['connection-timeout'] = $config['unix-agent-connection-time-out'];
}
if (empty($config['unix-agent']['read-timeout'])) {
$config['unix-agent']['read-timeout'] = $config['unix-agent-read-time-out'];
}
$agent_start = microtime(true);
$agent = fsockopen($device['hostname'], $agent_port, $errno, $errstr, $config['unix-agent']['connection-timeout']);
// Set stream timeout (for timeouts during agent fetch
stream_set_timeout($agent, $config['unix-agent']['read-timeout']);
$agentinfo = stream_get_meta_data($agent);
if (!$agent) {
echo 'Connection to UNIX agent failed on port ' . $port . '.';
} else {
// fetch data while not eof and not timed-out
while (!feof($agent) && !$agentinfo['timed_out']) {
$agent_raw .= fgets($agent, 128);
$agentinfo = stream_get_meta_data($agent);
}
if ($agentinfo['timed_out']) {
echo 'Connection to UNIX agent timed out during fetch on port ' . $port . '.';
}
}
开发者ID:runborg,项目名称:librenms,代码行数:31,代码来源:unix-agent.inc.php
示例19: notify
function notify($device, $title, $message)
{
/// NOTE. Need full rewrite to universal function with message queues and multi-protocol (email,jabber,twitter)
global $config, $debug;
if ($config['alerts']['email']['enable'] && !$device['ignore']) {
if (!get_dev_attrib($device, 'disable_notify')) {
if ($config['alerts']['email']['default_only']) {
$email = $config['alerts']['email']['default'];
} else {
if (get_dev_attrib($device, 'override_sysContact_bool')) {
$email = get_dev_attrib($device, 'override_sysContact_string');
} elseif ($device['sysContact']) {
$email = $device['sysContact'];
} else {
$email = $config['alerts']['email']['default'];
}
}
$emails = parse_email($email);
if ($emails) {
// Mail backend params
$params = array('localhost' => php_uname('n'));
$backend = strtolower(trim($config['email_backend']));
switch ($backend) {
case 'sendmail':
$params['sendmail_path'] = $config['email_sendmail_path'];
break;
case 'smtp':
$params['host'] = $config['email_smtp_host'];
$params['port'] = $config['email_smtp_port'];
if ($config['email_smtp_secure'] == 'ssl') {
$params['host'] = 'ssl://' . $config['email_smtp_host'];
if ($config['email_smtp_port'] == 25) {
$params['port'] = 465;
// Default port for SSL
}
}
$params['timeout'] = $config['email_smtp_timeout'];
$params['auth'] = $config['email_smtp_auth'];
$params['username'] = $config['email_smtp_username'];
$params['password'] = $config['email_smtp_password'];
if ($debug) {
$params['debug'] = TRUE;
}
break;
default:
$backend = 'mail';
// Default mailer backend
}
// Mail headers
$headers = array();
if (empty($config['email_from'])) {
$headers['From'] = '"Observium" <observium@' . $params['localhost'] . '>';
// Default "From:"
} else {
foreach (parse_email($config['email_from']) as $from => $from_name) {
$headers['From'] = empty($from_name) ? $from : '"' . $from_name . '" <' . $from . '>';
// From:
}
}
$rcpts_full = '';
$rcpts = '';
foreach ($emails as $to => $to_name) {
$rcpts_full .= empty($to_name) ? $to . ', ' : '"' . $to_name . '" <' . $to . '>, ';
$rcpts .= $to . ', ';
}
$rcpts_full = substr($rcpts_full, 0, -2);
// To:
$rcpts = substr($rcpts, 0, -2);
$headers['Subject'] = $title;
// Subject:
$headers['X-Priority'] = 3;
// Mail priority
$headers['X-Mailer'] = OBSERVIUM_PRODUCT . ' ' . OBSERVIUM_VERSION;
// X-Mailer:
#$headers['Content-type'] = 'text/html';
$headers['Message-ID'] = '<' . md5(uniqid(time())) . '@' . $params['localhost'] . '>';
$headers['Date'] = date('r', time());
// Mail body
$message_header = $config['page_title_prefix'] . "\n\n";
$message_footer = "\n\nE-mail sent to: " . $rcpts . "\n";
$message_footer .= "E-mail sent at: " . date($config['timestamp_format']) . "\n";
$body = $message_header . $message . $message_footer;
// Create mailer instance
$mail =& Mail::factory($backend, $params);
// Sending email
$status = $mail->send($rcpts_full, $headers, $body);
if (PEAR::isError($status)) {
echo 'Mailer Error: ' . $status->getMessage() . PHP_EOL;
}
}
}
}
}
开发者ID:skive,项目名称:observium,代码行数:93,代码来源:functions.inc.php
示例20: unset
}
unset($graph_array);
if (get_dev_attrib($device, "imagingdrum_c_oid")) {
$graph_title = "成像鼓";
$graph_type = "device_imagingdrums";
include "includes/print-device-graph.php";
} elseif (get_dev_attrib($device, "imagingdrum_oid")) {
$graph_title = "成像鼓";
$graph_type = "device_imagingdrum";
include "includes/print-device-graph.php";
}
unset($graph_array);
if (get_dev_attrib($device, "fuser_oid")) {
$graph_title = "融合器";
$graph_type = "device_fuser";
include "includes/print-device-graph.php";
}
unset($graph_array);
if (get_dev_attrib($device, "transferroller_oid")) {
$graph_title = "传送辊";
$graph_type = "device_transferroller";
include "includes/print-device-graph.php";
}
unset($graph_array);
if (get_dev_attrib($device, "wastebox_oid")) {
$graph_title = "废碳粉盒";
$graph_type = "device_wastebox";
include "includes/print-device-graph.php";
}
echo '</table>';
$page_title[] = "打印";
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:printing.inc.php
注:本文中的get_dev_attrib函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论