diff options
author | Niko Tyni <ntyni@iki.fi> | 2005-09-04 13:34:08 +0200 |
---|---|---|
committer | Niko Tyni <ntyni@iki.fi> | 2005-09-04 13:34:08 +0200 |
commit | 3946df708ae20686c8453eb55be934103daf2f7e (patch) | |
tree | 68e64811e0f13e97ddd3f5b399ea78bfe964e9bb /lib/Smokeping.pm | |
parent | 733f5ee3d4aad0c1a21d796d5a36baa82389e199 (diff) | |
download | smokeping-3946df708ae20686c8453eb55be934103daf2f7e.tar.gz smokeping-3946df708ae20686c8453eb55be934103daf2f7e.tar.xz |
* lib/Smokeping.pm,
lib/Smokeping/probes/base.pm,
doc/smokeping_upgrade.pod,
TODO,
CHANGES:
+ the DYNAMIC-related files (.adr and .snmp) can now be located outside "datadir"
by specifying the new configuration variable "dyndir"
Diffstat (limited to 'lib/Smokeping.pm')
-rw-r--r-- | lib/Smokeping.pm | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm index 18415f4..a14699f 100644 --- a/lib/Smokeping.pm +++ b/lib/Smokeping.pm @@ -110,6 +110,11 @@ sub lnk ($$) { } } +sub dyndir ($) { + my $cfg = shift; + return $cfg->{General}{dyndir} || $cfg->{General}{datadir}; +} + sub update_dynaddr ($$){ my $cfg = shift; my $q = shift; @@ -125,7 +130,12 @@ sub update_dynaddr ($$){ return "Error: Invalid target or secret" unless defined $targetptr->{host} and $targetptr->{host} eq "DYNAMIC/${secret}"; - my $file = $cfg->{General}{datadir}."/".(join "/", @target); + my $file = dyndir($cfg); + for (0..$#target-1) { + $file .= "/" . $target[$_]; + ( -d $file ) || mkdir $file, 0755; + } + $file.= "/" . $target[-1]; my $prevaddress = "?"; my $snmp = snmpget_ident $address; if (-r "$file.adr" and not -z "$file.adr"){ @@ -852,7 +862,7 @@ sub get_detail ($$$$){ ); # if we have uptime draw a colorful background or the graph showing the uptime - my $cdir=$cfg->{General}{datadir}."/".(join "/", @dirs)."/"; + my $cdir=dyndir($cfg)."/".(join "/", @dirs)."/"; if (-f "$cdir/${file}.adr") { @upsmoke = (); @upargs = ("COMMENT:Link Up${BS}: ", @@ -1567,7 +1577,7 @@ DOC General configuration values valid for the whole SmokePing setup. DOC _vars => - [ qw(owner imgcache imgurl datadir pagedir piddir sendmail offset + [ qw(owner imgcache imgurl datadir dyndir pagedir piddir sendmail offset smokemail cgiurl mailhost contact netsnpp syslogfacility syslogpriority concurrentprobes changeprocessnames tmail) ], _mandatory => @@ -1637,7 +1647,16 @@ DOC The directory where SmokePing can keep its rrd files. DOC }, + dyndir => + { + %$DIRCHECK_SUB, + _doc => <<DOC, +The base directory where SmokePing keeps the files related to the DYNAMIC function. +This directory must be writeable by the WWW server. +If this variable is not specified, the value of C<datadir> will be used instead. +DOC + }, piddir => { %$DIRCHECK_SUB, |