|
|
| Author |
Message |
dres1978
Joined: 21 Apr 2004 Posts: 10
|
Posted: Tue Jun 24, 2008 2:39 pm Post subject: cacti_availability display |
|
|
Hi Guys
I have the following:
NODE -Availability-x.x.x.x
LABEL {node:this:cacti_availability:%.2f}%
TARGET cactihost:2
USESCALE AVAILABILITY
LABELBGCOLOR none
LABELOUTLINECOLOR none
POSITION 572 417
the problem is that the SCALE AVAILABILITY doesnt work
the "99.7%" for example is always in one color
my scale is not working
SCALE AVAILABILITY 0 96 255 0 0
SCALE AVAILABILITY 0 100 0 255 0
any ideas? |
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2248 Location: United Kingdom
|
Posted: Tue Jun 24, 2008 7:09 pm Post subject: |
|
|
| Neither the in or out value for cactihost: is the availability, so you can't use it with a scale to change colours. |
|
| Back to top |
|
 |
dres1978
Joined: 21 Apr 2004 Posts: 10
|
Posted: Thu Jun 26, 2008 4:27 pm Post subject: mm, yeah |
|
|
sorry my error.
i did changes.
and know a have the following:
class WeatherMapDataSource_mysql extends WeatherMapDataSource {
if(preg_match("/^mysqlavailability:([^:]+) [^:]+) [^:]+) [^:]+) [^:]+)$/",$targetstring,$matches))
{
$database_user = $matches[1];
$database_pass = $matches[2];
$database_name = $matches[3];
$database_host = $matches[4];
//$database_table = $matches[4];
$cacti_id = intval($matches[5]);
$SQL = "select availability from host where id=$cacti_id";
if(mysql_connect($database_host,$database_user,$database_pass)) {
if(mysql_select_db($database_name)) {
$result = mysql_query($SQL);
if (!$result) {
warn("dbsample ReadData: Invalid query: " . mysql_error()."\n");
} else {
$row = mysql_fetch_assoc($result);
$resultado = $row['availability'];
$item->add_note("db_resultado",$row['availability']);
a have the correct value, but the scale is my problem
the color is only red, why?
KEYPOS AVAILABILITY 1083 920 AVAILABILITY
SCALE AVAILABILITY 0 96 255 0 0
SCALE AVAILABILITY 96 100 0 255 0 |
|
| Back to top |
|
 |
dres1978
Joined: 21 Apr 2004 Posts: 10
|
Posted: Thu Jun 26, 2008 4:28 pm Post subject: |
|
|
and ...............
NODE -Availability-200.62.x.x
LABEL {node:this:db_resultado:%.2f}%
TARGET mysqlavailability:user:password:cacti:cacti.xxx.com:27
USESCALE AVAILABILITY in
LABELBGCOLOR none
LABELOUTLINECOLOR none
POSITION 572 309 |
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2248 Location: United Kingdom
|
Posted: Mon Jun 30, 2008 2:03 am Post subject: |
|
|
Don't know... that looks about right.
Do you set the MAXVALUE for NODEs in the default node? It's 100 by default, but if you had changed it then the percentage calculation would be wrong...
other than that, try running with DEBUG logging for a poller cycle. You'll see the 'ColourFromPercent' function converting the percentage to a colour, which might give you a clue. You should also look for the ReadData parts, to make sure that your new DS plugin is getting data back to weathermap OK.
I should really improve this a bit so that you don't need to write a new plugin though - the data is already available  |
|
| Back to top |
|
 |
dres1978
Joined: 21 Apr 2004 Posts: 10
|
Posted: Mon Jun 30, 2008 4:38 pm Post subject: |
|
|
hi howie
now is working
my error was here:
//return($resultado);
i assigned $resultado--> $inbw and did changes to:
return( array($inbw, $outbw, $data_time) );
USESCALE AVAILABILITY in , is working after that
thx |
|
| Back to top |
|
 |
|