How to display CPU on Weather Map

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

Post Reply
kwangrubio
Posts: 4
Joined: Mon Jul 11, 2016 5:16 am

How to display CPU on Weather Map

Post by kwangrubio »

Hello


I use Weather Map version 0.97A and I want to created display label of CPU. However I have some problem that can't got a real scale.

Could you please to help me check code that it's right ?

LABEL {node:this:inpercent:CPU %0.0f}
INFOURL /cacti/graph.php?rra_id=all&local_graph_id=8018
OVERLIBGRAPH /cacti/graph_image.php?local_graph_id=8018&rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300
TARGET gauge: /var/www/cacti/rra/node_5min_cpu_8318.rrd:5min_cpu:5min_cpu


The RRDTool Command as follow :

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-129600 \
--end=-300 \
--title='node - CPU Usage' \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit='0' \
--vertical-label='percent' \
--slope-mode \
--font TITLE:9: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a='/var/www/cacti/rra/node_5min_cpu_8318.rrd':'5min_cpu':AVERAGE \
--watermark "Company - Confidential Date: 11-Jul-2016 Time: 17:29" \
AREA:a#FF0000FF:'CPU Usage' \
GPRINT:a:LAST:'Current\:%8.0lf' \
GPRINT:a:AVERAGE:'Average\:%8.0lf' \
GPRINT:a:MAX:'Maximum\:%8.0lf'
Attachments
A real scale of CPU
A real scale of CPU
2016-07-11_181610.png (29.91 KiB) Viewed 4486 times
A scale of cpu that I see
A scale of cpu that I see
2016-07-11_180910.png (16.52 KiB) Viewed 4486 times
Atreides
Cacti User
Posts: 174
Joined: Mon May 31, 2010 9:26 am

Re: How to display CPU on Weather Map

Post by Atreides »

Hello,
I use this code for displaying CPU usage :

NODE CPU
LABEL {node:this:outpercent:%k}%
INFOURL /v3/graph.php?rra_id=all&local_graph_id=3393
OVERLIBGRAPH /v3/graph_image.php?rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300&local_graph_id=3393
TARGET gauge:/var/www/html/v3/rra/local_cpu_3421.rrd:-:cpu
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: How to display CPU on Weather Map

Post by Howie »

Code: Select all

TARGET gauge: /var/w
In the OP's config, there's a space between gauge: and the filename. There shouldn't be. If you looked at the cacti log you would have seen warnings about unrecognised targets.
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!)
kwangrubio
Posts: 4
Joined: Mon Jul 11, 2016 5:16 am

Re: How to display CPU on Weather Map

Post by kwangrubio »

Howie wrote:

Code: Select all

TARGET gauge: /var/w
In the OP's config, there's a space between gauge: and the filename. There shouldn't be. If you looked at the cacti log you would have seen warnings about unrecognised targets.
Thanks so much :D Finally I did't it which a real scale.

However Is it possible to show CPU and temperature in the same label ?
kwangrubio
Posts: 4
Joined: Mon Jul 11, 2016 5:16 am

Re: How to display CPU on Weather Map

Post by kwangrubio »

Atreides wrote:Hello,
I use this code for displaying CPU usage :

NODE CPU
LABEL {node:this:outpercent:%k}%
INFOURL /v3/graph.php?rra_id=all&local_graph_id=3393
OVERLIBGRAPH /v3/graph_image.php?rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300&local_graph_id=3393
TARGET gauge:/var/www/html/v3/rra/local_cpu_3421.rrd:-:cpu

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

Re: How to display CPU on Weather Map

Post by Howie »

You can show CPU and temperature on the same label, but not on two lines.

You can use two targets, one to fetch an 'in' value, and one to fetch an 'out' value from different rrd files, if you need to.

So based on Atreides' example:

Code: Select all

NODE CPU
  LABEL {node:this:inpercent:%k}% {node:this:bandwidth_out:%.1f}degC
  INFOURL /v3/graph.php?rra_id=all&local_graph_id=3393
  OVERLIBGRAPH /v3/graph_image.php\?rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300&local_graph_id=3393
  TARGET gauge:/var/www/html/v3/rra/local_cpu_3421.rrd:-:cpu gauge:/var/www/html/v3/rra/local_temp_3333.rrd:temp:-
should do that. The DS name might be different in your RRD file, but that's the basic idea. You can also specify two OVERLIBGRAPHs on one line and get a stacked pair of graphs.
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!)
Atreides
Cacti User
Posts: 174
Joined: Mon May 31, 2010 9:26 am

Re: How to display CPU on Weather Map

Post by Atreides »

Howie, using this code, the results are reversed : its displaying first the cpu in degG(the value corresponds to that of the temperature) in percents, and temp value corresponds to that of the CPU usage.
If I change the label to : LABEL {node:this:bandwidth_out:%.1f}degC {node:this:inpercent:%k}% , its returning correct values.




PS : Is there a way to TEMPLATE a target then on node to add a value to the TARGET ?
I have tons of oid I have to interrogate, all are consecutive numbers, or only las 2 digits are changed.

[root@msq ~]# snmpwalk -v2c -c test 172.25.232.33 1.3.6.1.4.1.9.9.91.1.1.1.1.4.1025
SNMPv2-SMI::enterprises.9.9.91.1.1.1.1.4.1025 = INTEGER: -123
[root@msq ~]# snmpwalk -v2c -c test 172.25.232.33 1.3.6.1.4.1.9.9.91.1.1.1.1.4.1037
SNMPv2-SMI::enterprises.9.9.91.1.1.1.1.4.1037 = INTEGER: -63

It goes + 12 from one interface to another, till the end.

NODE RX_POWER_GI1.1
TEMPLATE RX
TARGET 0.1*snmp:{map:community}:172.25.232.33:-:1.3.6.1.4.1.9.9.91.1.1.1.1.4.1205
POSITION RX_POWER_GI1 0 23

then

NODE RX_POWER_GI1.2
TEMPLATE RX
TARGET : SOMETHING + 12
POSITION RX_POWER_GI1 0 23
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: How to display CPU on Weather Map

Post by Howie »

Yes, you are correct, I got the target the wrong way around. Sorry!

For the other question, there isn't sorry. I usually use a quick perl/excel/whatever script to generate these. If it's Cacti rrd files for traffic, then maybe cacti-integrate.php (in the random-bits directory) will help? That lets you define a few variables, and it goes to find the relevant Cacti data sources to use.

How exactly would you imagine your feature would look? Can you make an example?
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!)
Atreides
Cacti User
Posts: 174
Joined: Mon May 31, 2010 9:26 am

Re: How to display CPU on Weather Map

Post by Atreides »

Maybe sounds silly or stupid :) (i kinda hate programming/scripts).

TEMPLATE snmp
USEOID 1.3.6.1.4.1.9.9.91.1.1.1.1.4.1025
INCREMENT 12

NODE GI1.1
TARGET snmp:{map:community}:172.25.232.33:-:USEOID+INCREMENT

Or something like this
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests