Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Wed Jun 28, 2017 10:35 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: How to display CPU on Weather Map
PostPosted: Mon Jul 11, 2016 5:57 am 
Offline

Joined: Mon Jul 11, 2016 5:16 am
Posts: 3
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:
File comment: A real scale of CPU
2016-07-11_181610.png
2016-07-11_181610.png [ 29.91 KiB | Viewed 1706 times ]
File comment: A scale of cpu that I see
2016-07-11_180910.png
2016-07-11_180910.png [ 16.52 KiB | Viewed 1706 times ]
Top
 Profile  
 
 Post subject: Re: How to display CPU on Weather Map
PostPosted: Sat Jul 30, 2016 1:46 am 
Offline
Cacti User

Joined: Mon May 31, 2010 9:26 am
Posts: 125
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


Top
 Profile  
 
 Post subject: Re: How to display CPU on Weather Map
PostPosted: Sat Jul 30, 2016 3:28 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5111
Location: United Kingdom
Code:
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.98 is out! & QuickTree 0.2. Superlinks is over there now.
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!)


Top
 Profile  
 
 Post subject: Re: How to display CPU on Weather Map
PostPosted: Wed Nov 02, 2016 10:34 pm 
Offline

Joined: Mon Jul 11, 2016 5:16 am
Posts: 3
Howie wrote:
Code:
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 ?


Top
 Profile  
 
 Post subject: Re: How to display CPU on Weather Map
PostPosted: Wed Nov 02, 2016 10:41 pm 
Offline

Joined: Mon Jul 11, 2016 5:16 am
Posts: 3
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


Top
 Profile  
 
 Post subject: Re: How to display CPU on Weather Map
PostPosted: Thu Nov 03, 2016 3:56 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5111
Location: United Kingdom
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:
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.98 is out! & QuickTree 0.2. Superlinks is over there now.
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!)


Top
 Profile  
 
 Post subject: Re: How to display CPU on Weather Map
PostPosted: Fri Nov 04, 2016 1:25 pm 
Offline
Cacti User

Joined: Mon May 31, 2010 9:26 am
Posts: 125
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.

[[email protected] ~]# 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
[[email protected] ~]# 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


Top
 Profile  
 
 Post subject: Re: How to display CPU on Weather Map
PostPosted: Fri Nov 04, 2016 3:22 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Sep 16, 2004 5:53 am
Posts: 5111
Location: United Kingdom
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.98 is out! & QuickTree 0.2. Superlinks is over there now.
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!)


Top
 Profile  
 
 Post subject: Re: How to display CPU on Weather Map
PostPosted: Fri Nov 04, 2016 4:40 pm 
Offline
Cacti User

Joined: Mon May 31, 2010 9:26 am
Posts: 125
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group