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    


Icon Scale

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



Joined: 19 Oct 2007
Posts: 46

PostPosted: Wed Mar 12, 2008 9:42 am    Post subject: Icon Scale Reply with quote

Hi All,

Ive found an example how to display up down status on a weathermap.
I've seen that, if down you can display a dirrent icon that when it up, ...

I'm wondering if this can be done in some kind of scale.

like when the value is 0 get a red smily
when it is between 1 and 50 give a green smily
when it is between 50 and 75 a yellow smily
when it is between 75 and 100 a red one again
(this is an example, i cant to do this with other ranges and more pics)

Thanks,
kyRoo
Back to top
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 2135
Location: United Kingdom

PostPosted: Sat Mar 15, 2008 1:23 pm    Post subject: Re: Icon Scale Reply with quote

KyRoo wrote:
Hi All,

Ive found an example how to display up down status on a weathermap.
I've seen that, if down you can display a dirrent icon that when it up, ...

I'm wondering if this can be done in some kind of scale.

like when the value is 0 get a red smily
when it is between 1 and 50 give a green smily
when it is between 50 and 75 a yellow smily
when it is between 75 and 100 a red one again
(this is an example, i cant to do this with other ranges and more pics)

Thanks,
kyRoo


You can do this two ways, depending on which version of weathermap you have.

In 0.91+, you can use 'inscalekey' to find which line in a scale the item hit.
Code:

SCALE goodbad 0 0 255 0 0
SCALE goodbad 0 50 0 255 0
SCALE goodbad 50 75 255 255 0

to define a scale with the bands you want to use.
(the colours here don't actually matter - if you don't want the label to change colour, set all the colours to white)

Then you can use
Code:

NODE blah
   USESCALE goodbad
    ICON images/status_{node:this:inscalekey}.png


Now, inscalekey contains a value like 0_0, 0_50, 50_75 (the top and bottom values of the scale line that was matched, with an _ in between). There's also a outscalekey. So you need icons called status_0_0.png etc.

In 0.95+, it's a bit nicer. There's a thing called a scale tag.
Code:

SCALE goodbad 0 0 255 0 0  images/redicon.png
SCALE goodbad 0 50 0 255 0 images/greenicon.png
SCALE goodbad 50 75 255 255 0 images/yellowicon.png

NODE blah
   USESCALE goodbad
    ICON {node:this:inscaletag}


You can use the tag for anything, not just icons. So if you wanted a comment to appear alongside only busy links, you could do that with this method too.

Hope that lot makes a bit of sense. It's a few steps, but especially in 0.95 it's fairly painless.
Back to top
Jem



Joined: 12 Apr 2005
Posts: 22

PostPosted: Tue Nov 04, 2008 9:10 am    Post subject: Reply with quote

Well still some troubles

My configuration is the following:
Code:
SCALE goodbad 0 33 255 0 0  images/chip_ok.png
SCALE goodbad 33 66 0 255 0 images/chip_warning.png
SCALE goodbad 66 100 255 255 0 images/chip_critical.png

...

# Node definitions:
NODE MYHOST
        USESCALE goodbad
        ICON {node:this:inscalekey}
        INFOURL /cacti/graph.php?rra_id=all&local_graph_id=2001
        OVERLIBGRAPH /cacti/graph_image.php?...local_graph_id=2001
        TARGET gauge:/cacti/rra/myhost_5min_cpu_2591.rrd:5min_cpu:-
        POSITION 298 257


But when the map is being generate I have this error in my Cacti log file:

Code:
11/04/2008 03:06:02 PM - WEATHERMAP: Poller[0] [Map 17] Sandbox: ICON 0_33 does not exist, or is not readable. Check path and permissions.
Back to top
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 2135
Location: United Kingdom

PostPosted: Tue Nov 04, 2008 9:18 am    Post subject: Reply with quote

Jem wrote:
Well still some troubles

Replying to two different threads for the same problem is one of them...


Jem wrote:

My configuration is the following:
Code:
SCALE goodbad 0 33 255 0 0  images/chip_ok.png
SCALE goodbad 33 66 0 255 0 images/chip_warning.png
SCALE goodbad 66 100 255 255 0 images/chip_critical.png

...

# Node definitions:
NODE MYHOST
        USESCALE goodbad
        ICON {node:this:inscalekey}
        INFOURL /cacti/graph.php?rra_id=all&local_graph_id=2001
        OVERLIBGRAPH /cacti/graph_image.php?...local_graph_id=2001
        TARGET gauge:/cacti/rra/myhost_5min_cpu_2591.rrd:5min_cpu:-
        POSITION 298 257


But when the map is being generate I have this error in my Cacti log file:

Code:
11/04/2008 03:06:02 PM - WEATHERMAP: Poller[0] [Map 17] Sandbox: ICON 0_33 does not exist, or is not readable. Check path and permissions.


Sorry, that should be inscaletag, not inscalekey.
Back to top
Jem



Joined: 12 Apr 2005
Posts: 22

PostPosted: Tue Nov 04, 2008 9:26 am    Post subject: Reply with quote

Yes sorry, for responding on the other topic, but as it was the same configuration, I screwed up by responding to the thread... sorry.

It's working fine now, thank a lot !
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