Different CPU's Utilization in a single web page

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

To get 2 decimal places:
LABEL {node:this:name} {node:this:bandwidth_in:%.2f}%

To get an integer:
LABEL {node:this:name} {node:this:bandwidth_in:%d}%

The %d/%f stuff is standard C/php/perl printf codes, if you happen to be familiar with those.
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!)
mgupta
Posts: 16
Joined: Thu Aug 13, 2009 4:29 pm
Location: Canada

Re: Different CPU's Utilization in a single web page

Post by mgupta »

Can it be rounded somehow?

For example if RRD returns 0.9 -> Can it be displayed as 1 on the weathermap?
Manas
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re:

Post by Howie »

Howie wrote: To get an integer:
LABEL {node:this:name} {node:this:bandwidth_in:%d}%
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!)
mgupta
Posts: 16
Joined: Thu Aug 13, 2009 4:29 pm
Location: Canada

Re: Different CPU's Utilization in a single web page

Post by mgupta »

Agreed. I should have been clearer.

If 1.9 is returned from RRD - and %d is used -> you get 1
with 0.9 -> you get 0.

I'd like to have 1 when its 0.9 from RRD and 2 when its 1.9
Manas
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Different CPU's Utilization in a single web page

Post by Howie »

mgupta wrote:Agreed. I should have been clearer.

If 1.9 is returned from RRD - and %d is used -> you get 1
with 0.9 -> you get 0.

I'd like to have 1 when its 0.9 from RRD and 2 when its 1.9
Ah, gotcha.

It's a bit hacky, but this should work: %.0f
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!)
mgupta
Posts: 16
Joined: Thu Aug 13, 2009 4:29 pm
Location: Canada

Re: Different CPU's Utilization in a single web page

Post by mgupta »

It worked. Thanks mate!

Although I dont understand how :)

Looking at this - http://www.php.net/manual/en/function.sprintf.php

:%.0f
-> Treated as floating point
-> Zero decimal places
Manas
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests