cacti_availability display

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

Post Reply
dres1978
Posts: 10
Joined: Wed Apr 21, 2004 11:20 am
Contact:

cacti_availability display

Post by dres1978 »

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?
DRES
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

Neither the in or out value for cactihost: is the availability, so you can't use it with a scale to change colours.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
dres1978
Posts: 10
Joined: Wed Apr 21, 2004 11:20 am
Contact:

mm, yeah

Post by dres1978 »

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
DRES
dres1978
Posts: 10
Joined: Wed Apr 21, 2004 11:20 am
Contact:

Post by dres1978 »

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
DRES
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

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 :roll:
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
dres1978
Posts: 10
Joined: Wed Apr 21, 2004 11:20 am
Contact:

Post by dres1978 »

hi howie

now is working :D

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
DRES
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests