/[nagios-plugins-perl]/trunk/plugins/save-perfdata.pl
ViewVC logotype

Contents of /trunk/plugins/save-perfdata.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 121 - (show annotations) (download)
Thu Nov 12 13:29:04 2009 UTC (11 years ago) by racvision
File MIME type: text/plain
File size: 1417 byte(s)
convert source structure from autotools to rpm-build.sh
1 #!/usr/bin/perl -w
2 #
3 # (c) 2005 Stéphane Urbanovski <stephane.urbanovski@ac-nancy-metz.fr>
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty
12 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # you should have received a copy of the GNU General Public License
16 # along with this program (or with Netsaint); if not, write to the
17 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 # Boston, MA 02111-1307, USA
19 #
20 # $Id: save-perfdata.pl,v 1.1 2005-06-17 13:19:55 uid601 Exp $
21 use strict; # should never be differently :-)
22 use warnings;
23
24 my $DEBUG = 0;
25
26 my $spooldir = '/var/spool/nagios/perfs';
27
28 my ($host,$service,$data) = @ARGV;
29
30 $host =~ tr/ /_/;
31 $host =~ s/[^\w\.]//g;
32
33 $service =~ tr/ /_/;
34 $service =~ s/[^\w]//g;
35
36 my $file = "$spooldir/$host-$service-perfs.dat";
37
38 if ($DEBUG) {
39 open (FILE, ">>$spooldir/perfs.log" );
40 print FILE "host=[$host] - service=[$service] - data=[$data]\n" ;
41 close (FILE);
42 };
43
44 if ( $data !~ /^\d+\ \w+\ $/) {
45 open (FILE, ">$file" );
46 print FILE "$data\n";
47 close (FILE);
48 }

  ViewVC Help
Powered by ViewVC 1.1.8