Commit 0708ba7b authored by Alasdair Keyes's avatar Alasdair Keyes

Handle the udpated iostat Device column name between versions

parent a1cf94f1
......@@ -2,7 +2,7 @@
## (C) Alasdair Keyes
### http://gitlab.com/alasdairkeyes/nagios-plugin-check_disk_io
### Version 0.13
### Version 0.14
### Released under GPL V2
### http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
##
......@@ -12,6 +12,7 @@
### Nagios to errors more clearly
### 0.13 :: 2015-11-14 Sort devices into alphabetical order when
### showing results
### 0.14 :: 2019-07-15 Handle the updated iostat Device column name
use strict;
use warnings;
......@@ -78,7 +79,7 @@ my $util_index = undef;
my $started = 0;
foreach my $line (split(/\n/,$iostat_total)) {
if ($line =~ /^Device:/) {
if ($line =~ /^Device:?\b/) {
$started++;
$util_index = get_util_percent_index($line);
} elsif ($started) {
......@@ -102,7 +103,7 @@ fin("CRITICAL", "Failed to execute iostat ($?): $!")
$started = 0;
foreach my $line (split(/\n/,$iostat_recent)) {
if ($line =~ /^Device:/) {
if ($line =~ /^Device:?\b/) {
$started++;
} elsif ($started == 2) {
my @device_info = split(/\s+/,$line);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment