Verify Operating system version

Hi everyone,

I would like to set up an operating systems check.
For example, define for Debian the stable version is version 10, and that if /etc/debian_version does not return 10.x then there is a warning
The same for Windows.

Is there a way to do this ?

Thanks,
Vincent

PS : i am on Checkmk Raw Edition 1.6.0p16 installed on Debian 10

One idea without a check. Enable the HW/SW inventory plugin on your machines and use these data for an overview over all your systems with the operating system shown.

This is an agent plugin and check for the Linux side of your request: https://exchange.checkmk.com/p/lsbrelease

The HW/SW-Inventory approach is more generic. You could build an active check that extracts that data via livestatus and checks it.

1 Like

The agent uses lsb_release to figure that out. On my Ubuntu system it returns No LSB modules are available.
I’d suggest to either follow @andreas-doehler’s suggestion or write a custom check.
Isn’t /etc/os-release the current and portable way to go? I thought so.

Yes, it is. This is from older times. :relaxed:

You might want to try something like lsb_release --id --description --release --codename or lsb_release -sd
:slight_smile:

1 Like

Thank you for all the answers. I will test this and see if it meets my expectations.

Otherwise I might do a little script which will be called by /etc/check_mk/mrpe.cfg

Of course you are right. Thank you. Don’t know what I did yesterday :man_shrugging:.
The plugin from the MKP file does an lsb_release -a and that gives sensible output – just like you suggested.

1 Like

Writing a “local check” script might be even easier than an mrpe check, without the need to include this in a separate .cfg file.

Something as simple as:

 #!/bin/sh
 if type lsb_release >/dev/null ; then
   echo "0 lsb_release - $(lsb_release --short --description)"
 fi
 exit 0

Just put it into /usr/lib/check_mk_agent/local/ (and set the executable bit: chmod +x ... ).

Should be discovered as a new local check named “lsb_release” without perfdata, always OK.

2 Likes

Hi there !

I finally did my own check and run it with mrpe.cfg
At the moment, it only works with a few versions of Linux (the ones I actually needed)
I published the script on github if it can helps.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.