Is it possible to remove the cache information of a local check?

Good afternoon.

I made a very simple local check to see if security updates are required on linux hosts and gave it a 10 minute interval between checks.

In the official documentation,

it is stated that:
“They will then only be executed according to a defined interval, buffered, and then this cache will be appended to the agent’s output.”

Is it possible to remove this information from the output?

Thank you.

You can touch -d 1970-01-01 the cache file in /var/lib/check_mk_agent/cache if you want to trigger the execution of the plugin.

Which Linux distribution? Debian/Ubuntu? Then you could just use the official mk_apt agent plugin which does just that.

Also see share/doc/check_mk/treasures/mk_apt_hook for an example hook file that resets the cache timestamp just as r.sander suggested. If you copy this to /etc/apt/apt.conf.d/98mk-apt, then it will automatically execute the touch command in a “Post-Invoke” hook after dpkg has run, e.g. after installing updates.

1 Like

I am using CentOs 6/7 and Oracle Linux

I am not sure I explained myself currectly.

This is my output:

I want to remove the “OK - Cache generated 166 s ago, cache interval: 10 m, elapsed cache lifespan: 27.77%” part of the output, if possible.

I also saw the YUM plug in, but I am not quite sure it gives me what I want.

Our custom plugin is very simple and gives us the detailed information we required. I will have a test machine soon with a security package required to compare both outputs.

Hey - have you fixed it?

I have some plugins as well with different times. I don’t want to remove the lines at the end:
Cache generated 6 minutes 22 seconds ago, cache interval: 1 hour 0 minutes, elapsed cache lifespan: 10.61%

And I don’t want to have my output

No, I did not try to fix it.

I got moved to another project, and since this was a minor detail I did not bother removing it.

I found a solution:

If you use the local folder there’s no Cache. If you create a folder like 120 (for two minutes) you have a cache.

If you use the plugins folder with 120, the cache is in the output (like <<local:cached(1630064295,3600)>>) but not in the Check result. So you have only the result without the cached information.

You need to add “echo “<<>>”” to the Output - then the plugin is detected by CheckMK

You need to add “echo “<<>>”” to the Output - then the plugin is detected by CheckMK

Where do i have to add this? Does it work with powershell scripts?
until recently it was working with <nnoCacheOutput at the end of line. But after a update it doesn’t work anymore.

For Linux:

echo "<<<local>>>"
echo "0 'Test Check' OK"

For Windows

Write-host "<<<local>>>"
Write-host 0 '"Test Check"' - OK

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.