I need some GPRINT tricks

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

I need some GPRINT tricks

Post by TFC »

Hi,
I need some gprint tricks about how can I write down my gprint as bold in cacti 0.8.5, Or, How can I modify my gprints as columnar style?
I mean, how can I aligned my gprint(string) in column format.
I read something in rrdtool web page like this :
String Formatting
The text printed below the actual graph can be formated by appending special escaped characters at the end of a text. When ever such a character occurs, all pending text is pushed onto the graph according to the character specified.

Valid markers are: \j for justified, \l for left aligned, \r for right aligned and \c for centered. In the next section there is an example showing how to use centered formating.

Normally there are two space characters inserted between every two items printed into the graph. The space following a string can be suppressed by putting a \g at the end of the string. The \g also squashes any space inside the string if it is at the very end of the string. This can be used in connection with %s to suppress empty unit strings.

GPRINT:a:MAX:%lf%s\g
A special case is COMMENT:\s this inserts some additional vertical space before placing the next row of legends.
How can I use these markers in CACTI?
I mean,forget.. look at the figure. You can understand what I want...
Thanks :)
Attachments
brandon-01.gif
brandon-01.gif (33.33 KiB) Viewed 41301 times
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

I tried duplicating this graph once in Cacti and the closest I came is this:

http://onion.raxnet.net/cacti/graph.php ... rra_id=all

My biggest problem was that I didn't have the RRDTool graph source in front of me, making it much harder. There are very few things that you can do with RRDTool, but can't do with Cacti. I have a feeling that this graph is quite "hand crafted" though. I'll bet a lot of the alignment is done simply by adding the correct amount of whitespace padding.

Like you pointed out, you can use the RRDTool formatting characters that are provided. Just use them in the "Text Format" field like any other character.

I attached the XML for my best attempt at this if you're interested.

-Ian
Attachments
cacti_graph_template_unix_ping_latency_detailed.xml
(20.01 KiB) Downloaded 3887 times
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

:(
unfortunately this is not workinh on my template ...
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

I forgot something... you will need to put the attached script in your /usr/local/bin directory for the XML above to work. You can of course change this path by going to "Data Input Methods" and selecting "Unix - Ping Host (With Latency)".

http://www.raxnet.net/downloads/cacti/s ... latency.pl

-Ian
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

Actually, I posted that graph for example. My actual need about interface traffic. You can see my GPRINTs in graph shown below. As you can see, My gprints grows to downstairs. But I want to see that MY INBOUND and OUTBOUND and their GPRİNTS ( last, curent and max) as columnar ...
Attachments
This is what I want :)
This is what I want :)
my_traffic.jpg (57.09 KiB) Viewed 41239 times
Guest

Fixed ping_latency.pl

Post by Guest »

raX wrote:I forgot something... you will need to put the attached script in your /usr/local/bin directory for the XML above to work. You can of course change this path by going to "Data Input Methods" and selecting "Unix - Ping Host (With Latency)".

http://www.raxnet.net/downloads/cacti/s ... latency.pl

-Ian
This script is off. The line:

$Average = $Average / $#RTValues;

must be changed to:

