[BACK]Return to host2rrd CVS log [TXT][DIR] Up to [local] / nagios / check_rrd / bin

Annotation of nagios/check_rrd/bin/host2rrd, Revision 1.3

1.1       andrew      1: #!/usr/bin/perl -T
1.3     ! andrew      2: # $RedRiver: host2rrd,v 1.2 2007/01/10 18:05:31 andrew Exp $
1.1       andrew      3: ########################################################################
                      4: # hostalias2filename *** figures out the filename for a wireless
                      5: #                        customer to pass to a script.
                      6: #
                      7: # 2007.01.10 #*#*# andrew fresh <andrew@mad-techies.org>
                      8: ########################################################################
                      9: use strict;
                     10: use warnings;
                     11:
                     12: use Data::Dumper;
                     13:
                     14: %ENV = ();
                     15:
                     16: use Getopt::Long;
                     17:
                     18: my $basedir = '/var/www/wstationinfo';
                     19: my $Host;
1.3     ! andrew     20: my $Host_Suffix = '';
1.1       andrew     21: my $RRD;
                     22:
                     23: #Option checking
                     24: my $status = GetOptions(
1.3     ! andrew     25:     "host|H=s"   => \$Host,
        !            26:     "suffix|S=s" => \$Host_Suffix,
        !            27:     "rrd|r=s"    => \$RRD,
        !            28:     "path|p=s"   => \$basedir,
1.1       andrew     29: );
                     30:
1.3     ! andrew     31:
1.2       andrew     32: die "No host passes!" unless $Host;
1.1       andrew     33: die "No RRD passed!"  unless $RRD;
                     34:
1.3     ! andrew     35:
1.1       andrew     36: my ($server, $client) = split /-/, $Host, 2;
                     37:
1.3     ! andrew     38: my $filename = $basedir . '/' . $Host . $Host_Suffix . $RRD . '.rrd';
        !            39:
        !            40: if ($client) {
        !            41:     $filename = $basedir . '/' . $server . '/' . $Host . $Host_Suffix .
        !            42:         '-' . $RRD . '.rrd';
        !            43: }
1.1       andrew     44:
                     45: print $filename, "\n";

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>