Windows local check cached suffix

Heya folks. Just starting to get into learning more and applying some old Powershell skills.

I’ve set up a local check to collect specific Windows registry keys, but there are also a couple of heavy commands that get run for results too. I’ve then got a dashboard view with ‘joined column’ to get the ‘service’ return values for the items I want.

Obviously now, turning on caching in the yml file doesn’t change the configuration displayed in WATO, and adds the cache suffix such this: “OK - NotDetected?, Cache generated 57 m ago, cache interval: 100 m, elapsed cache lifespan: 57.81%”. As the metadata isn’t interpreted by WATO, it is useful for context, but generally I only want the data. Even the “OK” status is extra to the Powershell return value.

Is there a trivial way to exclude the cache suffix, or to only display the return data from a local check in a View?

Cheers for any tips or insights :grin:
–Gene

First step is the agent output for your local check. Can you provide these lines?
Only your cached local section is relevant.

Thanks andreas.

From the server service table, with the data being “2021-02”;
Output of check plugin OK - 2021-02, Cache generated 81 m ago, cache interval: 100 m, elapsed cache lifespan: 81.24%

This is not the agent output.
The raw agent output of the local section of this machine is relevant.

Example

<<<local>>>
cached(1613630229,600) P WindowsUpdates critical=0;1;1|optional=2;1;100|hidden=0|reboot=0;1 pending updates
2 Likes

I couldn’t google ‘raw agent output’ :slight_smile: I grabbed this from the server Diagnostic agent return (shortened to just one). Thanks for your patience.

<<<local>>>
cached(1613676114,6000) 0 wsus-current - 2021-02

As the output looks ok, now the big question what version is the agent and the monitoring system?

Other thing if i see this output what is wrong with your output?

This is exactly what should be shown.
If you post a small screenshot i think all is correct here.

Thanks Andreas.

Main server is ‘Enterprise 1.6.0p20’ using the 1.6 agent that came with this version.

The setting we are using for the view is this;
image

And an example of the output (without and with the cache) is like this;
image

Just to confirm again, what I’d like to achieve is just the raw scripted output without the “OK -” and “Cache generated” parts.

Again, thank you!

The “OK” cannot be removed as this is what CMK calculates or interprets your result.
In your screenshot this is other output as in the post before.

Do you have the raw agent output corresponding to this screenshot?

I can have a look at 1.6p20 system if i can reproduce the behavior. But i think it is a result of some problems with the output formatting.

Thanks for the confirmation. Messaging dump of data directly (basically long form of what has previously been mentioned).

Much appreciate you have time to compare and reproduce.

Ah I don’t had this cache line seen in my output as it was multi line. I think this can also help you a little bit. If you make this output a type of multi line check result you will also don’t see the cache line.
If my output is single line then i have also the cache text.

Oooh! Interesting insight. I will check that out next

I’ve appended newline data to the local service output, and it is acting strange.

Output from powershell and to the agent looks correct. I only use one slash otherwise I end up with additional slashes in the output.

<<<local>>>
cached(1614136449,6000) 0 wsus-current - 2021-02\n2021-02

Oh! CheckMK interpreted putting the cache data with the long output. That is … bizzare, but as you say it clears the cache data problem

I might try to replicate on another machine, and perhaps on a linux machine. This is not what I would have thought would have occurred in these situations.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact @fayepal if you think this should be re-opened.