Git Product home page Git Product logo

checkmk_windows_scheduled_task's People

Contributors

jiuka avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

mbr2021 7meis

checkmk_windows_scheduled_task's Issues

ValueError (Cannot render negative timespan) - When check is performed while task is running?!?

Release v2.2 on 2.0.0p7

Exception:
ValueError (Cannot render negative timespan)

Traceback:
File "/omd/sites/mysite/lib/python3/cmk/base/checking.py", line 582, in get_aggregated_result
result = _aggregate_results(check_function(**kwargs))
File "/omd/sites/mysite/lib/python3/cmk/base/checking.py", line 813, in _aggregate_results
perfdata, results = _consume_and_dispatch_result_types(subresults)
File "/omd/sites/mysite/lib/python3/cmk/base/checking.py", line 857, in _consume_and_dispatch_result_types
for subr in subresults:
File "/omd/sites/mysite/lib/python3/cmk/base/api/agent_based/register/check_plugins.py", line 89, in filtered_generator
for element in generator(*args, **kwargs):
File "/omd/sites/mysite/local/lib/python3/cmk/base/plugins/agent_based/win_scheduled_task.py", line 101, in check_win_scheduled_task
yield from check_levels(
File "/omd/sites/mysite/lib/python3/cmk/base/api/agent_based/utils.py", line 329, in check_levels
info_text = str(render_func(value)) # forgive wrong output type
File "/omd/sites/mysite/lib/python3/cmk/base/api/agent_based/render.py", line 82, in timespan
ts = " ".join(_gen_timespan_chunks(float(seconds), nchunks=2))
File "/omd/sites/mysite/lib/python3/cmk/base/api/agent_based/render.py", line 63, in _gen_timespan_chunks
raise ValueError("Cannot render negative timespan")

Local Variables:
{'nchunks': 2, 'seconds': -18.4868}

Parameters:
("Parameters({'else': 2,\n"
" 'maxage': (604800, 2678400),\n"
" 'states': {-2147750687: 1,\n"
' -2147216609: 1,\n'
' 0: 0,\n'
' 1: 1,\n'
' 267009: 0,\n'
' 267011: 1,\n'
' 267014: 1,\n'
' 267045: 1,\n'
' 2147946720: 1},\n'
" 'tasks': ['\\mysite\\mytask\\mytask check']})")

Excerpt of Agent output:
n\User_Feed_Synchronization-{A4750F4A-2EF7-4D08-9A5C-E1744D5DBC71}\t0\t03/29/2021 01:19:19\t07/15/2021 07:53:53\n\mysite\mytask\mytask check\t0\t07/14/2021 11:30:30\t07/14/2021 11:45:45\n\mysite\move SFTPLogs\t0\t07/14/2021 01:00:00\t07/15/2021

This leads to an UNKNOWN-State.

I observed a similar error when timezones on the monitoring server and monitored server are not the same. In that case a few hours later (in my case two hours) the check can be performed without crashing and the state goes back to OK. In that case using the same timezones removed the errors.

After I fixed the timezones the error still occures but a little bit different. It seems as if the real cause is that the check is performed while the task is running. Other tasks on the same server don't enter this state with the same check but enter this state at different times. The task from this example is configured to run every 15 minutes but it doesn't crash every time. The next time the check is running everything is fine again. But in this way I get a few error/recovery messages per hour which is annoying. Clocks of the monitoring server and monitored server seem to be running in sync (by the second).

Setting values for parameter "Maximal time since last run" seems to be mandatory

Release v2.1: If no values for "Maximal time since last run" are set in a given rule the check returns an error.

Exception:
<AttributeError ('list' object has no attribute 'get')>

Traceback:
<File "/omd/sites/mysite/lib/python3/cmk/base/checking.py", line 577, in get_aggregated_result result = _aggregate_results(check_function(**kwargs)) File "/omd/sites/mysite/lib/python3/cmk/base/checking.py", line 808, in _aggregate_results perfdata, results = _consume_and_dispatch_result_types(subresults) File "/omd/sites/mysite/lib/python3/cmk/base/checking.py", line 852, in _consume_and_dispatch_result_types for subr in subresults: File "/omd/sites/mysite/lib/python3/cmk/base/api/agent_based/register/check_plugins.py", line 89, in filtered_generator for element in generator(*args, **kwargs): File "/omd/sites/mysite/local/lib/python3/cmk/base/plugins/agent_based/win_scheduled_task.py", line 88, in check_win_scheduled_task state = State(params['states'].get(task['lastResult'], params.get('else', 2)))>

This seems to be new or a new option with version 2.1. It took me some time to find out that the cause was that simple so it might be changed or at least the information is helpful to someone updating from an earlier version of this plugin.

Question/request: Would it be possible to create a check that can restart Windows Services

I've seen multiple people online asking about this and haven't found "the one" solution yet. Hopefully you can help!

Idea:

  • Create a new check / use an existing check for checking the status of a Windows service
  • If the service is a required service and it is stopped, try to start the service

Getting the status
This, in theory, could be a bash script that will run on the CheckMK server and executes the following command:

#!/bin/bash
# Getting the status
net rpc service list NAMEOFSERVICE -S HOSTNAME.DOMAIN.LOCAL -U DOMAIN.LOCAL/Username%Password

Starting the service

I believe that restarting the service could be triggered using Alert Handlers, but I'm not sure if that is supported.

The Alert Handler could be a bash script that will run on the CheckMK server and executes the following command:

#!/bin/bash
# Starting of services
net rpc service start NAMEOFSERVICE -S HOSTNAME.DOMAIN.LOCAL -U DOMAIN.LOCAL/Username%Password

Requirements
samba-common package installed on the CheckMK server.
Firewall rule added to allow RPC
New-NetFirewallRule -DisplayName 'RPC (CheckMK)' -Description 'Required for checking and restarting services' -Profile Domain,Private,Public -Direction Inbound -Action Allow -EdgeTraversalPolicy Block -Protocol 'TCP' -LocalPort 'RPC'

If you know a different way to achieve this feel free to share idea's. I'm available for development, testing and documenting.

Sorry if this is not the right place for this request.

Support of checkMK version 2.2 not clear

Dear jiuka,

we are using your extensionpackage win_scheduled_task v2.2 in our Distributed Installation (1 Master site and 9 Subsites) of checkMK.

I've updated our Distributed Installation from version 2.1.0p28 to 2.2.0p3. During the checkMK update a message came up that the win_scheduled_task package is not supported under checkMK v2.2.0. In the extension manager the package entry shows that wwin_scheduled_task 2.2 supports all checkMK version from 2.0.0 until 2.1.0.

Have you planned to create a new version of win_scheduled_task which supports the newer checkMK versions? Will it be relleases in the checkMK exchange area or here in Github?

Thank you in advance
Ronald Kloust

[email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.