[Check_mk (english)] check_mk local checks configuration

Sweta swetashah10 at gmail.com
Sat Feb 9 00:06:02 CET 2019


Hello,

I have installed check_mk server (from docker image) and have installed
chek_mk_agent for windows on my laptop. When I place a local check under
check_mk/local in form of .bat file, having command "whoami", and execute
this from local laptop as well as cmk -d <winhostname> from check_mk
server, both give me different output.

Output of whoami from windows laptop:
my user account
Output of whoami from check_mk server executing cmk -d:
nt authority\system

I guess this is the reason I am not able to run python programs as local
checks, since the PATH variable does not have Python in its path for nt
authority\system user but it is in PATH variable for my user account.

Would you have any idea on how to add python to PATH variable for nt
authority \ system account or how to get agen to run on my user account?

Thanks in advance and appreciate your inputs and time on this one!

Thanks,
Sweta

On Fri, Feb 8, 2019 at 1:35 PM Sweta <swetashah10 at gmail.com> wrote:

> Thank you Markus,
>
> I do have this line in check_mk.ini file which is placed in the same
> folder where check_mk_agent.exe exists. Still when I perform cmk -I
> <winhost> and cmk -d <winhost> - python file is not being executed.
>
> I have made sure that my path variable in windows has an entry for
> python.exe as well as have marked .py files to be executed with python by
> default. Do I need to do something else for check_mk agent to correctly
> execute python code?
>
> Also, when i do cmk -d - is there a location where check_mk stores
> standard error log?
>
> Thanks,
> Sweta
>
> On Fri, Feb 8, 2019 at 12:54 AM <Markus.Bloch at telekom.de> wrote:
>
>> Hi Sweta,
>>
>>
>>
>> if you want to change this in the windows agent, you must add following
>> to the check_mk.ini of the windows agent:
>>
>>
>>
>> [global]
>>
>>     # Execute only files with the following extensions
>>
>>     *execute = bat exe vbs ps1 **py*
>>
>>
>>
>> see: https://mathias-kettner.de/checkmk_windows.html Chapter 10
>> “Extending the windows agent”.
>>
>>
>>
>> Best Regards
>>
>>
>>
>> Markus
>>
>> *Von:* checkmk-en <checkmk-en-bounces at lists.mathias-kettner.de> *Im
>> Auftrag von *Sweta
>> *Gesendet:* Freitag, 8. Februar 2019 09:10 Uhr
>> *An:* Dr. Maik Götte <maik.goette at uni-kassel.de>
>> *Cc:* checkmk-en at lists.mathias-kettner.de
>> *Betreff:* Re: [Check_mk (english)] check_mk local checks configuration
>>
>>
>>
>> Thank you for your response Maik. I have successfully gotten local checks
>> to work in Linux with bash scripts and in Windows with batch scripts,
>> however wanted to do some parsing logic and hence wanted to directly
>> execute python/java code that outputs a single line as per local check
>> syntax.
>>
>>
>>
>> I read somewhere that I need to change check_mk.ini file under
>> check_mk_agent and edit global section to include execute = bat vbs py and
>> also have included python.exe in path variable in environment variables in
>> windows where the agent is running.
>>
>>
>>
>> Including this line in .ini file and doing inventory check does not
>> execute my python file.
>>
>>
>>
>> Would you know how to configure check mk local checks to execute python
>> file directly? Or is it recommended to use batch files only to give out
>> output to local check?
>>
>>
>>
>> Thanks in advance!
>>
>>
>>
>> Regards,
>>
>> Sweta
>>
>>
>>
>> On Thu, Feb 7, 2019 at 10:26 PM Dr. Maik Götte <maik.goette at uni-kassel.de>
>> wrote:
>>
>> Hey Sweta
>>
>> not sure, you're mixing things up here. Is it windows or linux you wanna
>> do a local check for?
>>
>> In windows visual basic, cmd-line and powershell scripts (.vbs, .cmd,
>> .bat, .ps1) should natively work fine for local checks; a properly
>> integrated python,perl, whatsover will probably work, too if paths are
>> properly set. This won't work out of the box, though.
>>
>> In linux bash, python, perl and probably any other stuff should work if
>> the script for the local check is correct.
>>
>> You just have to make sure that your output line is correct according to
>> the cmk howto.
>>
>> Regards,
>>
>> Maik
>>
>> Am 08.02.2019 um 00:17 schrieb Sweta:
>>
>> Hello,
>>
>>
>>
>> How can I configure check_mk_agent to directly execute python (py) files
>> and not bat or sh files?
>>
>>
>>
>> I read that this configuration should be done in check_mk .ini file, but
>> of agent or check_mk server? Sorry if question is very naive, would
>> appreciate if links to relevant documentation is given as I could not find
>> one..
>>
>>
>>
>> --
>>
>> Thanks & Regards,
>>
>> Sweta
>>
>>
>>
>> _______________________________________________
>>
>> checkmk-en mailing list
>>
>> checkmk-en at lists.mathias-kettner.de
>>
>> Manage your subscription or unsubscribe
>>
>> https://lists.mathias-kettner.de/cgi-bin/mailman/listinfo/checkmk-en
>>
>> _______________________________________________
>> checkmk-en mailing list
>> checkmk-en at lists.mathias-kettner.de
>> Manage your subscription or unsubscribe
>> https://lists.mathias-kettner.de/cgi-bin/mailman/listinfo/checkmk-en
>>
>> --
>>
>> Thanks & Regards,
>>
>> Sweta
>>
>
>
> --
> Thanks & Regards,
> Sweta
>


-- 
Thanks & Regards,
Sweta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mathias-kettner.de/pipermail/checkmk-en/attachments/20190208/44737d0c/attachment-0001.html>


More information about the checkmk-en mailing list