Discussion:
[Check_mk (english)] Possible to run checks in parallel?
Lars Falk-Petersen
2018-10-25 11:16:26 UTC
Permalink
Hi

I have written a plugin that lists out all websites on a host, and does web checks on them (http status, SSL, string check, robots.txt).

On servers with hundreds of hosts this takes too much time to do serially. Is it possible to do this in parallel? As I understand it, "def check_pluginname(item, params, info)" is run separately each time, thus there is no possibility for me to do a lot of checks at the same time.

A short test with incomplete code that shows this:

Code:

def check_webchecks(item, params, info):
timeout, ssl_crit, ssl_warn, proxies = params
print ("check_webchecks")
for line in info:
if line[0] == item:
print(item)
url = line[0]

return check_http(url, strchk=string, status=status, \
timeout=timeout, ssl_crit=ssl_crit, ssl_warn=ssl_warn, proxies=proxies)

Result:

OMD[test]:~$ cmk --debug -v --checks=webchecks web
Check_MK version 1.5.0p7
+ FETCHING DATA
[agent] Execute data source
[piggyback] Execute data source
check_webchecks
http://10.223.68.186/
webchecks http://10.223.68.186/ OK - URL resolves to correct host. http://10.223.68.186/ HTTP OK 200 (0.0s). String <Map> found. Robots file missing. (total check time 0.01s)
check_webchecks
http://web.lxd/
webchecks http://web.lxd/ OK - URL resolves to correct host. http://web.lxd/ HTTP OK 200 (0.0s). Robots file missing. (total check time 0.01s)
OK - [agent] Version: 1.2.8p16, OS: linux, execution time 0.2 sec | execution_time=0.247 user_time=0.020 system_time=0.010 children_user_time=0.000 children_system_time=0.000 cmk_time_agent=0.213


The repeating "check_webchecks" in output shows the function is being called for each url I'm checking.
--
Lars
Loading...