Skip to content

Commit 29f290e

Browse files
committed
update deb package and plugins, fix xinetd package name
1 parent 3e5a82c commit 29f290e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3751
-728
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
# ansible-role-check-mk-agent [![Build Status](https://travis-ci.org/elnappo/ansible-role-check-mk-agent.svg?branch=master)](https://travis-ci.org/elnappo/ansible-role-check-mk-agent)
2-
Installs check mk agent. Run it with xinit or over ssh (default). Get more informations about check mk at [https://mathias-kettner.de/check_mk.html]()
2+
Installs check mk\_agent. Run it with xinetd or over SSH (default). Get more informations about check\_mk at [https://mathias-kettner.de/check_mk.html]()
33

44
## Requirements
5-
Only testet with Ubuntu and Debian, should run on more platforms.
5+
Only testet with Ubuntu 14.04 and 16.04, should run on more platforms.
6+
7+
## Install
8+
$ ansible-galaxy install elnappoo.check-mk-agent
69

710
## Role Variables
8-
* `check_mk_agent_deb_package: check-mk-agent_1.2.6p16-1_all.deb` Path to deb package
11+
* `check_mk_agent_deb_package: check-mk-agent_1.4.0p7-1_all.deb` Path to deb package
912
* `check_mk_agent_over_ssh: True`
1013
* `check_mk_agent_plugins_requirements: []` Requirements for extra plugins
1114
* `check_mk_agent_plugins: []` List of extra plugins to install
12-
* `check_mk_agent_pubkey_file:` Path to ssh pubkey file
15+
* `check_mk_agent_pubkey_file:` Path to SSH pubkey file
1316

1417
## Included check_mk extra plugins
1518
* apache\_status
@@ -72,3 +75,4 @@ MIT
7275
## Author Information
7376
7477
78+

defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
# defaults file for agent
3-
check_mk_agent_deb_package: check-mk-agent_1.2.6p16-1_all.deb
3+
check_mk_agent_deb_package: check-mk-agent_1.4.0p7-1_all.deb
44
check_mk_agent_over_ssh: True
55
check_mk_agent_plugins_requirements: []
66
check_mk_agent_plugins: []
-18.5 KB
Binary file not shown.
24 KB
Binary file not shown.

files/plugins/apache_status

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
2020
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
2121
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
22-
# ails. You should have received a copy of the GNU General Public
22+
# tails. You should have received a copy of the GNU General Public
2323
# License along with GNU Make; see the file COPYING. If not, write
2424
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
2525
# Boston, MA 02110-1301 USA.
@@ -63,9 +63,11 @@ ssl_ports = [ 443, ]
6363
if os.path.exists(config_file):
6464
execfile(config_file)
6565

66+
6667
def try_detect_servers():
6768
pids = []
6869
results = []
70+
6971
for line in os.popen('netstat -tlnp 2>/dev/null').readlines():
7072
parts = line.split()
7173
# Skip lines with wrong format
@@ -91,33 +93,38 @@ def try_detect_servers():
9193
continue
9294
pids.append(pid)
9395

94-
proto = 'http'
9596
address, port = parts[3].rsplit(':', 1)
9697
port = int(port)
9798

9899
# Use localhost when listening globally
99100
if address == '0.0.0.0':
100101
address = '127.0.0.1'
101102
elif address == '::':
102-
address = '::1'
103+
address = '[::1]'
104+
elif ':' in address:
105+
address = '[%s]' % address
103106

104107
# Switch protocol if port is SSL port. In case you use SSL on another
105108
# port you would have to change/extend the ssl_port list
106109
if port in ssl_ports:
107110
proto = 'https'
111+
else:
112+
proto = 'http'
108113

109114
results.append((proto, address, port))
110115

111116
return results
112117

118+
113119
if servers is None:
114120
servers = try_detect_servers()
115121

116122

117123
if not servers:
118124
sys.exit(0)
119125

120-
print '<<<apache_status>>>'
126+
127+
sys.stdout.write('<<<apache_status>>>\n')
121128
for server in servers:
122129
if isinstance(server, tuple):
123130
proto, address, port = server
@@ -128,17 +135,28 @@ for server in servers:
128135
port = server['port']
129136
page = server.get('page', 'server-status')
130137

138+
portspec = port and ":%d" % port or ""
139+
131140
try:
132-
url = '%s://%s:%s/%s?auto' % (proto, address, port, page)
141+
url = '%s://%s%s/%s?auto' % (proto, address, portspec, page)
133142
# Try to fetch the status page for each server
134143
try:
135144
request = urllib2.Request(url, headers={"Accept" : "text/plain"})
136145
fd = urllib2.urlopen(request)
137146
except urllib2.URLError, e:
138-
if 'SSL23_GET_SERVER_HELLO:unknown protocol' in str(e):
147+
if 'unknown protocol' in str(e):
139148
# HACK: workaround misconfigurations where port 443 is used for
140149
# serving non ssl secured http
141-
url = 'http://%s:%s/server-status?auto' % (address, port)
150+
url = 'http://%s%s/server-status?auto' % (address, portspec)
151+
fd = urllib2.urlopen(url)
152+
else:
153+
raise
154+
except Exception, e:
155+
if 'doesn\'t match' in str(e):
156+
# HACK: workaround if SSL port is found and localhost is using
157+
# SSL connections but certificate does not match
158+
portspec = ':80'
159+
url = 'http://%s%s/server-status?auto' % (address, portspec)
142160
fd = urllib2.urlopen(url)
143161
else:
144162
raise
@@ -147,11 +165,15 @@ for server in servers:
147165
if not line.strip():
148166
continue
149167
if line.lstrip()[0] == '<':
150-
# seems to be html output. Skip this server.
168+
# Seems to be html output. Skip this server.
151169
break
152-
print address, port, line
170+
171+
if ':' in address:
172+
sys.stdout.write("%s %s %s\n" % (address.lstrip('[').rstrip(']'), port, line))
173+
else:
174+
sys.stdout.write("%s %s %s\n" % (address, port, line))
153175
except urllib2.HTTPError, e:
154-
sys.stderr.write('HTTP-Error (%s:%d): %s %s\n' % (address, port, e.code, e))
176+
sys.stderr.write('HTTP-Error (%s%s): %s %s\n' % (address, portspec, e.code, e))
155177

156178
except Exception, e:
157-
sys.stderr.write('Exception (%s:%d): %s\n' % (address, port, e))
179+
sys.stderr.write('Exception (%s%s): %s\n' % (address, portspec, e))

files/plugins/asmcmd.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
# +------------------------------------------------------------------+
3+
# | ____ _ _ __ __ _ __ |
4+
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
5+
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
6+
# | | |___| | | | __/ (__| < | | | | . \ |
7+
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
8+
# | |
9+
# | Copyright Mathias Kettner 2014 [email protected] |
10+
# +------------------------------------------------------------------+
11+
#
12+
# This file is part of Check_MK.
13+
# The official homepage is at http://mathias-kettner.de/check_mk.
14+
#
15+
# check_mk is free software; you can redistribute it and/or modify it
16+
# under the terms of the GNU General Public License as published by
17+
# the Free Software Foundation in version 2. check_mk is distributed
18+
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
19+
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
20+
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
21+
# tails. You should have received a copy of the GNU General Public
22+
# License along with GNU Make; see the file COPYING. If not, write
23+
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
24+
# Boston, MA 02110-1301 USA.
25+
26+
su - griduser -c "asmcmd $@"

files/plugins/db2_mem

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
1919
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
2020
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
21-
# ails. You should have received a copy of the GNU General Public
21+
# tails. You should have received a copy of the GNU General Public
2222
# License along with GNU Make; see the file COPYING. If not, write
2323
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
2424
# Boston, MA 02110-1301 USA.

files/plugins/dnsclient

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
1919
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
2020
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
21-
# ails. You should have received a copy of the GNU General Public
21+
# tails. You should have received a copy of the GNU General Public
2222
# License along with GNU Make; see the file COPYING. If not, write
2323
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
2424
# Boston, MA 02110-1301 USA.

files/plugins/hpux_lunstats

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/ksh
2+
# Monitor status of LUNs on HP-UX
23
# +------------------------------------------------------------------+
34
# | ____ _ _ __ __ _ __ |
45
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
@@ -18,7 +19,7 @@
1819
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
1920
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
2021
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
21-
# ails. You should have received a copy of the GNU General Public
22+
# tails. You should have received a copy of the GNU General Public
2223
# License along with GNU Make; see the file COPYING. If not, write
2324
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
2425
# Boston, MA 02110-1301 USA.

files/plugins/hpux_statgrab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
1919
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
2020
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
21-
# ails. You should have received a copy of the GNU General Public
21+
# tails. You should have received a copy of the GNU General Public
2222
# License along with GNU Make; see the file COPYING. If not, write
2323
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
2424
# Boston, MA 02110-1301 USA.

0 commit comments

Comments
 (0)