I have created a custom local script to check kubernetes pods. However, i am now baffled as to why when i turn off a pod the local output displays correctly when i run the script locally or run the check_mk_agent command the correct warning is displayed. Here is an example:
2 cl5-jenkins-pods varname=2;crit Warning, pods are inconsistent on namespace cl5-jenkins
However, when i run this from the telnet output im getting that everything is ok still…
0 cl5-jenkins-pods varname=0;ok There are no missing pods on namespace cl5-jenkins
could anyone explain as to why this is happening? I thought maybe it was some permission issue but i dont think thats the reason!
It is a typical user rights problem. If you query the agent over telnet with what user is the agent running then? Your local test was not with the same user i think.
I think i have now found the issue. Basically in my script i output the commands to a temp file on the os. When i telnet the script it generates the file but does not populate it. I thought maybe this is a permission issue but ive modified the file to be written by any user and the telnet output still does not populate the temp file. Is there something else im missing here ? I also put full paths to the commands to make sure theres no issue with missing paths.
Maybe you’re using an environment variable in your script that’s not set when telnetting? Had a similar issue with the mysql check. The mysqladmin was not in the standard path so I had to modify the checkmk@.service to include the updated path.
I had an issue closely related to this. Problem was that my local script required an actual shell even though I was using subprocess with shell=True. I changed the script to build a kind of fake shell with environment variables that were required.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.