Page 1 of 1

No respond from API - Nagios XI

Posted: Thu Apr 17, 2025 1:46 am
by przkuch
Hello!
Week ago we found out on our daily jobs that our custom script to scheduling downtime do not work ok.
Its was not doing anything. I found out that API just... not work?
Even in "HELP" the example CURL request:
"curl -XGET "http://X.X.X.X/nagiosxi/api/v1/system/s ... X&pretty=1""

Giving me output like:

Code: Select all

{
    "instance_id": null,
    "instance_name": "unassigned",
    "status_update_time": null,
    "program_start_time": null,
    "program_run_time": null,
    "program_end_time": null,
    "is_currently_running": null,
    "process_id": null,
    "daemon_mode": null,
    "last_command_check": null,
    "last_log_rotation": null,
    "notifications_enabled": null,
    "active_service_checks_enabled": null,
    "passive_service_checks_enabled": null,
    "active_host_checks_enabled": null,
    "passive_host_checks_enabled": null,
    "event_handlers_enabled": null,
    "flap_detection_enabled": null,
    "process_performance_data": null,
    "obsess_over_hosts": null,
    "obsess_over_services": null,
    "modified_host_attributes": null,
    "modified_service_attributes": null,
    "global_host_event_handler": null,
    "global_service_event_handler": null
}
And the only which is looks like working is "objects/hoststatus"
But rest from "Config" and "System" Sections are empty after curl request or timeout.

curl -XGET "http://X.X.X.X/nagiosxi/api/v1/config/h ... X&pretty=1"

Code: Select all

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>504 Gateway Timeout</title>
</head><body>
<h1>Gateway Timeout</h1>
<p>The gateway did not receive a timely response
from the upstream server or application.</p>
</body></html>
or

curl -XGET "http://X.X.X.X/nagiosxi/api/v1/config/h ... X&pretty=1"

Code: Select all

{

}
Can someone point me where i can search what can be reason? Some log or whatever?
I dont know even where to start to searching an issue.

And of course before it was working as usually and it was our basic daily jobs.
Thanks for any respond!

Re: No respond from API - Nagios XI

Posted: Fri Apr 18, 2025 4:17 pm
by lgute
Hi @przkuch,

Thanks for reaching out.

What version of XI are you running and what distro/version?

This is what I got back from config/host, both remotely and locally (on the XI server).

curl -XGET "http://192.168.XX.XX/nagiosxi/api/v1/co ... X&pretty=1"

Code: Select all

[
    {
        "host_name": "192.168.58.250",
        "use": [
            "xiwizard_mssqldatabase_host"
        ],
        "address": "192.168.58.250",
        "max_check_attempts": "5",
        "check_interval": "5",
        "retry_interval": "1",
        "check_period": "xi_timeperiod_24x7",
        "contacts": [
            "nagiosadmin"
        ],
        "notification_interval": "60",
        "notification_period": "xi_timeperiod_24x7",
        "icon_image": "mssqldatabase.png",
        "statusmap_image": "mssqldatabase.png",
        "_xiwizard": "mssql_database",
        "register": "1"
    },
    {
        "host_name": "localhost",
        "use": [
            "linux-server"
        ],
        "alias": "localhost",
        "address": "127.0.0.1",
        "register": "1"
    }
]

Re: No respond from API - Nagios XI

Posted: Tue Apr 22, 2025 4:34 am
by danisa
Make sure the API key you're using has sufficient permissions.
In Nagios XI, go to Admin > Manage Users.
Check the user associated with the API key — do they have full admin rights?
Some endpoints require elevated permissions and may return null or nothing for limited accounts.

Worldguessr