Pnp4nagios, adding a datasource to a rrd file (not only for pnp4nagios)

Posted in Administration, LF, Linux by erralt on 14 janvier 2010


Pnp4nagios : is monitoring tool based on for the data storage and on PHP for the frontend.

This tool parses performance datas provided by Nagios probes. They follow this format : ‘data name’=value; (more details on this page :

I use Pnp4nagios and i got this error (in Disk.xml file by example) because of adding a new data in the output of a Nagios probe.

<TXT>expected 10 data source readings (got 14) from 1263470356:794:378:49</TXT>

Natively, Pnp4nagios cannot add new datasource on the fly, RRDTool does not do it too. So, i had to search for an useful tool.

I found this post on a blog ( which made me a bit happy.


I installed RRD::Simple with CPAN. I had to force the installation of it because of an error on the perlpod.

# cpan
cpan> force install RRD::Simple

I took the script provided on the post and modify it to fit to my needs :

/root/ :


use strict;
use warnings;

use RRD::Simple();

my $rrd_file = shift @ARGV;
my $DS_name = shift @ARGV;
my $DS_type = shift @ARGV;

my $rrd = RRD::Simple->new();

print "Processing $rrd_file...";
$rrd->add_source($rrd_file, $DS_name => $DS_type);
print " ok.\n";

I launched this command for each $DS_name i wanted (11, 12, 13 and 14) :

/root/ $rrd_file $DS_name GAUGE

Finally, it works fine !

I hope my post will be useful for other people, and i repeat it’s not specific to Pnp4nagios.


Une Réponse

Subscribe to comments with RSS.

  1. dgg74 said, on 29 août 2012 at 1:22

    Thank you very much, your post helped me save info for some RRD files for pnp4nagios.


Choisissez une méthode de connexion pour poster votre commentaire:


Vous commentez à l'aide de votre compte Déconnexion /  Changer )

Photo Google

Vous commentez à l'aide de votre compte Google. Déconnexion /  Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion /  Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion /  Changer )

Connexion à %s

%d blogueurs aiment cette page :