$Average = $Average / ($#RTValues + 1);

This is needed because the index of the last array element is one less than the actual length of the array.

The XML file you set up did not look like the graphs you have. I fixed it for me, but I am not sure how to send the updated XML.
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Re: Fixed ping_latency.pl

Post by raX »

Guest wrote:This script is off. The line:

$Average = $Average / $#RTValues;

must be changed to:

$Average = $Average / ($#RTValues + 1);
Good catch. I updated the script with this fix.

-Ian
cacti_fod
Posts: 14
Joined: Thu Dec 30, 2004 4:54 am

Post by cacti_fod »

raX wrote:I tried duplicating this graph once in Cacti and the closest I came is this:

http://onion.raxnet.net/cacti/graph.php ... rra_id=all

My biggest problem was that I didn't have the RRDTool graph source in front of me, making it much harder. There are very few things that you can do with RRDTool, but can't do with Cacti. I have a feeling that this graph is quite "hand crafted" though. I'll bet a lot of the alignment is done simply by adding the correct amount of whitespace padding.

Like you pointed out, you can use the RRDTool formatting characters that are provided. Just use them in the "Text Format" field like any other character.

I attached the XML for my best attempt at this if you're interested.

-Ian

I posted about this graph in particular in the Add-Ons forum, however I ran across this and figured I would post what I have straight from Brandon Gant himself, since I'm still having some woes implementing this exactly in Cacti ( not the whitespace stuff for GPRINTs, but how the RTT ms is in dark blue and the packetloss is stacked with the appropriate color... looks right when I go to view the source, but no dice.. the 0 - 10% packetloss overwrites the RTT ms on the graph ).

This is the source he uses to produce the graph ( as you already have the script above, which he uses.. I use a different Linux-based one that I made myself that essentially just outputs the same thing ):

Code: Select all

use RRDs;
RRDs::graph ("$Graph",
       "--start=$Start",
       "--title=$Title",
       "--vertical-label=Round-Trip Time (ms)",
       "--color=BACK#CCCCCC",
       "--color=CANVAS#6C9BCD",
       "--color=SHADEB#666666",
       "--height=125",
       "--width=475",
       "--lazy",
       "--imgformat=GIF",
       "--interlaced",
       "--units-exponent=0",
       "--upper-limit=500",
       "--lower-limit=0",
       "DEF:RTT=$RRDFile:RTT:AVERAGE",
       "DEF:PL=$RRDFile:PL:AVERAGE",
       "CDEF:NoPL=PL,10,LE,NEGINF,UNKN,IF",
       "CDEF:25PL=PL,25,LE,PL,10,GT,NEGINF,UNKN,IF,UNKN,IF",
       "CDEF:50PL=PL,50,LE,PL,25,GT,NEGINF,UNKN,IF,UNKN,IF",
       "CDEF:75PL=PL,75,LE,PL,50,GT,NEGINF,UNKN,IF,UNKN,IF",
       "CDEF:100PL=PL,100,LE,PL,75,GT,NEGINF,UNKN,IF,UNKN,IF",
       "HRULE:500#AA0000",
       "COMMENT:$PingFrom to $PingTo\\c",
       "COMMENT:\\s",
       "COMMENT:     Packet Loss Percentage                          ",
       "AREA:RTT#0000AA:Round-Trip Time in milliseconds",
       "COMMENT:\\s", "COMMENT:\\s", "COMMENT:        ",
       "STACK:NoPL#6C9BCD:  0-10%                                          ",
       "GPRINT:RTT:LAST:Current\\:%4.0lf ms",
       "COMMENT:\\s", "COMMENT:\\s", "COMMENT:        ",
       "STACK:25PL#FFFF00: 10-25%                                          ",
       "GPRINT:RTT:AVERAGE:Average\\:%4.0lf ms",
       "COMMENT:\\s", "COMMENT:\\s", "COMMENT:        ",
       "STACK:50PL#FFCC66: 25-50%                                              ",
       "GPRINT:RTT:MAX:Max\\:%4.0lf ms",
       "COMMENT:\\s", "COMMENT:\\s", "COMMENT:        ",
       "STACK:75PL#FF9900: 50-75% ",
       "COMMENT:\\s", "COMMENT:\\s", "COMMENT:        ",
       "STACK:100PL#FF0000:75-100% ",
       "COMMENT:\\s", "COMMENT:\\s",
       "COMMENT:Graph Updated: $Time \\r"
);
Here is how the RRAs were created, but may be of no relevance.. but just for good measure:

Code: Select all


rrdtool create ping.rrd DS:RTT:GAUGE:600:U:U DS:PL:GAUGE:600:U:U RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:1895


Ian, I would greatly appreciate your help in getting this into Cacti correctly as the Gallery screenshot is presented as this is a wonderous graph that Brandon Gant created that really correlates packetloss/RTT together so very well! ;)


TIA
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

cacti_fod wrote:Ian, I would greatly appreciate your help in getting this into Cacti correctly as the Gallery screenshot is presented as this is a wonderous graph that Brandon Gant created that really correlates packetloss/RTT together so very well! ;)
If you would be willing to send me the XML export of what you have so far, I would be more than willing to take a look at it. In addition, if there is some Cacti-specific reason why you can't get it to work correctly, I will try and address the issue :-).

On a side note, I will be working on enhancing the graph item editor in a couple of days for the next version of Cacti. If you have any specific requests for this part of the user interface, feel free to ask.

-Ian
cacti_fod
Posts: 14
Joined: Thu Dec 30, 2004 4:54 am

Post by cacti_fod »

Thanks for the response!

This is what I have so far:

Here is what the graphing looks like, and as you can see the packetloss isn't being stacked.. it's just on top of the RTT.

I've exported the template and attached the XML as well.

I would love to get the exact look that is intended within Cacti, because things start getting ugly when you have to put graphs in different locations.


TIA
Attachments
The graph
The graph
network_history.jpg (46.84 KiB) Viewed 40699 times
cacti_graph_template_network_history.xml
The graph template.
(22.59 KiB) Downloaded 2402 times
cacti_fod
Posts: 14
Joined: Thu Dec 30, 2004 4:54 am

Post by cacti_fod »

Also, you can see where no graphing was taking place because the host was down. 'The Witness' has assured me that the 'host down' stuff will be fixed in 0.8.7. I tried tuning the polling and everything stopped graphing. This graph in particular thrives on the host being down, so when you combine it with other SNMP-based graphing going on and the host goes down, and consequently Cacti doesn't poll it, then you lose the packetloss data you want.


FYI
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

This is correct, ping data will be collected regardless of whether the host is up or down.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
ariela
Posts: 17
Joined: Thu Feb 19, 2004 12:24 pm

Post by ariela »

I'm sorry, but I don't see data in my graphs.
I used ping_latency.pl and the xml file posted by raX.

from the logs I think the polling is good.
the normal ping (ping.pl) host doesn't work too (in this case, the 'php poller.php' works, via cacti crontab nothing ... it works only with superuser?)

