Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


cacti_availability display

 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (Network Weather Map)
Author Message
dres1978



Joined: 21 Apr 2004
Posts: 10

PostPosted: Tue Jun 24, 2008 2:39 pm    Post subject: cacti_availability display Reply with quote

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: 2135
Location: United Kingdom

PostPosted: Tue Jun 24, 2008 7:09 pm    Post subject: Reply with quote

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

PostPosted: Thu Jun 26, 2008 4:27 pm    Post subject: mm, yeah Reply with quote

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

PostPosted: Thu Jun 26, 2008 4:28 pm    Post subject: Reply with quote

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: 2135
Location: United Kingdom

PostPosted: Mon Jun 30, 2008 2:03 am    Post subject: Reply with quote

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

PostPosted: Mon Jun 30, 2008 4:38 pm    Post subject: Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (Network Weather Map) All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group