version 1.1, 2007/01/10 18:01:11 |
version 1.4, 2007/03/20 23:56:29 |
|
|
#!/usr/bin/perl -T |
#!/usr/bin/perl -T |
# $RedRiver$ |
# $RedRiver: host2rrd,v 1.3 2007/03/20 22:40:20 andrew Exp $ |
######################################################################## |
######################################################################## |
# hostalias2filename *** figures out the filename for a wireless |
# hostalias2filename *** figures out the filename for a wireless |
# customer to pass to a script. |
# customer to pass to a script. |
|
|
|
|
my $basedir = '/var/www/wstationinfo'; |
my $basedir = '/var/www/wstationinfo'; |
my $Host; |
my $Host; |
|
my $Host_Suffix = ''; |
my $RRD; |
my $RRD; |
|
my $Host_To_Lower; |
|
|
#Option checking |
#Option checking |
my $status = GetOptions( |
my $status = GetOptions( |
"host|H=s" => \$Host, |
"host|H=s" => \$Host, |
"rrd|r=s" => \$RRD, |
"suffix|S=s" => \$Host_Suffix, |
|
"rrd|r=s" => \$RRD, |
|
"path|p=s" => \$basedir, |
|
"tolower|l" => \$Host_To_Lower, |
); |
); |
|
|
die "No host passes!" unless $Host |
|
|
die "No host passes!" unless $Host; |
die "No RRD passed!" unless $RRD; |
die "No RRD passed!" unless $RRD; |
|
|
|
if ($Host_To_Lower) { |
|
$Host = lc $Host; |
|
} |
|
|
|
|
my ($server, $client) = split /-/, $Host, 2; |
my ($server, $client) = split /-/, $Host, 2; |
|
|
my $filename = $basedir . '/' . $server . '/' . $Host. '-' . $RRD . '.rrd'; |
my $filename = $basedir . '/' . $Host . $Host_Suffix . $RRD . '.rrd'; |
|
|
|
if ($client) { |
|
$filename = $basedir . '/' . $server . '/' . $Host . $Host_Suffix . |
|
'-' . $RRD . '.rrd'; |
|
} |
|
|
print $filename, "\n"; |
print $filename, "\n"; |