summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-01-28 07:17:24 (GMT)
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-01-28 07:17:24 (GMT)
commitdbad749293f31ccb3af226d30b664c1c5f9b1458 (patch)
tree93511f6bd40dab27bc722d584ff368e01467afbf /contrib
parent9452b46d955a3e99837214c77ad48dae4a7bf7cd (diff)
downloadmonitoring-plugins-dbad749293f31ccb3af226d30b664c1c5f9b1458.tar.gz
split and validate input more robustly
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@257 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'contrib')
-rw-r--r--contrib/checkciscotemp.pl19
1 files changed, 11 insertions, 8 deletions
diff --git a/contrib/checkciscotemp.pl b/contrib/checkciscotemp.pl
index a702a89..c999e19 100644
--- a/contrib/checkciscotemp.pl
+++ b/contrib/checkciscotemp.pl
@@ -30,7 +30,7 @@
30# (in accordance with the plugin coding guidelines) 30# (in accordance with the plugin coding guidelines)
31#################################### 31####################################
32 32
33use Net::SNMP; 33#use Net::SNMP;
34use Getopt::Long; 34use Getopt::Long;
35&Getopt::Long::config('auto_abbrev'); 35&Getopt::Long::config('auto_abbrev');
36 36
@@ -81,16 +81,19 @@ unless (defined($hostname)) {
81} 81}
82 82
83if (defined($critical_vals)) { 83if (defined($critical_vals)) {
84 die "Cannot Parse Critical Thresholds\n" 84 if ($critical_vals =~ m/^([0-9]+)[,:]([0-9]+)$/) {
85 unless (split(/:/,$critical_vals)>=2); 85 ($inlet_thresh,$outlet_thresh) = ($1, $2);
86 ($inlet_thresh,$outlet_thresh) = @_ 86 } else {
87 die "Cannot Parse Critical Thresholds\n";
88 }
87} 89}
88die unless(defined($inlet_thresh) && defined($outlet_thresh));
89 90
90if (defined($warning_vals)) { 91if (defined($warning_vals)) {
91 die "Cannot Parse Critical Thresholds\n" 92 if ($warning_vals =~ m/^([0-9]+)[:,]([0-9]+)$/) {
92 unless (split(/:/,$warning_vals)>=2); 93 ($inlet_warn,$outlet_warn) = ($1, $2);
93 ($inlet_warn,$outlet_warn) = @_; 94 } else {
95 die "Cannot Parse Warning Thresholds\n";
96 }
94}else{ 97}else{
95 $inlet_warn=$inlet_thresh; 98 $inlet_warn=$inlet_thresh;
96 $outlet_warn=$outlet_thresh; 99 $outlet_warn=$outlet_thresh;