Nagios XI - How To Delete A Data Source From An RRD File
This KB article explains how to remove a data source from an RRD file.
This article applies if you are seeing similar entries in the log file /usr/local/nagios/var/perfdata.log after enabling debug logging in /usr/local/nagios/etc/pnp/process_perfdata.cfg
2016-04-28 09:55:04   RRDs::update ERROR /usr/local/nagios/share/perfdata/10.25.6.51/CPU_Usage_for_VMHost.rrd:
You'll also observe that your performance graphs are no longer showing any data.
When a plugin returns performance data to Nagios, it can include more than one data source. A data source is a measurement unit that is used to generate graphs.
A plugin might return two data sources, like the following example:
ESX3 OK - cpu usage=1160.00 MHz (3.62%) | cpu_usagemhz=1160.00Mhz;; cpu_usage=3.62%;;
The first time that this data is received an RRD (round robin database) file is created to store the data for this service. When the RRD file is created, it is created based on the number of data sources that was received for this service.
If you decide later that you want to remove a data source because you don't need that data collected, for example:
The next time the background process runs, when it attempts to insert the data into the RRD file, it fails and is discarded because the RRD file expects that two data sources are received.
There are two possible solutions to fix this problem:
In the example below, we'll be deleting the data source cpu_usagemhz from the RRD file.
Compile Modify Script
You need to download and compile a script to be able to delete a data source from the RRD file.
Establish an SSH session to your Nagios XI server and type the following commands:
The next steps will continue in this SSH session.
Delete Data Source
Now it's time to delete the data source.
Before doing that, the following needs to be explained.
The first step is to identify the data source number that we want to delete. Type the following command:
grep -B 1 '<NAME>cpu_usagemhz' /usr/local/nagios/share/perfdata/10.25.6.51/CPU_Usage_for_VMHost.xml
This will output something like:
The number between the <DS></DS> tags is what we are after, in this example it is 1
IF that command returned NO output, you'll need to run this command:
rrdtool info /usr/local/nagios/share/perfdata/10.25.6.51/CPU_Usage_for_VMHost.rrd | grep 'last_ds'
This will output something like:
ds.last_ds = "1657.00"
You need to look at the values displayed and determine which is the one you want removed. Because in this example I am wanting to delete cpu_usagemhz it is clear that ds.last_ds = "1657.00" is the one that needs to be removed.
The number inside the ds square brackets is what we are after, in this example it is 1
These commands will run the modify script to create an updated file with the data source removed, then rename the old file and then implement the new file.
Once you have executed all of these commands, after about 15 minutes you will see the graphs in Nagios working correctly again.
For clarity, this command:
/tmp/rrd_modify.pl /usr/local/nagios/share/perfdata/10.25.6.51/CPU_Usage_for_VMHost.rrd delete 1
/tmp/rrd_modify.pl /usr/local/nagios/share/perfdata/HOSTNAME/SERVICENAME.rrd delete DATASOURCENUMBER
If you need to ADD a data source to an RRD file, please follow this KB article:
For any support related questions please visit the Nagios Support Forums at:
|Posted by: tlea - Wed, Apr 27, 2016 at 9:18 PM. This article has been viewed 4288 times.|
|Online URL: https://support.nagios.com/kb/article/nagios-xi-how-to-delete-a-data-source-from-an-rrd-file-497.html|
Powered by PHPKB (Knowledge Base Software)