Web-API : can we make a bulk discovery with the APi on a folder?

Hello all ,

I am wondering if it is possible to perform a bulk discovery on folder via the check_mk api

We have have the functionnality actually https://checkmk.com/cms_web_api_references.html#discover_services but it is just for single host which doesn’t fit my needs ,.

I don’t want to call the get_all_host api first then make loop inside it to discover one by one the services on each host.

Kr ,

Andry

You can try to use get_host or get_all_hosts function with params = { folder = “your_folder” } (haven’t tried yet) and run kind of a loop foreach found host and run discover_services function with each hostname found.

Give it a try :slight_smile:

Hope it helps.

Thanks for the reply but I want to avoid the loop
Because in Wato we have this bulk discovery feature but not in the API

Kr,

Andry

As far as my (low) dev skills can go, and looking at the webapi code regarding the action_discover_services it can only do to a single host - at least in version 1.5.0p19.

EDIT : 1.6 also with “the same code/behavior” :slight_smile:

EDIT #2 : Sorry, 1.6 has the hability you need.

Hello ,

I am using the 1.6.0.p8 but I didn’t see the feature at least on the API documentation
Would you send me a link ?

Kr ,
Andry

I didn’t found any documentantion regarding that just the .py in the share folder of 1.6.0p6 (file bulk_discovery.py)

Cheers

1 Like

At the moment, the bulk operators are missing inside the API documentation.
Inside the bulk_discovery.py file mentioned from @ricardoftribeiro you find the two possible requests.
bulk_discovery_start and bulk_discovery_status described with the parameters

Hello Andreas ,

Thanks for the reply , I know to use them knw

it is webapi.py?action=bulk_discovery_start

with body the lists of hostnames ( ex : request:{“hostnames”:[“nono”]})

kr ,

Andry

1 Like