<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>REST API &#8211; Nagios Library</title>
	<atom:link href="https://library.nagios.com/tag/rest-api/feed/" rel="self" type="application/rss+xml" />
	<link>https://library.nagios.com</link>
	<description>Complete Nagios monitoring resources and documentation</description>
	<lastBuildDate>Mon, 02 Feb 2026 22:41:19 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://library.nagios.com/wp-content/uploads/2024/11/Nagios-Blue-N.svg</url>
	<title>REST API &#8211; Nagios Library</title>
	<link>https://library.nagios.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>The Nagios XI REST API: Harness This Dynamic Feature</title>
		<link>https://library.nagios.com/techtips/harness-the-nagios-xi-rest-api/</link>
		
		<dc:creator><![CDATA[Shamas Demoret]]></dc:creator>
		<pubDate>Wed, 05 Mar 2025 16:53:22 +0000</pubDate>
				<category><![CDATA[Techtips]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[REST API]]></category>
		<guid isPermaLink="false">https://library.nagios.com/?p=50749</guid>

					<description><![CDATA[Explore the power of the Nagios XI REST API, which provides a way to read, write, update, and delete data in the system programmatically. ]]></description>
										<content:encoded><![CDATA[
<p>Nagios XI has a robust REST API (Representational State Transfer Application Programming Interface) that can programmatically read, write, delete, and update object and system settings and data. The API can be accessed via a web browser or interacted with from the command line via cURL commands. In this article, we&#8217;ll explore some key benefits and use cases of this powerful feature. Comprehensive details and example URLs and cURL requests can be found in the <strong>Help &gt; API Guide</strong> section of the XI interface:</p>



<figure class="wp-block-image size-large has-custom-border"><a href="https://library.nagios.com/wp-content/uploads/2025/03/Screenshot-2025-02-27-155223.png"><img fetchpriority="high" decoding="async" width="1024" height="486" src="https://library.nagios.com/wp-content/uploads/2025/03/Screenshot-2025-02-27-155223-1024x486.png" alt="A screenshot of the Nagios XI &#039;API Docs&#039; menu, showing various REST API endpoints." class="wp-image-50754" style="border-radius:8px" title="The Nagios XI REST API: Harness This Dynamic Feature 1" srcset="https://library.nagios.com/wp-content/uploads/2025/03/Screenshot-2025-02-27-155223-1024x486.png 1024w, https://library.nagios.com/wp-content/uploads/2025/03/Screenshot-2025-02-27-155223-300x142.png 300w, https://library.nagios.com/wp-content/uploads/2025/03/Screenshot-2025-02-27-155223-768x365.png 768w, https://library.nagios.com/wp-content/uploads/2025/03/Screenshot-2025-02-27-155223.png 1405w" sizes="(max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">The Nagios XI REST API in-interface guide. </figcaption></figure>



<h2 class="wp-block-heading">Benefits </h2>



<h3 class="wp-block-heading">1. Automation and Integration</h3>



<p>The REST API enables integration between Nagios XI and third-party tools like CMDB systems, ticketing platforms, or configuration management tools. This helps reduce manual work, speed up response times, and ensure tool consistency.</p>



<h3 class="wp-block-heading">2. Status and System Data Access</h3>



<p>The API gives you direct access to monitoring data, host and service statuses, XI server and application data, and performance data returned as JSON. Whether you’re building custom dashboards, feeding data into a <a href="https://library.nagios.com/techtips/nagios-xi-bpi-unlock-actionable-insights-for-it-monitoring-and-optimization/">business intelligence</a> platform, or simply tracking trends in your own system, the API provides access to up-to-date information.</p>



<h3 class="wp-block-heading">3. Programmatic Provisioning and Decommissioning </h3>



<p>You can create, update, or delete host, service, user, and group configurations and apply configuration via the API. This means you can automate the onboarding of new systems and remove decommissioned ones without ever touching the web interface.</p>



<h3 class="wp-block-heading">4. Custom Alerting &amp; Response Automation</h3>



<p>With current status data at your fingertips, you can customize alerting pipelines — for example, sending alerts to ticketing of chat platforms or triggering automatic remediation workflows in your orchestration tool.</p>



<h2 class="wp-block-heading">REST API Use Cases and Examples</h2>



<h3 class="wp-block-heading">1. <strong>Automated Host and Service Management</strong></h3>



<p>When new servers or applications are provisioned, you can use the API to automatically add them to monitoring. This works especially well in dynamic environments such as cloud infrastructure or containerized environments, where systems are constantly spun up and down.</p>



<p>Example Workflow:</p>



<ul class="wp-block-list">
<li>New server instance created in AWS.</li>



<li>Configuration management (like Ansible) applies baseline configs to the instance. </li>



<li>Ansible calls the Nagios XI API via a cURL <strong>POST</strong> command to register the host and services and applies configuration.</li>



<li>Monitoring and alerting start immediately, without manual intervention.</li>
</ul>



<p>You can learn more about automation via Ansible using the Nagios XI REST API here: </p>



<p><a href="https://support.nagios.com/kb/article/nagios-xi-ansible-tutorial-819.html" target="_blank" rel="noopener">Nagios XI Ansible Tutorial</a></p>



<p>Nagios XI supports <strong>POST</strong>, <strong>PUT</strong>, and <strong>DELETE</strong> commands to create, modify, and delete host and service objects, as well as a <strong>GET</strong> commands, which you can use to review their existing settings. See the <strong>Config Reference</strong> section of the in-interface guide for examples:</p>



<figure class="wp-block-image size-full"><a href="https://library.nagios.com/wp-content/uploads/2025/03/Config-Reference-API.png"><img decoding="async" width="376" height="872" src="https://library.nagios.com/wp-content/uploads/2025/03/Config-Reference-API.png" alt="A screenshot of the Config Reference endpoints section of the Nagios XI in-interface REST API guide." class="wp-image-50976" title="The Nagios XI REST API: Harness This Dynamic Feature 2" srcset="https://library.nagios.com/wp-content/uploads/2025/03/Config-Reference-API.png 376w, https://library.nagios.com/wp-content/uploads/2025/03/Config-Reference-API-129x300.png 129w" sizes="(max-width: 376px) 100vw, 376px" /></a><figcaption class="wp-element-caption">The endpoints are in the Config Reference section.</figcaption></figure>



<h3 class="wp-block-heading">2. <strong>Object Control</strong></h3>



<p>The API enables you to not just create new objects and modify them but also control the Nagios monitoring engine&#8217;s interactions with them. Below are some common examples. Note that you will need to replace things like <code>&lt;XI.Server.IP&gt;</code> and <code>&lt;your-API-key&gt;</code> with your Nagios XI server&#8217;s info (conveniently, these two fields are automatically populated correctly in the example commands in the <strong>Help &gt;API Docs</strong> section of the interface). You&#8217;ll also need to replace the data in arguments such as <code>start=1741116177&amp;end=1741123377</code> with details specific to your request, in this case, with the correct Unix timestamps for the desired time period.</p>



<p><em>Note that all of the following are single long commands. </em></p>



<ul class="wp-block-list">
<li><strong>Managing Downtime</strong></li>
</ul>



<p>To view items in downtime, you can use the <strong>GET</strong> <code>objects/downtime</code> endpoint:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-Geist-Mono" style="font-size:.875rem;font-family:Code-Pro-Geist-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>curl -XGET "http://&lt;XI.Server.IP>/nagiosxi/api/v1/objects/downtime?apikey=&lt;your-API-key>&amp;pretty=1"</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">curl -XGET </span><span style="color: #CE9178">&quot;http://&lt;XI.Server.IP&gt;/nagiosxi/api/v1/objects/downtime?apikey=&lt;your-API-key&gt;&amp;pretty=1&quot;</span></span></code></pre></div>



<p><br>To schedule downtime for a host, you can use the <strong>POST</strong> <code>system/scheduleddowntime</code> endpoint. : </p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-Geist-Mono" style="font-size:.875rem;font-family:Code-Pro-Geist-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>curl -XPOST "http://&lt;XI.Server.IP>/nagiosxi/api/v1/system/scheduleddowntime?apikey=&lt;your-API-key>&amp;pretty=1" -d "comment=Test downtime creation&amp;start=1741116177&amp;end=1741123377&amp;hosts[]=&lt;hostname1>&amp;hosts[]=&lt;hostname2>"</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">curl -XPOST </span><span style="color: #CE9178">&quot;http://&lt;XI.Server.IP&gt;/nagiosxi/api/v1/system/scheduleddowntime?apikey=&lt;your-API-key&gt;&amp;pretty=1&quot;</span><span style="color: #D4D4D4"> -d </span><span style="color: #CE9178">&quot;comment=Test downtime creation&amp;start=1741116177&amp;end=1741123377&amp;hosts[]=&lt;hostname1&gt;&amp;hosts[]=&lt;hostname2&gt;&quot;</span></span></code></pre></div>



<p>To take a host out of downtime, you&#8217;ll need the <code>internal_downtime_id</code> of the host you wish to remove from downtime, which can be found by running the <strong>GET<code> </code></strong><code>objects/downtime</code> command noted above, then run a command like the following, replacing the number <code>10</code> after <code>/scheduleddowntime/10 </code>with the correct ID.</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-Geist-Mono" style="font-size:.875rem;font-family:Code-Pro-Geist-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>curl -XDELETE "http://&lt;XI.Server.IP>/nagiosxi/api/v1/system/scheduleddowntime/10?apikey=&lt;your-API-key>&amp;pretty=1"</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">curl -XDELETE </span><span style="color: #CE9178">&quot;http://&lt;XI.Server.IP&gt;/nagiosxi/api/v1/system/scheduleddowntime/10?apikey=&lt;your-API-key&gt;&amp;pretty=1&quot;</span></span></code></pre></div>



<ul class="wp-block-list">
<li><strong>Make objects Active or Inactive</strong></li>
</ul>



<p>Inactive objects remain visible in the Nagios XI Core Config Manager but are removed from the Nagios Core monitoring engine configs until reactivated, thus ceasing monitoring. Simply switch the objects back to active and apply the configuration to resume monitoring.</p>



<p>Here, a value of <code>0</code> for <code>register=0</code> makes the service inactive, while a value of <code>1</code> makes it active:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-Geist-Mono" style="font-size:.875rem;font-family:Code-Pro-Geist-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>curl -XPUT "http://&lt;XI.Server.IP>/nagiosxi/api/v1/config/service/&lt;host name>/&lt;service description>?apikey=&lt;your-API-key>&amp;pretty=1&amp;register=0&amp;applyconfig=1"</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">curl -XPUT </span><span style="color: #CE9178">&quot;http://&lt;XI.Server.IP&gt;/nagiosxi/api/v1/config/service/&lt;host name&gt;/&lt;service description&gt;?apikey=&lt;your-API-key&gt;&amp;pretty=1®ister=0&amp;applyconfig=1&quot;</span></span></code></pre></div>



<ul class="wp-block-list">
<li><strong>Schedule a Mass Immediate Check</strong></li>
</ul>



<p>To schedule an immediate check for hosts, services, or groups, you can use the <strong>POST</strong> <code>system/massimmediatecheck</code> endpoint: </p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-Geist-Mono" style="font-size:.875rem;font-family:Code-Pro-Geist-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>curl -XPOST "http://&lt;XI.Server.IP>/nagiosxi/api/v1/system/massimmediatecheck?apikey=&lt;your-API-key>&amp;pretty=1" -d "hosts[]=&lt;hostname1>"</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #D4D4D4">curl -XPOST </span><span style="color: #CE9178">&quot;http://&lt;XI.Server.IP&gt;/nagiosxi/api/v1/system/massimmediatecheck?apikey=&lt;your-API-key&gt;&amp;pretty=1&quot;</span><span style="color: #D4D4D4"> -d </span><span style="color: #CE9178">&quot;hosts[]=&lt;hostname1&gt;&quot;</span></span></code></pre></div>



<p><br>More information can be found in the <strong>System Reference</strong> section of the in-interface API guide: </p>



<figure class="wp-block-image size-full"><a href="https://library.nagios.com/wp-content/uploads/2025/03/System-Reference-API.png"><img decoding="async" width="377" height="538" src="https://library.nagios.com/wp-content/uploads/2025/03/System-Reference-API.png" alt="A screenshot of the System Reference endpoints in the Nagios XI in-interface REST API guide." class="wp-image-50984" title="The Nagios XI REST API: Harness This Dynamic Feature 3" srcset="https://library.nagios.com/wp-content/uploads/2025/03/System-Reference-API.png 377w, https://library.nagios.com/wp-content/uploads/2025/03/System-Reference-API-210x300.png 210w" sizes="(max-width: 377px) 100vw, 377px" /></a><figcaption class="wp-element-caption">The System Reference endpoints. </figcaption></figure>



<h2 class="wp-block-heading">Conclusion</h2>



<p>The Nagios XI REST API provides comprehensive insight into and control of your monitoring system. Although the GUI-driven options like monitoring wizards, the Core Config Manager, and the many event management tools make the power of Nagios XI accessible to a broad spectrum of users, the API is an invaluable feature for more advanced users and deeper requirements. </p>



<p>You can find more details and API usage examples in the <a href="https://assets.nagios.com/downloads/nagiosxi/docs/Accessing-and-Using-the-XI-REST-API.pdf" target="_blank" rel="noreferrer noopener">Accessing and Using the XI REST API </a>doc.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
