Utilities

rrd_change

Description:

This script is used to manipulate RRD files. It can “append” or “insert” new datasources to the file and rearrange (and / or delete) the datasources within the file.

Current Version

0.2

Last Release Date

2013-08-24

Compatible With

  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x

License

GPL


Project Files
Project Notes
This script has been written because sometimes (not often) a nagios plugin changes and outputs more (or less) performance data values than before (or in different order), resulting in a failure to update the corresponding RRD file. So to keep the existing data, I wrote this script to "insert", "append" or even rearrange ("select") datasources within the RRD file. The script is inspired by the "rrd_convert.pl" script delivered with PNP4Nagios. NOTE! For now, this tool should only be used on RRD files created by PNP4Nagios! Here, the datasource names are just numbers starting from 1. Then inserting or selecting datasources, I change these numbers! Note for heartbeat: You should use the same heartbeat value for new datasources. Use rrdtool info | grep -i 'heartbeat' to list the heartbeat values within the RRD file. Examples 1: rrd_change.pl -a -t GAUGE:300 -t COUNTER:300 -f file.rrd Appends 2 new datasources to the RRD file. One of type GAUGE with a heartbeat of 300 seconds an a COUNTER datasource with 300 seconds heartbeat. Example 2: You have a RRD file with 4 datasources. The plugin outputs: 1. virtual memory 2. physical memory 3. buffers 4. swap The plugin changed. It also outputs "cache memory" on position 3 1. virtual memory 2. physical memory 3. cache memory 4. buffers 5. swap Add 1 new (empty) datasource on position 3 rrd_change.pl -i -p 3 -t GAUGE:300 -f file.rrd Example 3: The plugin in example 2 changed again! Now, the output order differs. You would write wrong values into the datasources. You have to reorder the datasources. The new order is: 1. swap 2. physical mem 3. virtual mem 4. buffer 5. cache rrd_change.pl -s 5,2,1,4,3 -f file.rrd This command reorders the datasources. The order in which the datasources are specified with parameter "-s" is the new order within the RRD file, starting from number 1. Note: Every datasource *not* specified with paramter "-s" will be removed from the RRD file! So this command can also be used to delete datasources.
Reviews (3) Add a Review
Thank you very much!
by whutest, December 31, 2018

Very useful script. Thank you very very much!



Works as expected!
by Peer, October 31, 2016

Just make sure you do that with the user that owns the RRD files, or recall to chown it after the change. Great utility!



Good Job
by Cheng, August 31, 2013

Can you provide some examples of use ?



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
5 (6)
Favorites
1
Views
37,319