undefine limits if they are not set
authorMichael Gernoth <michael@gernoth.net>
Wed, 10 Feb 2010 09:40:46 +0000 (10:40 +0100)
committerMichael Gernoth <michael@gernoth.net>
Wed, 10 Feb 2010 09:40:46 +0000 (10:40 +0100)
temperature.conf
upsgraph.pl

index c7e0ad4dda138ff7853185d86ab2708f1e6c6d0e..919507b5c54d6b48446d40950c7f3f0a1075e94b 100644 (file)
@@ -17,22 +17,16 @@ $hosts = [
                                'name' => 'Battery Temperature',
                                'oidtext' => 'PowerNet-MIB::upsAdvBatteryTemperature.0',
                                'oid' => '1.3.6.1.4.1.318.1.1.1.2.2.2.0',
-                               'min' => 'U',
-                               'max' => 'U',
                        },
                        'ambT' => {
                                'name' => 'Ambient Temperature',
                                'oidtext' => 'PowerNet-MIB::iemStatusProbeCurrentTemp.1',
                                'oid' => '1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1',
-                               'min' => 'U',
-                               'max' => 'U',
                        },
                        'ambH' => {
                                'name' => 'Ambient Humidity',
                                'oidtext' => 'PowerNet-MIB::iemStatusProbeCurrentHumid.1',
                                'oid' => '1.3.6.1.4.1.318.1.1.10.2.3.2.1.6.1',
-                               'min' => 'U',
-                               'max' => 'U',
                        },
                },
        },
@@ -49,8 +43,6 @@ $hosts = [
                                'name' => 'Battery Temperature',
                                'oidtext' => 'PowerNet-MIB::upsAdvBatteryTemperature.0',
                                'oid' => '1.3.6.1.4.1.318.1.1.1.2.2.2.0',
-                               'min' => 'U',
-                               'max' => 'U',
                        },
                }
        },
@@ -66,8 +58,6 @@ $hosts = [
                        'temp' => {
                                'name' => 'Internal Temperature',
                                'oid' => '1.3.6.1.4.1.9.9.13.1.3.1.3.1004',
-                               'min' => 'U',
-                               'max' => 'U',
                        },
                }
        },
@@ -83,8 +73,6 @@ $hosts = [
                        'temp' => {
                                'name' => 'Internal Temperature',
                                'oid' => '1.3.6.1.4.1.9.9.13.1.3.1.3.1004',
-                               'min' => 'U',
-                               'max' => 'U',
                        },
                }
        },
@@ -100,8 +88,6 @@ $hosts = [
                                'name' => 'Arbeitszimmer',
                                'port' => '31337',
                                'proto' => 'tcp',
-                               'min' => 'U',
-                               'max' => 'U',
                        },
                }
        },
index 82e0259fc1c0cd7cec6917f125a8ee7dce324582..c61b6c0bbad27d56004498dfa452571642fed401 100755 (executable)
@@ -107,6 +107,11 @@ if ($> == 0) {
 foreach my $host (@$hosts) {
        my $rrdfile = $host->{'rrdfile'};
 
+       foreach my $var (keys(%{$host->{'vars'}})) {
+               $host->{'vars'}->{$var}->{'min'} = 'U' if (!defined($host->{'vars'}->{$var}->{'min'}));
+               $host->{'vars'}->{$var}->{'max'} = 'U' if (!defined($host->{'vars'}->{$var}->{'max'}));
+       }
+
        if (-e "${rrdfile}") {
                print "Reading old ${rrdfile} to preserve data...\n";
 
Impressum, Datenschutz