[Nagiosplug-devel] regarding RRD, MRTG, xpdfile

Radu Duta rduta at syskey.com
Fri Apr 25 07:44:04 CEST 2003


On Fri, Apr 25, 2003 at 08:23:14AM +0200, BOLLENGIER Eric wrote:
> Hi,
> 
> > I wanted to use --with-file-perfdata to log, and have a process load the data from
> > the file every say 10 minutes, and then roll/delete the file.  If the file is never closed
> > than it is impossible to roll the file without restarting nagios.  
> 
> You can do something like
> [root at nagios log]# > srvperf.log
> 
> or on perl planet
> 
>     open(FP, ">$log") ;
>     close(FP) ;

I don't get it.  what do you mean?  Seems like you are writing to a file? and then closing it?

I was refering to:

nagios.cfg:xpdfile_service_perfdata_file=/opt/nagios/var/hostperf.log 

With this configuration rolling the file /opt/nagios/var/hostperf.log implies:

1) mv /opt/nagios/var/hostperf.log /opt/nagios/var/hostperf.log.roll
2) /etc/rc.d/init.d/nagios restart

 
> > I don't think it's for performance, especially considering that checks are done by forks and 
> > adding one more 2-3 more function calls should be pretty modest.
> 
> Hier, i don't agree with you... if you have 2000 services...

Here are some stats for a 551MHz Intell box:

#include <stdio.h>
main() {
    FILE    *xpdfile_host_perfdata_fp=NULL;
    char    *xpdfile_host_perfdata_file="out.txt";
    int     i;

    for (i=0; i< 1000000; i++){
      xpdfile_host_perfdata_fp = fopen (xpdfile_host_perfdata_file,"a");
      fputs(".\n", xpdfile_host_perfdata_fp);
      fflush(xpdfile_host_perfdata_fp);
      fclose(xpdfile_host_perfdata_fp);
    }
}

# time ./a.out                                                                                                                          rduta at vax:~/projects/misc/C
./a.out  14.59s user 25.63s system 88% cpu 45.257 total

so your 2000 services would be an added 0.1 seconds ( 2000 * (45.3/1000000) ) to the processing time.

> > Is there a better way?  maybe this should be part of the plugin? after all RTT and loss are
> > specific to that one plugin.  Though now that I think about it RTT is really a function of
> > every network plugin, just not may of them take advantage of it.
> 
> I have a perl script which read nagios cfg, get 
> xpdfile_service_perfdata_file and generate rrd command
> (use | var=val and support nsclient check_disk and check_cpu)

how do you roll the xpdfile_service_perfdata_file file?  The file obviously grows, and pretty quickly,
so at some point you have to roll it, or delete it if you have all of it into RRD right?

I guess some people do this once a week/day/month, but then your rrd tables only get updated once
a week/day/month, and you loose the benefit of realtime.


> > anybody working on adding RRD support to nagios?  seems like a pretty useful data to have
> > and keep since it can directly pinpoint networking/systems problems.


the thing to do really is to create a xpdrrd_service_perfdata module that writes straight to the rrdfile
but the problem is that the return values from the plugin are not standardized ie fping returns data
in a different format then ping. (sigh)

-- 
Radu Duta  <rduta at syskey.com>




More information about the Devel mailing list