File: [local] / nagios / check_rrd / bin / host2rrd (download)
Revision 1.3, Tue Mar 20 22:40:20 2007 UTC (17 years, 6 months ago) by andrew
Branch: MAIN
Changes since 1.2: +14 -4 lines
more options I needed for additional features
|
#!/usr/bin/perl -T
# $RedRiver: host2rrd,v 1.2 2007/01/10 18:05:31 andrew Exp $
########################################################################
# hostalias2filename *** figures out the filename for a wireless
# customer to pass to a script.
#
# 2007.01.10 #*#*# andrew fresh <andrew@mad-techies.org>
########################################################################
use strict;
use warnings;
use Data::Dumper;
%ENV = ();
use Getopt::Long;
my $basedir = '/var/www/wstationinfo';
my $Host;
my $Host_Suffix = '';
my $RRD;
#Option checking
my $status = GetOptions(
"host|H=s" => \$Host,
"suffix|S=s" => \$Host_Suffix,
"rrd|r=s" => \$RRD,
"path|p=s" => \$basedir,
);
die "No host passes!" unless $Host;
die "No RRD passed!" unless $RRD;
my ($server, $client) = split /-/, $Host, 2;
my $filename = $basedir . '/' . $Host . $Host_Suffix . $RRD . '.rrd';
if ($client) {
$filename = $basedir . '/' . $server . '/' . $Host . $Host_Suffix .
'-' . $RRD . '.rrd';
}
print $filename, "\n";