First, be a good sysadmin and take a backup of the rrd-file before you begin.
The RRD files and XML files containing the datasource descriptions and other variables and values the PNP templating engine works with are found under the following path:
/opt/monitor/op5/pnp/perfdata/<hostname>/<Service_Name>.{rrd,xml}
To find out the datasources names and numbers to work with, you can check the XML file:
# cat <graph name>.xml
The two things to look for is the <DS> and <LABEL> tags. Find out what label you want to trim and use the DS-id in the rrdtool tune command.
Once you know what you want to modify and what the maximum value that the RRD file should accept as a measurement value should be, you can proceed with the following steps:
- "tune" the RRD file to not accept values over X on datasource Y (this is a permanent change on the RRD file which means that once this limit is set, it also applies to all values that will be inserted to the rrd file in future)
- "dump" the content of the RRD file into an XML file (reason: setting the limit in RRD only applies to newly inserted values, not to already existing ones)
- "restore" the XML to RRD, so that the max limit takes effect and the values contained in the XML which are over the max limit are omitted (in fact, "NaN" data entries are generated for these)
These are the commands you will need:
# rrdtool tune <path to rrd-file> -a <DS>:<MAX VALUE>
# rrdtool dump <rrd-file> > fix.xml
# rm <rrd-file>
# rrdtool restore fix.xml <rrd-file> -r
Sample:
[root@mnpc-mon9 ~]# cd /opt/monitor/op5/pnp/perfdata/server5
[root@mnpc-mon9 server5]#
[root@mnpc-mon9 server5]# rrdtool info PING_rta.rrd | grep .max
ds[1].max = NaN
[root@mnpc-mon9 server5]# rrdtool tune PING_rta.rrd -a 1:0.030
[root@mnpc-mon9 server5]# rrdtool dump PING_rta.rrd > fix.xml
[root@mnpc-mon9 server5]# rm PING_rta.rrd
rm: remove regular file 'PING_rta.rrd'? y
[root@mnpc-mon9 server5]# rrdtool restore fix.xml PING_rta.rrd -r
[root@mnpc-mon9 server5]#
[root@mnpc-mon9 server5]# rrdtool info PING_rta.rrd | grep .max
ds[1].max = 3.0000000000e-02
Caution: Graphs might have gaps because data beyond 0.030 have been replaced with "NaN" (see bullet number 3 above)
Script to automate these steps:
Especially for bandwidth checks where "peaks" is a phenomenon that is seen in many installations, this is a very easy script to make the above steps a bit easier:
Comments
0 comments
Please sign in to leave a comment.