Hi, I solved the login problem and now I can get the information from the service I’m querying. The problem is that compared to Icinga, fewer details are returned, such as the last time it was OK and the check output. Below are two examples.
Icinga2 output
[root@inl-icinga2:~]#curl -k -s -S -i -u usewr:pwd ‘http://xxx.xxx.xxx.xxx/icingaweb2/v1/objects/services?service=hostname!APP_CAUDIT_CAPTURE_SVC’
HTTP/1.1 200 OK
Date: Fri, 19 Jul 2024 11:18:56 GMT
Server: Icinga/2.11.2-1
Content-Type: application/json
Content-Length: 2542
X-Cache: MISS from inl-pxyout1
X-Cache-Lookup: MISS from xxxxxxxxxx
Via: 1.1 xxxxxxx (squid/4.15)
Connection: keep-alive
{“results”:[{“attrs”:{“__name”:“hostname!APP_CAUDIT_CAPTURE_SVC”,“acknowledgement”:0.0,“acknowledgement_expiry”:0.0,“action_url”:“”,“active”:true,“check_attempt”:1.0,“check_command”:“APP_CAUDIT_CAPTURE_SVC”,“check_interval”:120.0,“check_period”:“9-18”,“check_timeout”:null,“command_endpoint”:“hostname”,“display_name”:“APP_CAUDIT_CAPTURE_SVC”,“downtime_depth”:0.0,“enable_active_checks”:true,“enable_event_handler”:true,“enable_flapping”:false,“enable_notifications”:true,“enable_passive_checks”:true,“enable_perfdata”:true,“event_command”:“”,“flapping”:false,“flapping_current”:0.0,“flapping_last_change”:0.0,“flapping_threshold”:0.0,“flapping_threshold_high”:30.0,“flapping_threshold_low”:25.0,“force_next_check”:false,“force_next_notification”:false,“groups”:,“ha_mode”:0.0,“handled”:false,“host_name”:“hostname”,“icon_image”:“”,“icon_image_alt”:“”,“last_check”:1721387871.417195,“last_check_result”:{“active”:true,“check_source”:“hostname”,“command”:[“path_custom_check/APP_CAUDIT_CAPTURE_SVC.pl”],“execution_end”:1721387871.417112,“execution_start”:1721387871.372446,“exit_status”:0.0,“output”:“OK - Ultima esecuzione processo 122 minuti fa.”,“performance_data”:,“schedule_end”:1721387871.417195,“schedule_start”:1721387871.417195,“state”:0.0,“ttl”:0.0,“type”:“CheckResult”,“vars_after”:{“attempt”:1.0,“reachable”:true,“state”:0.0,“state_type”:1.0},“vars_before”:{“attempt”:1.0,“reachable”:true,“state”:0.0,“state_type”:1.0}},“last_hard_state”:0.0,“last_hard_state_change”:1721380671.413024,“last_reachable”:true,“last_state”:0.0,“last_state_change”:1721380671.413024,“last_state_critical”:1721380551.418716,“last_state_ok”:1721387871.418218,“last_state_type”:1.0,“last_state_unknown”:0.0,“last_state_unreachable”:0.0,“last_state_warning”:0.0,“max_check_attempts”:5.0,“name”:“APP_CAUDIT_CAPTURE_SVC”,“next_check”:1721387991.37,“notes”:“”,“notes_url”:“”,“original_attributes”:null,“package”:“director”,“paused”:false,“previous_state_change”:1721380671.413024,“problem”:false,“retry_interval”:60.0,“severity”:8.0,“source_location”:{“first_column”:1.0,“first_line”:1380.0,“last_column”:39.0,“last_line”:1380.0,“path”:“/var/lib/icinga2/api/packages/director/6d66712d-75fe-4967-a187-317888e6f42f/zones.d/inl-icinga2/services.conf”},“state”:0.0,“state_type”:1.0,“templates”:[“APP_CAUDIT_CAPTURE_SVC”,“APP_CAUDIT_CAPTURE_SVC”,“Agent-based Service”],“type”:“Service”,“vars”:null,“version”:0.0,“volatile”:false,“zone”:“inl-icinga2”},“joins”:{},“meta”:{},“name”:“hostname!APP_CAUDIT_CAPTURE_SVC”,“type”:“Service”}]}
checkmk output
[root@inl-checkmk:~]#curl -k -s -S -i -u user:pwd ‘http://xxx.xxx.xxx.xxx./consolidato/check_mk/api/1.0/objects/host/hostname/actions/show_service/invoke?service_description=APP_CAUDIT_CAPTURE_SVC’
HTTP/1.1 200 OK
Date: Fri, 19 Jul 2024 11:19:54 GMT
Server: Apache
Permissions-Policy: accelerometer=(), autoplay=(), camera=(), encrypted-media=(), fullscreen=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(), usb=()
X-Frame-Options: sameorigin
X-XSS-Protection: 1; mode=block
X-Permitted-Cross-Domain-Policies: none
Referrer-Policy: origin-when-cross-origin
X-Content-Type-Options: nosniff
Content-Length: 508
ETag: “d01d31e6cbded20b522238eabbab8cb3553efc9d”
X-Checkmk-Version: 2.3.0p6
X-Checkmk-Edition: cre
Content-Security-Policy: default-src ‘self’ ‘unsafe-inline’ ‘unsafe-eval’ ssh: rdp:; img-src ‘self’ data: https://*.tile.openstreetmap.org/ ; connect-src ‘self’ https://crash.checkmk.com/ https://license.checkmk.com/api/verify; frame-ancestors ‘self’ ; base-uri ‘self’; form-action ‘self’ javascript: ‘unsafe-inline’; object-src ‘self’; worker-src ‘self’ blob:
Content-Type: application/json
{“links”: [{“domainType”: “link”, “rel”: “self”, “href”: “http://xxx.xxx.xxxx.xxxx/consolidato/check_mk/api/1.0/objects/service/hostname-APP_CAUDIT_CAPTURE_SVC”, “method”: “GET”, “type”: “application/json”}], “domainType”: “service”, “id”: “hostname-APP_CAUDIT_CAPTURE_SVC”, “title”: “Service APP_CAUDIT_CAPTURE_SVC”, “members”: {}, “extensions”: {“description”: “APP_CAUDIT_CAPTURE_SVC”, “host_name”: “hotname”, “state_type”: 1, “state”: 0, “last_check”: 1721387819}}