#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# |             ____ _               _        __  __ _  __           |
# |            / ___| |__   ___  ___| | __   |  \/  | |/ /           |
# |           | |   | '_ \ / _ \/ __| |/ /   | |\/| | ' /            |
# |           | |___| | | |  __/ (__|   <    | |  | | . \            |
# |            \____|_| |_|\___|\___|_|\_\___|_|  |_|_|\_\           |
# |                                                                  |
# | copyright mathias kettner 2013             mk@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.

# <<<sansymphony_virtualdiskstatus>>>
# testvmfs01 Online
# vmfs10 Online

def inventory_sansymphony_virtualdiskstatus(info):
   for line in info:
       yield line[0], None

def check_sansymphony_virtualdiskstatus(item, _no_params, info):
    for volname, vol_state in info:
	if volname == item:
            state = 2
            if vol_state == "Online":
                state = 0
            return state, "Volume state is: " + vol_state

check_info['sansymphony_virtualdiskstatus'] = {
    "check_function"          : check_sansymphony_virtualdiskstatus,
    "inventory_function"      : inventory_sansymphony_virtualdiskstatus,
    "service_description"     : "sansymphony Virtual Disk %s",
}