Could you help me?
Regards
Andrea
ariela
Posts: 17
Joined: Thu Feb 19, 2004 12:24 pm

Post by ariela »

this is the output of 'php poller.php' as root:
--------------------------------------------------

01/08/2005 09:05:41 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_ping_74.rrd --template ping 1105214737:1.254
OK u:0.00 s:0.02 r:4.18
01/08/2005 09:05:41 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_ping_73.rrd --template ping 1105214737:1.160
OK u:0.00 s:0.02 r:4.18

...

Waiting on 1/1 pollers.
Waiting on 1/1 pollers.
01/08/2005 09:05:43 PM - POLLER: Poller[0] Parsed MULTI output field 'roundtrip:0' [map roundtrip->round_trip]
01/08/2005 09:05:43 PM - POLLER: Poller[0] Parsed MULTI output field 'packetloss:0' [map packetloss->packet_loss]
01/08/2005 09:05:43 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_open_files_77.rrd --template open_files 1105214737:U
OK u:0.00 s:0.02 r:6.22
01/08/2005 09:05:43 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_round_trip_76.rrd --template round_trip:packet_loss 1105214737:0:0
OK u:0.00 s:0.02 r:6.22
Waiting on 1/1 pollers.
Waiting on 1/1 pollers.
01/08/2005 09:05:45 PM - POLLER: Poller[0] Parsed MULTI output field 'roundtrip:0' [map roundtrip->round_trip]
01/08/2005 09:05:45 PM - POLLER: Poller[0] Parsed MULTI output field 'packetloss:0' [map packetloss->packet_loss]
01/08/2005 09:05:45 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_round_trip_78.rrd --template round_trip:packet_loss 1105214737:0:0
OK u:0.00 s:0.02 r:8.24
Waiting on 1/1 pollers.
Waiting on 1/1 pollers.
Waiting on 1/1 pollers.

From poller cache:
---------------------

Data Source: byron_1751 - Ping Host
RRD: /usr/local/share/cacti/rra/byron_1751_ping_73.rrd
Action: 1, Script: perl /usr/local/share/cacti/scripts/ping.pl 192.168.1.1
Data Source: byron_1751 - Ping Host
RRD: /usr/local/share/cacti/rra/byron_1751_ping_74.rrd
Action: 1, Script: perl /usr/local/share/cacti/scripts/ping.pl 81.174.12.x
Data Source: byron_1751 - Open Files
RRD: /usr/local/share/cacti/rra/byron_1751_open_files_75.rrd
Action: 0, OID: .1.3.6.1.4.1.23.2.28.2.7.0 (Host: 192.168.1.1, Community: mycommunity)
Data Source: byron_1751 - ICMP Latency
RRD: /usr/local/share/cacti/rra/byron_1751_round_trip_76.rrd
Action: 1, Script: perl /usr/local/share/cacti/scripts/ping_latency.pl 192.168.1.1
Data Source: byron_1751 - Open Files
RRD: /usr/local/share/cacti/rra/byron_1751_open_files_77.rrd
Action: 0, OID: .1.3.6.1.4.1.23.2.28.2.7.0 (Host: 192.168.1.1, Community: mycommunity)
Data Source: byron_1751 - ICMP Latency
RRD: /usr/local/share/cacti/rra/byron_1751_round_trip_78.rrd
Action: 1, Script: perl /usr/local/share/cacti/scripts/ping_latency.pl 81.174.12.x


I hope youn could help me.
Regards
Andrea
ariela
Posts: 17
Joined: Thu Feb 19, 2004 12:24 pm

Post by ariela »

in my graphs I've NaN ... I've logged the cron, and this is the output:

01/08/2005 09:35:09 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_traffic_in_31.rrd --template traffic_out:traffic_in 1105216501:U:U
OK u:0.01 s:0.00 r:7.16
ping: not found
ping: not found
U:U
U:U
Waiting on 1/1 pollers.
01/08/2005 09:35:10 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_round_trip_78.rrd --template 1105216501:U
ERROR: Not enough arguments
OK u:0.01 s:0.00 r:8.18
01/08/2005 09:35:10 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_mem_used_62.rrd --template mem_used 1105216501:18118584
OK u:0.01 s:0.00 r:8.19
01/08/2005 09:35:10 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_open_files_77.rrd --template open_files 1105216501:U
OK u:0.01 s:0.00 r:8.19
01/08/2005 09:35:10 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_round_trip_76.rrd --template 1105216501:U
ERROR: Not enough arguments
OK u:0.01 s:0.00 r:8.19
01/08/2005 09:35:10 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_open_files_75.rrd --template open_files 1105216501:U
OK u:0.01 s:0.00 r:8.19
01/08/2005 09:35:10 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_ping_74.rrd --template ping 1105216501:U
OK u:0.01 s:0.00 r:8.19
01/08/2005 09:35:10 PM - POLLER: Poller[0] CACTI2RRD: /usr/local/bin/rrdtool update /usr/local/share/cacti/rra/byron_1751_ping_73.rrd --template ping 1105216501:U
OK u:0.01 s:0.00 r:8.19

...

Thank you for your support
Regards
Andrea
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests