#!/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_serverstatus>>>
# Online WritebackGlobal

def inventory_sansymphony_serverstatus(info):
    return [(None, None)]

def check_sansymphony_serverstatus(_no_item, _no_params, info):
    status, cachestate = info[0]
    if status == "Online" and cachestate == "WritebackGlobal":
        return 0, "SANsymphony is %s and its cache is in %s mode" % (status,cachestate)
    elif status == "Online" and cachestate != "WritebackGlobal":
        return 1, "SANsymphony is %s but its cache is in %s mode" % (status,cachestate)
    else:
        return 2, "SANsymphony is %s" % status

check_info['sansymphony_serverstatus'] = {
    "check_function"          : check_sansymphony_serverstatus,
    "inventory_function"      : inventory_sansymphony_serverstatus,
    "service_description"     : "sansymphony Serverstatus",
}
