cleanups, add epson printer discovery, fix bar colour on device overview for unknown toner colours

git-svn-id: http://www.observium.org/svn/observer/trunk@3036 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2012-04-14 23:28:23 +00:00
parent 22c60a80e3
commit f491ec6580
9 changed files with 38 additions and 35 deletions

View File

@@ -12,32 +12,32 @@ foreach (dbFetchRows("SELECT * FROM toner where device_id = ?", array($id)) as $
{
$colour = toner2colour($toner['toner_descr']);
if ($colour == NULL)
if ($colour['left'] == NULL)
{
# FIXME generic colour function
switch ($iter)
{
case "1":
$colour= "000000";
$colour['left']= "000000";
break;
case "2":
$colour= "008C00";
$colour['left']= "008C00";
break;
case "3":
$colour= "4096EE";
$colour['left']= "4096EE";
break;
case "4":
$colour= "73880A";
$colour['left']= "73880A";
break;
case "5":
$colour= "D01F3C";
$colour['left']= "D01F3C";
break;
case "6":
$colour= "36393D";
$colour['left']= "36393D";
break;
case "7":
default:
$colour= "FF0000";
$colour['left']= "FF0000";
unset($iter);
break;
}
@@ -50,7 +50,7 @@ foreach (dbFetchRows("SELECT * FROM toner where device_id = ?", array($id)) as $
$toner_id = $toner['toner_id'];
$rrd_options .= " DEF:toner$toner_id=$rrd_filename:toner:AVERAGE";
$rrd_options .= " LINE2:toner$toner_id#".$colour.":'" . $descr . "'";
$rrd_options .= " LINE2:toner$toner_id#".$colour['left'].":'" . $descr . "'";
$rrd_options .= " GPRINT:toner$toner_id:LAST:'%5.0lf%%'";
$rrd_options .= " GPRINT:toner$toner_id:MIN:'%5.0lf%%'";
$rrd_options .= " GPRINT:toner$toner_id:MAX:%5.0lf%%\\\\l";