Module: check_mk
Branch: master
Commit: 840785f476704aaeceb6d090080d0973e28ef3d9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=840785f476704a…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jun 23 11:50:18 2011 +0200
vbox_guest: handle case where VBoxControl fails
---
agents/check_mk_agent.linux | 1 +
checks/vbox_guest | 28 ++--------------------------
2 files changed, 3 insertions(+), 26 deletions(-)
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index a0777e5..d11c237 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -291,6 +291,7 @@ fi
echo '<<<vbox_guest>>>'
if which VBoxControl > /dev/null 2>&1 ; then
VBoxControl -nologo guestproperty enumerate | cut -d, -f1,2
+ [ ${PIPESTATUS[0]} = 0 ] || echo "ERROR"
fi
diff --git a/checks/vbox_guest b/checks/vbox_guest
index 065522e..5fbcd19 100644
--- a/checks/vbox_guest
+++ b/checks/vbox_guest
@@ -1,35 +1,11 @@
#!/usr/bin/python
-# -*- encoding: utf-8; py-indent-offset: 4 -*-
-# +------------------------------------------------------------------+
-# | ____ _ _ __ __ _ __ |
-# | / ___| |__ ___ ___| | __ | \/ | |/ / |
-# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
-# | | |___| | | | __/ (__| < | | | | . \ |
-# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
-# | |
-# | Copyright Mathias Kettner 2010 mk(a)mathias-kettner.de |
-# +------------------------------------------------------------------+
-#
-# This file is part of Check_MK.
-# The official homepage is at
http://mathias-kettner.de/check_mk.
-#
-# check_mk is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation in version 2. check_mk is distributed
-# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
-# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE. See the GNU General Public License for more de-
-# ails. You should have received a copy of the GNU General Public
-# License along with GNU Make; see the file COPYING. If not, write
-# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-# Boston, MA 02110-1301 USA.
-
-#!/usr/bin/python
def vbox_guest_make_dict(info):
return dict([(l[1].split('/',2)[2].rstrip(','), l[3]) for l in
info])
def check_vbox_guest(item, _no_params, info):
+ if len(info) == 1 and info[0][0] == "ERROR":
+ return (3, "UNKNOWN - Error running VBoxControl guestproperty
enumerate")
try:
d = vbox_guest_make_dict(info)
except: