#!/usr/bin/perl -Tw
-# Copyright (C) 2006,2008,2009 Peter Palfrader <peter@palfrader.org>
+# Copyright (C) 2006,2008,2009,2016 Peter Palfrader <peter@palfrader.org>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
exit $UNKNOWN;
};
-my $sudo = $params->{'no-sudo'} ? '' : 'sudo ';
-my $command = "$sudo $TW_CLI info c$params->{'controller'} u$params->{'unit'} status";
+for my $thing (qw{controller unit}) {
+ if ($params->{$thing} =~ m/^([0-9]+)$/) {
+ $params->{$thing} = $1;
+ } else {
+ die("Invalid $thing $1.\n");
+ }
+};
+
+my @command;
+push @command, "sudo" if $params->{'no-sudo'};
+push @command, ($TW_CLI, 'info', "c$params->{'controller'}", "u$params->{'unit'}", "status");
+my $command = join(' ', @command);
print STDERR "Running $command\n" if $params->{'verbose'};
-open (TW, "$command|") or die ("Cannot run $command: $!\n");
+open (TW, "-|", @command) or die ("Cannot run $command: $!\n");
my @tw=<TW>;
close TW;
if ($CHILD_ERROR) { # program failed
* dsa-check-backuppg: allow specifying which timeline we expect a database
to be on.
* dsa-check-cert-expire-dir: add
+ * dsa-check-raid-3ware: modernize
[ Tollef Fog Heen ]
* dsa-update-unowned-file-status: ignore fdescfs, used for /dev/fd on
* Add dsa-check-hpssacli, replaces hpacucli for new hosts.
* dsa-check-hpssacli: accept 12.0Gbps as transfer speed for SAS
- -- Peter Palfrader <weasel@debian.org> Tue, 02 Feb 2016 07:58:55 +0100
+ -- Peter Palfrader <weasel@debian.org> Mon, 08 Feb 2016 10:03:28 +0100
dsa-nagios-checks (108) unstable; urgency=medium