Obtaining site info via API

Hi,
I have some doubts about this topic and I didnt find a way to solve them:

-Is there anyway to obtain all the hosts monitored by a site on checkmk?
-Is there anyway to obtain the status of a site from any site? For example this field: Online

Thanks in advance

Hi @alz0,

i couldn’t find any information regarding the status from the distributed monitoring, because it refresh itself without refreshing the site… you probably need to take a look, how the live-status of the distributed monitoring servers are requested.

To get all host information from a site, i would recommend you to use “openapi/#operation/cmk.gui.plugins.openapi.endpoints.host.list_hosts”, mentioned in the “ReDoc” documentation of Check_MK. Without using the options “query” and “columns”, you should be able to get a list of all host names from a specific site.

1 Like

You can just to a host search in the GUI but select your wanted output_format so you can use it in any automation.

Yes, the status on your site depends on the STATUS HOST you have picked when you setup the site, that you should already know and you can query that host (also using a regular view to look for, for example any OMD* service or the Check_MK Agent

Hi, thankyou @Kruzgoth

I didnt find anything about this… TNeither in the livesatatus tables nor in the documentation…
I will keep searching

Big thanks! I didnt notice about this query, this worked for me!

Hi, thanks for you reply.

Okay… So if my site2 y the host 192.168.1.10 I need to monitor that host? Getting his status via API o executing some commands in his command line and analyzing the content?

For example, from central server I could connect via ssh to that server and execute a “omd status”, finally see if all the lines are ending with the “running” word?

@alz0
The best performance would be (propably) to monitor the site-host from your “Main”-Check_MK instance
and check for the “OMD status” or “OMD performance” service.
This should indicate pretty accurate if the site is available or not.

Here i thought more about searching in the kernel-files of checkmk. I don’t think that the behavior is documentated anywhere where check_mk users can read this.

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.