Skip to content
Permalink
Browse files

#0197 check_uniserv: New Check for Uniserv Data Management Services

This check uses a tcp connect to monitor the Uniserv Service.
Uniserv ( http://www.uniserv.com/ ) is a Data Management Service who offers
diffrent services like Address Checks, Banking Data Checks etc.
  • Loading branch information
Bastian-Kuhn committed Aug 5, 2014
1 parent c67f0be commit 478842395b5586c1e6ccee40c51bea0e3dcfce46
Showing with 198 additions and 0 deletions.
  1. +13 −0 .werks/197
  2. +1 −0 ChangeLog
  3. +16 −0 checkman/check_uniserv
  4. +63 −0 checks/check_uniserv
  5. +67 −0 doc/treasures/active_checks/check_uniserv
  6. +38 −0 web/plugins/wato/active_checks.py
@@ -0,0 +1,13 @@
Title: check_uniserv: New Check for Uniserv Data Management Services
Level: 1
Component: checks
Compatible: compat
Version: 1.2.5i6
Date: 1407239445
Class: feature

This check uses a tcp connect to monitor the Uniserv Service.
Uniserv ( http://www.uniserv.com/ ) is a Data Management Service who offers
diffrent services like Address Checks, Banking Data Checks etc.


@@ -9,6 +9,7 @@
* 0193 docsis_cm_status: New Check Status Check for Cable Modems with Docsis MIB.
* 1070 printer_input/printer_output: New checks to monitor input/output sub-units of printers...
* 0196 esx_vsphere_hostsystem: New subcheck for maintenance mode...
* 0197 check_uniserv: New Check for Uniserv Data Management Services...
* 1051 FIX: tcp_conn_stats: fix missing performance data...
* 1142 FIX: winperf_ts_sessions: fix computation, check has never really worked
* 1090 FIX: zfsget: fixed exception which happened on incomplete zfs entries
@@ -0,0 +1,16 @@
title: Uniserv Service
agents: active
catalog: agentless
license: GPL
distribution: check_mk
description:
This check uses a tcp connect to monitor the Uniserv Service.
Uniserv ( http://www.uniserv.com/ ) is a Data Management Service who offers
diffrent services like Address Checks, Banking Data Checks etc.

Whith this active check it is possible to querie one address and the response from
uniserv against a regex, or you can simply try to receive the version number from uniserv to make
sure that the service is reachable.

This check can be configured by Wato.

@@ -0,0 +1,63 @@
#!/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.

def check_uniserv_arguments(params):
args = " $HOSTADDRESS$"
args += " " + str(params['port'])
args += " " + quote_shell_string(params['service'])
if type(params['job']) == tuple:
job = params['job'][0]
else:
job = params['job']
if job == "version":
args += " VERSION"
else:
address = params['job'][1]
args += " ADDRESS"
args += " " + quote_shell_string(address['street'])
args += " " + str(address['street_no'])
args += " " + quote_shell_string(address['city'])
args += " " + quote_shell_string(address['search_regex'])

return args

def check_uniserv_desc(params):
if type(params['job']) == tuple:
job = params['job'][0]
else:
job = params['job']
if job == "version":
return "Version"
else:
return "Address " + params['job'][1]['city']


active_check_info['uniserv'] = {
"command_line" : '$USER1$/check_uniserv $ARG1$',
"argument_function" : check_uniserv_arguments,
"service_description" : check_uniserv_desc,
}

@@ -0,0 +1,67 @@
#!/usr/bin/python
import socket, sys
BUFFER_SIZE = 1024
try:
HOST = sys.argv[1]
TCP_PORT = int(sys.argv[2])
SERVICE = sys.argv[3]
JOB = sys.argv[4]
if JOB == "ADDRESS":
STREET = sys.argv[5]
STREET_NR = sys.argv[6]
CITY = sys.argv[7]
REGEX = sys.argv[8]
except:
print " Usage: client_uniserv.py HOSTNAME PORT SERVICE (VERSION|ADDRESS STREET NR CITY SEARCH_REGEX) "
sys.exit(3)

def parse_response(data):
info = dict([ x.split('=') for x in data.split(";") ][:-1])
if info['type'] == '1':
print "Invalid response: " % str(info)
sys.exit(3)
return info

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, TCP_PORT))

sendstring = "open:service="+SERVICE+";servicehost="+HOST+"\n"
s.send(sendstring)

data = parse_response(s.recv(BUFFER_SIZE))
if not data.get('session'):
print "Error getting SID. Response was: " + str(data)
sys.exit(3)
sid = data.get('session')

if JOB == "VERSION":
sendstring = "version:session="+sid+"\n"
s.send(sendstring)
data = parse_response(s.recv(BUFFER_SIZE))
state = 0
infotext = "Version is " + data['version_str']
elif JOB == "ADDRESS":
import re
sendstring = "exec:session=%s;request_type=check_address;in_str=%s;in_hno=%s;in_city=%s\n" % \
( sid, STREET, STREET_NR, CITY )
s.send(sendstring)
data = parse_response(s.recv(BUFFER_SIZE))

sendstring = "fetch:session="+sid+";out_zip=?;out_city=?\n"
s.send(sendstring)
data = parse_response(s.recv(BUFFER_SIZE))

state = 0
infotext = "Address is %s %s" % ( data['out_zip'], data['out_city'])
if not re.match( REGEX, data['out_city']):
infotext += " But excpects %s" % REGEX
state = 2
else:
state = 3
infotext = "JOB not known"

s.send("close:session="+sid+"\n")
s.close()

print infotext
sys.exit(state)
@@ -475,6 +475,44 @@
match = 'all'
)

register_rule(group,
"active_checks:uniserv", Dictionary(
title = _("Check uniserv service"), optional_keys = False, elements = [
("port",
Integer( title = _("Port") )),
("service",
TextAscii( title = _("Service String"),
help = _("Enter here the uniserve service name. (Has nothting to do with service description)")
)),
("job",
CascadingDropdown(
title = _("Mode of the Check"),
help = _("Choose if you just want to query the version number,"
" or if you want to check the response to a address querie"),
choices = [
("version", _("Check for Version")),
("address", _("Check for a Address"),
Dictionary(
title = _("Address Check mode"),
optional_keys = False,
elements = [
( "street",
TextAscii( title = _("Street name"))),
( "street_no",
Integer( title = _("Street number"))),
( "city",
TextAscii( title = _("City name"))),
( "search_regex",
TextAscii( title = _("Check City against Regex"),
help = _( "The City name from the response will be checked against "
"the regular expression specified here"),
)),
]
)),
]
)),

]))

register_rule(group,
"active_checks:http",

0 comments on commit 4788423

Please sign in to comment.
You can’t perform that action at this time.