Hello,
I’m implementing automated host config in 2.0 using the REST API. Here is what I have so far:
POST /domain-types/folder_config/collections/all
"name": "$folder_name",
"title": "$folder_name",
"parent": "/$ROOT_FOLDER",
"attributes": {
"tag_criticality": "prod",
"tag_agent": "all-agents"
}
POST /domain-types/host_config/collections/all
"folder": "/${ROOT_FOLDER}/${folder_name}",
"host_name": "$host_name",
"attributes": {
"ipaddress": "$host_addr"
}
POST /objects/host/{host_name}/actions/discover_services/invoke
{
"mode": "new"
}
POST /domain-types/activation_run/actions/activate-changes/invoke
"redirect": false,
"sites": [
"$SITE_NAME"
],
"force_foreign_changes": false
My issue is that all discovered services are in the “undecided” state and I need them to be “monitored”. I tried making a discover_services call with “mode”: “fix_all” but that didn’t seem to make any difference (bug?).
As a workaround, I’ve enabled periodic service discovery, configured it to run frequently and automatically add unmonitored services which works but I would rather manage this myself using the REST API.
Any help much appreciated. Thanks!