git-svn-id: http://www.observium.org/svn/observer/trunk@2230 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong 2011-05-03 20:13:15 +00:00
parent 5d5c04b236
commit c5bac776db
4 changed files with 25 additions and 5 deletions

View File

@ -46,7 +46,7 @@ while ($toner = mysql_fetch_assoc($sql))
$hostname = gethostbyid($toner['device_id']);
$descr = substr(str_pad($toner['toner_descr'], 16),0,16);
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("toner-" . $toner['toner_descr'] . ".rrd");
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("toner-" . $toner['toner_index'] . ".rrd");
$toner_id = $toner['toner_id'];
$rrd_options .= " DEF:toner$toner_id=$rrd_filename:toner:AVERAGE";

View File

@ -22,6 +22,8 @@ if (device_permitted($_GET['id']) || $check_device == $_GET['id'])
$select[$section] = "selected";
$device = device_by_id_cache($_GET['id']);
$attribs = get_dev_attribs($device['device_id']);
if ($config['os'][$device['os']]['group']) { $device['os_group'] = $config['os'][$device['os']]['group']; }
echo('<table style="margin: 0px 7px 7px 7px;" cellpadding="15" cellspacing="0" class="devicetable" width="99%">');

View File

@ -249,6 +249,18 @@ function set_dev_attrib($device, $attrib_type, $attrib_value)
return mysql_affected_rows();
}
function get_dev_attribs($device)
{
$attribs = array();
$sql = "SELECT attrib_type, attrib_value FROM devices_attribs WHERE `device_id` = '" . mres($device['device_id']) . "'";
$data = mysql_query($sql);
while($entry = mysql_fetch_array($data))
{
$attribs[$entry['attrib_type']] = $attribs['attrib_value'];
}
return $attribs;
}
function get_dev_attrib($device, $attrib_type)
{
$sql = "SELECT attrib_value FROM devices_attribs WHERE `device_id` = '" . mres($device['device_id']) . "' AND `attrib_type` = '$attrib_type'";

View File

@ -13,7 +13,13 @@ if ($config['enable_printers'])
$tonerperc = snmp_get($device, $toner['toner_oid'], "-OUqnv") / $toner['toner_capacity'] * 100;
$tonerrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("toner-" . $toner['toner_descr'] . ".rrd");
$old_tonerrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("toner-" . $toner['toner_descr'] . ".rrd");
$tonerrrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("toner-" . $toner['toner_index'] . ".rrd");
if (!is_file($tonerrrd) && is_file($old_tonerrrd))
{
rename($old_tonerrrd, $tonerrrd);
}
if (!is_file($tonerrrd))
{