Dynamic Host Monitoring mit 2.1 enterprise

CMK version:
2.1 (stable)

OS version:
Aktuelles Bullseye:

Error message:
Ich möchte meine Kubernetes Umgebung monitoren und bin dem Tribe29 Video Episode 26: Monitoring Kubernetes with Checkmk - YouTube gefolgt

Bei Schritt dynamic host Managemet erhalte ich nach der Anlage der Regel folgenden Output unter
Phase 2.2 - Fetching existing hosts:

15:32:04 ERROR An exception occured
Traceback (most recent call last):
  File "/omd/sites/mwscan_site/lib/python3/cmk/cee/dcd/connectors/piggyback.py", line 229, in _execute_phase2
    cmk_hosts = self._web_api.get_all_hosts()
  File "/omd/sites/mwscan_site/lib/python3/cmk/cee/dcd/web_api.py", line 225, in get_all_hosts
    resp.raise_for_status()
  File "/omd/sites/mwscan_site/local/lib/python3/requests/models.py", line 960, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: INTERNAL SERVER ERROR for url: http://localhost:5000/mwscan_site/check_mk/api/1.0/domain-types/host_config/collections/all

Ein öffnen im Browser zeigt mit folgendes JSON:

{
    "title": "Server was about to send an invalid response.",
    "status": 500,
    "detail": "This is an error of the implementation.",
    "ext": {
        "errors": {
            "snmp_v3_credentials": [
                "Unknown field."
            ]
        },
        "orig": {
            "id": "host",
            "domainType": "host_config",
            "value": [
...]
}

Output of “cmk --debug -vvn hostname”: (If it is a problem with checks or plugins)

Kannst du mal die Properties dieses Hosts aufmachen?
Irgendwas mit den snmpv3 credentials Feld scheint hier nicht zu passen. Evtl. Sieht man ja in der GUI einen Fehler.

Gruß
Anastasios

“Dieses” Hosts…

Der Endpoint http://localhost:5000/mwscan_site/check_mk/api/1.0/domain-types/host_config/collections/all zeigt alle Hosts und mit jq ist das ein JSON mit 18056 Zeilen

Ich habe mal ein wenig gegraben, vielleicht hilft das:

{
    "title": "Server was about to send an invalid response.",
    "status": 500,
    "detail": "This is an error of the implementation.",
    "ext": {
        "errors": {
            "snmp_v3_credentials": [
                "Unknown field."
            ]
        },
        "orig": {
            "id": "host",
            "domainType": "host_config",
            "value": [
                {...},
            
                {
                    "domainType": "host_config",
                    "id": "s11",
                    "title": "s1x",
                    "links": [
                        {
                            "rel": "self",
                            "href": "http://checkmk.iznet/example_site/check_mk/api/1.0/objects/host_config/s11",
                            "method": "GET",
                            "type": "application/json",
                            "domainType": "link"
                        },
                        {
                            "rel": "urn:org.restfulobjects:rels/update",
                            "href": "http://checkmk.iznet/example_site/check_mk/api/1.0/objects/host_config/s11",
                            "method": "PUT",
                            "type": "application/json",
                            "domainType": "link"
                        },
                        {
                            "rel": "urn:org.restfulobjects:rels/delete",
                            "href": "http://checkmk.iznet/example_site/check_mk/api/1.0/objects/host_config/s11",
                            "method": "DELETE",
                            "type": "application/json",
                            "domainType": "link"
                        },
                        {
                            "rel": "urn:com.checkmk:rels/folder_config",
                            "href": "http://checkmk.iznet/example_site/check_mk/api/1.0/objects/folder_config/~switches",
                            "method": "GET",
                            "type": "application/json",
                            "domainType": "link",
                            "title": "The folder config of the host."
                        },
                        {
                            "rel": "urn:com.checkmk:rels/download",
                            "href": "http://checkmk.iznet/example_site/check_mk/api/1.0/domain-types/agent/actions/download/invoke?os_type=aix_tgz&host_name=s11",
                            "method": "GET",
                            "type": "application/json",
                            "domainType": "link",
                            "title": "Download the aix_tgz agent of the host."
                        },
                        {
                            "rel": "urn:com.checkmk:rels/download",
                            "href": "http://checkmk.iznet/example_site/check_mk/api/1.0/domain-types/agent/actions/download/invoke?os_type=linux_deb&host_name=s11",
                            "method": "GET",
                            "type": "application/json",
                            "domainType": "link",
                            "title": "Download the linux_deb agent of the host."
                        },
                        {
                            "rel": "urn:com.checkmk:rels/download",
                            "href": "http://checkmk.iznet/example_site/check_mk/api/1.0/domain-types/agent/actions/download/invoke?os_type=linux_rpm&host_name=s11",
                            "method": "GET",
                            "type": "application/json",
                            "domainType": "link",
                            "title": "Download the linux_rpm agent of the host."
                        },
                        {
                            "rel": "urn:com.checkmk:rels/download",
                            "href": "http://checkmk.iznet/example_site/check_mk/api/1.0/domain-types/agent/actions/download/invoke?os_type=linux_tgz&host_name=s11",
                            "method": "GET",
                            "type": "application/json",
                            "domainType": "link",
                            "title": "Download the linux_tgz agent of the host."
                        },
                        {
                            "rel": "urn:com.checkmk:rels/download",
                            "href": "http://checkmk.iznet/example_site/check_mk/api/1.0/domain-types/agent/actions/download/invoke?os_type=solaris_pkg&host_name=s11",
                            "method": "GET",
                            "type": "application/json",
                            "domainType": "link",
                            "title": "Download the solaris_pkg agent of the host."
                        },
                        {
                            "rel": "urn:com.checkmk:rels/download",
                            "href": "http://checkmk.iznet/example_site/check_mk/api/1.0/domain-types/agent/actions/download/invoke?os_type=solaris_tgz&host_name=s11",
                            "method": "GET",
                            "type": "application/json",
                            "domainType": "link",
                            "title": "Download the solaris_tgz agent of the host."
                        },
                        {
                            "rel": "urn:com.checkmk:rels/download",
                            "href": "http://checkmk.iznet/example_site/check_mk/api/1.0/domain-types/agent/actions/download/invoke?os_type=windows_msi&host_name=s11",
                            "method": "GET",
                            "type": "application/json",
                            "domainType": "link",
                            "title": "Download the windows_msi agent of the host."
                        }
                    ],
                    "members": {},
                    "extensions": {
                        "folder": "switches/",
                        "attributes": {
                            "tag_agent": "no-agent",
                            "snmp_community": [
                                "authPriv",
                                "sha",
                                "switchname",
                                "insertpwhere",
                                "DES",
                                "insertpwhere"
                            ],
                            ],
                            "tag_snmp_ds": "snmp-v2",
                            "meta_data": {
                                "created_at": 1636533532.6656003,
                                "created_by": "lars",
                                "updated_at": 1653549312.2342417
                            },
                            "snmp_v3_credentials": [
                                "authPriv",
                                "sha",
                                "switchname",
                                "insertpwhere",
                                "DES",
                                "insertpwhere"
                            ],
                            "ipaddress": "10.20.30.40"
                        },
                        "effective_attributes": null,
                        "is_cluster": false,
                        "is_offline": false,
                        "cluster_nodes": null
                    }
                }]
            }
        }
    }
}

Mag die API das Array in der Form nicht?

Habe es selber gefixed:

  1. JSON laden: http://localhost:5000/mwscan_site/check_mk/api/1.0/domain-types/host_config/collections/all
  2. Nach snmp_v3_credentials greppen
  3. Komponente in CheckMK -> Host Properties öffnen
  4. Save & go to folder
  5. Repeat für alle Funde machen
  6. Profit!

Darauf wollte ich hinaus. Ich schau mal, ob ich das nachstellen kann und mache dann ein Ticket auf.

Gruß
Anastasios

1 Like