<?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>API &#8211; Nagios Library</title>
	<atom:link href="https://library.nagios.com/tag/api/feed/" rel="self" type="application/rss+xml" />
	<link>https://library.nagios.com</link>
	<description>Complete Nagios monitoring resources and documentation</description>
	<lastBuildDate>Thu, 02 Apr 2026 20:08:40 +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>API &#8211; Nagios Library</title>
	<link>https://library.nagios.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Master Using the Nagios XI API</title>
		<link>https://library.nagios.com/training/using-the-nagios-xi-api/</link>
		
		<dc:creator><![CDATA[Louie Mattia]]></dc:creator>
		<pubDate>Wed, 02 Apr 2025 19:49:22 +0000</pubDate>
				<category><![CDATA[Training]]></category>
		<category><![CDATA[API]]></category>
		<guid isPermaLink="false">https://library.nagios.com/?p=49234</guid>

					<description><![CDATA[The built-in Nagios XI API (Application Programming Interface) provides access to a wide range of data, including hosts, services, users, and more. There are times when you may need to interact with the API. To do that you need to learn how to access the API as well as what it contains. What is Contained [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>The built-in Nagios XI API (Application Programming Interface) provides access to a wide range of data, including hosts, services, users, and more. There are times when you may need to interact with the API. To do that you need to learn how to access the API as well as what it contains.</p>



<h2 class="wp-block-heading">What is Contained in the API</h2>



<p>The Nagios XI API is divided into three core sections: Objects, Config, and System. Each section serves a distinct purpose, making the API highly flexible and powerful.</p>



<p><strong>Objects</strong>: This section is read-only and provides detailed information about various elements within Nagios XI. It allows users to query important resources, such as hosts, services, and other objects, providing insight into their current states and configurations. The data retrieved from this section can be delivered in either XML or JSON formats, making it easy to integrate and process within other applications or systems.</p>



<p><strong>Config</strong>: The Config section is designed for administrative tasks, giving administrators the ability to add, remove, and modify objects such as hosts, services, and other configurations within Nagios XI. This section works directly with the Core Config Manager, allowing the creation and deletion of items. It provides a more dynamic role within the API, as it enables direct management and updates of system configurations to meet specific needs or changes in the infrastructure.</p>



<p><strong>System</strong>: Like the Config section, the System section is reserved for administrators and provides the ability to manage the core subsystems of Nagios XI. It allows admins to execute system-level commands, configure system settings, and perform administrative tasks that impact the overall functionality and health of the Nagios XI environment.</p>



<h3 class="wp-block-heading">Types of API Requests</h3>



<p>When interacting with the Nagios XI API, you&#8217;ll primarily use four types of HTTP requests to interact with the system: <strong>GET</strong>, <strong>POST</strong>, <strong>PUT</strong>, and <strong>DELETE</strong>. Each request type serves a different purpose, allowing you to retrieve, create, update, or delete data.</p>



<ol class="wp-block-list">
<li><strong>GET</strong> – <strong>Retrieve Data</strong><br>The <strong>GET</strong> request is used to retrieve information from the Nagios XI API. It is typically used to query data such as host status, service status, or configuration details. This is a read-only operation and does not modify any data within the system. For example, you might use a GET request to check the current status of a host or service.<br><strong>Example</strong>: Retrieve host status or service details.</li>



<li><strong>POST</strong> – <strong>Create or Submit Data</strong><br>The <strong>POST</strong> request is used to send data to the server, typically to create new resources or submit information. For example, when adding a new host or service to Nagios XI, you’ll use a POST request to submit the necessary configuration data. It is used when creating new objects or triggering actions that modify the state of the system.<br><strong>Example</strong>: Add a new host, service, or update configuration.</li>



<li><strong>PUT</strong> – <strong>Update Data</strong><br>The <strong>PUT</strong> request is used to update or modify an existing resource. It’s typically used when you want to change the configuration of a current host, service, or other object in Nagios XI. Unlike POST, which creates new resources, PUT is meant for updating existing ones.<br><strong>Example</strong>: Update the configuration of an existing host or service.</li>



<li><strong>DELETE</strong> – <strong>Remove Data</strong><br>The <strong>DELETE</strong> request is used to remove a resource from the Nagios XI system. It’s used when you want to delete objects such as hosts, services, or configurations. Deleting data through the API is a permanent operation, so it&#8217;s important to be sure before making this type of request.<br><strong>Example</strong>: Remove a host or service from the system.</li>
</ol>



<h2 class="wp-block-heading">How to Access the API via URL</h2>



<p>The Nagios XI API can be accessed in a similar way to how you interact with Nagios XI itself—using a web browser. However, it&#8217;s important to note that this method is limited to <strong>GET </strong>requests, which allow you to retrieve and view data from the system. For tasks like creating, updating, or deleting resources (such as adding hosts or modifying configurations), you’ll need to use a different approach, typically by making <strong>POST</strong>, <strong>PUT</strong>, or <strong>DELETE</strong> requests through code. To get started, simply enter the following URL in your browser:</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"><textarea class="code-block-pro-copy-button-textarea" aria-hidden="true" readonly>http://&lt;Your Nagios XI IP>/nagiosxi/api/v1/</textarea><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">http://&lt;Your Nagios XI IP&gt;/nagiosxi/api/v1/</span></span></code></pre></div>



<figure class="wp-block-image size-large"><a href="https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-095921.png"><img fetchpriority="high" decoding="async" width="1024" height="430" src="https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-095921-1024x430.png" alt="Screenshot 2025 02 24 095921" class="wp-image-49530" title="Master Using the Nagios XI API 1" srcset="https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-095921-1024x430.png 1024w, https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-095921-300x126.png 300w, https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-095921-768x322.png 768w, https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-095921.png 1465w" sizes="(max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">API Error</figcaption></figure>



<p>At this point, you’ll see an error message—this is expected since no requests have been made yet. To retrieve data, you need to specify the section of the API you want to query and the resource you&#8217;re interested in. The URL should look like this:</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"><textarea class="code-block-pro-copy-button-textarea" aria-hidden="true" readonly>http://&lt;Your Nagios XI IP>/nagiosxi/api/v1/&lt;section>/&lt;resource></textarea><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">http://&lt;Your Nagios XI IP&gt;/nagiosxi/api/v1/&lt;section&gt;/&lt;resource&gt;</span></span></code></pre></div>



<p>The section refers to a main area of the API, like <code>objects</code>, <code>config</code>, or <code>system</code>, each offering access to different data or functions. For example, the <code>objects</code> section retrieves information about items like hosts and services, while the <code>config</code> section allows administrators to manage those objects. A resource is a specific data type or object within that section that you query or manipulate. In the <code>objects</code> section, a resource might be <code>hoststatus</code>, showing the current status of hosts, while in the <code>config</code> section, a resource could be service, used to manage service configurations.</p>



<p>To access the API, you&#8217;ll also need to include your API key in the URL. This key grants you access to the system and helps determine the permissions you have based on your user role. Depending on your level of access, different sections and resources may be available to you. </p>



<p>To find your API key, navigate to the admin section of Nagios XI. Once you have it, append it to the URL like this:</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"><textarea class="code-block-pro-copy-button-textarea" aria-hidden="true" readonly>http://&lt;Your Nagios XI IP>/nagiosxi/api/v1/&lt;section>/&lt;resource>?apikey=&lt;API key></textarea><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">http://&lt;Your Nagios XI IP&gt;/nagiosxi/api/v1/&lt;section&gt;/&lt;resource&gt;?apikey=&lt;API key&gt;</span></span></code></pre></div>



<p>With everything set up correctly, you should now see real data returned from the API. We’ll use the results from querying hoststatus objects as an example.</p>



<figure class="wp-block-image size-large"><a href="https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-115341.png"><img decoding="async" width="1024" height="292" src="https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-115341-1024x292.png" alt="API Query Results" class="wp-image-49560" title="Master Using the Nagios XI API 2" srcset="https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-115341-1024x292.png 1024w, https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-115341-300x85.png 300w, https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-115341-768x219.png 768w, https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-115341-1536x438.png 1536w, https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-115341.png 1902w" sizes="(max-width: 1024px) 100vw, 1024px" /></a><figcaption class="wp-element-caption">Object Host Status Query Results</figcaption></figure>



<p>By default, the output can appear a bit messy. To improve readability, you can check the Pretty-print checkbox in the UI, which automatically organizes the response. Alternatively, append <code>&amp;pretty=1</code> to the end of the URL for instant formatting. This makes the output clean, organized, and easy to digest. </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"><textarea class="code-block-pro-copy-button-textarea" aria-hidden="true" readonly>http://&lt;Your Nagios XI IP>/nagiosxi/api/v1/objects/hoststatus?apikey=&lt;API key>&amp;pretty=1</textarea><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">http://&lt;Your Nagios XI IP&gt;/nagiosxi/api/v1/objects/hoststatus?apikey=&lt;API key&gt;&amp;pretty=1</span></span></code></pre></div>



<figure class="wp-block-image size-full"><a href="https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-120446.png"><img decoding="async" width="710" height="931" src="https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-120446.png" alt="API Query results( Clean)" class="wp-image-49562" title="Master Using the Nagios XI API 3" srcset="https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-120446.png 710w, https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-24-120446-229x300.png 229w" sizes="(max-width: 710px) 100vw, 710px" /></a><figcaption class="wp-element-caption">Object Host Status Query Results Cleaned</figcaption></figure>



<p>Objects are for displaying information, while Config and System are used for adding, removing, or modifying objects. What you write will depend on the action you want to perform with the API. For tasks like editing or modifying data, you’ll need to use code, as this involves making requests that modify the system.</p>



<h2 class="wp-block-heading">Using with Code</h2>



<p>There are many reasons why you might want to access the Nagios XI API programmatically. For instance, you may want to fetch the data posted to the system, monitor host/service statuses, or edit configurations directly through your code. Interacting with the API via code provides flexibility and automation, streamlining your workflow.</p>



<p>To access the API, we can use the appropriate method for interacting with URLs in the programming language you&#8217;re working with. Since Nagios XI runs on a web-based interface, the most common language for writing programs inside Nagios XI itself is PHP.</p>



<p>Below is an example of how to access and interact with the Nagios XI API using PHP:</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"><textarea class="code-block-pro-copy-button-textarea" aria-hidden="true" readonly>&lt;?php
// Define the server IP and API token
$server_ip = &#8216;&lt;Your Nagios XI IP>&#8217;;  // Replace with your Nagios XI IP
$api_token = &#8216;&lt;Your API Key>&#8217;;  // Replace with your Nagios XI API key
// Build the URL for the API request
$url = &#8220;http://$server_ip/nagiosxi/api/v1/&lt;section>/&lt;resource>?apikey=$api_token&amp;pretty=1&#8221;;
// Initialize cURL session
$ch = curl_init();
// Set the URL for the request
curl_setopt($ch, CURLOPT_URL, $url);
// Set option to return the response as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute the request and store the response
$response = curl_exec($ch);
// Check if the request was successful
if ($response === false) {
    echo &#8220;Error: &#8221; . curl_error($ch);  // Handle errors if the request fails
} else {
    // Decode the JSON response
    $data = json_decode($response, true);
    
    // Output the response (for testing or processing)
    echo &#8220;&lt;pre>&#8221;;
    print_r($data);  // Print the data in a readable format
    echo &#8220;&lt;/pre>&#8221;;
}
// Close the cURL session
curl_close($ch);
?>
</textarea><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">&lt;?php</span></span>
<span class="line"><span style="color: #6A9955">// Define the server IP and API token</span></span>
<span class="line"><span style="color: #9CDCFE">$server_ip</span><span style="color: #D4D4D4"> = </span><span style="color: #CE9178">&#39;&lt;Your Nagios XI IP&gt;&#39;</span><span style="color: #D4D4D4">;  </span><span style="color: #6A9955">// Replace with your Nagios XI IP</span></span>
<span class="line"><span style="color: #9CDCFE">$api_token</span><span style="color: #D4D4D4"> = </span><span style="color: #CE9178">&#39;&lt;Your API Key&gt;&#39;</span><span style="color: #D4D4D4">;  </span><span style="color: #6A9955">// Replace with your Nagios XI API key</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">// Build the URL for the API request</span></span>
<span class="line"><span style="color: #9CDCFE">$url</span><span style="color: #D4D4D4"> = </span><span style="color: #CE9178">&quot;http://</span><span style="color: #9CDCFE">$server_ip</span><span style="color: #CE9178">/nagiosxi/api/v1/&lt;section&gt;/&lt;resource&gt;?apikey=</span><span style="color: #9CDCFE">$api_token</span><span style="color: #CE9178">&amp;pretty=1&quot;</span><span style="color: #D4D4D4">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">// Initialize cURL session</span></span>
<span class="line"><span style="color: #9CDCFE">$ch</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">curl_init</span><span style="color: #D4D4D4">();</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">// Set the URL for the request</span></span>
<span class="line"><span style="color: #DCDCAA">curl_setopt</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$ch</span><span style="color: #D4D4D4">, CURLOPT_URL, </span><span style="color: #9CDCFE">$url</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">// Set option to return the response as a string</span></span>
<span class="line"><span style="color: #DCDCAA">curl_setopt</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$ch</span><span style="color: #D4D4D4">, CURLOPT_RETURNTRANSFER, </span><span style="color: #569CD6">true</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">// Execute the request and store the response</span></span>
<span class="line"><span style="color: #9CDCFE">$response</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">curl_exec</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$ch</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">// Check if the request was successful</span></span>
<span class="line"><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> (</span><span style="color: #9CDCFE">$response</span><span style="color: #D4D4D4"> === </span><span style="color: #569CD6">false</span><span style="color: #D4D4D4">) {</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #DCDCAA">echo</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;Error: &quot;</span><span style="color: #D4D4D4"> </span><span style="color: #D4D4D4">.</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">curl_error</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$ch</span><span style="color: #D4D4D4">);  </span><span style="color: #6A9955">// Handle errors if the request fails</span></span>
<span class="line"><span style="color: #D4D4D4">} </span><span style="color: #C586C0">else</span><span style="color: #D4D4D4"> {</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">// Decode the JSON response</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">$data</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">json_decode</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$response</span><span style="color: #D4D4D4">, </span><span style="color: #569CD6">true</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">    </span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">// Output the response (for testing or processing)</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #DCDCAA">echo</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;&lt;pre&gt;&quot;</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #DCDCAA">print_r</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$data</span><span style="color: #D4D4D4">);  </span><span style="color: #6A9955">// Print the data in a readable format</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #DCDCAA">echo</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;&lt;/pre&gt;&quot;</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">// Close the cURL session</span></span>
<span class="line"><span style="color: #DCDCAA">curl_close</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$ch</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">?&gt;</span></span>
<span class="line"></span></code></pre></div>



<p>This code example demonstrates how to send a request to the API, process the response, and display the data in a readable format. It&#8217;s a simple and efficient way to automate interactions with Nagios XI.</p>



<p>When interacting with the Nagios XI API to modify data, such as adding a new host, the process differs significantly from simply retrieving information. Instead of making a <strong>GET</strong> request, we’ll use a <strong>POST</strong> request, which allows us to send data to the server to create or modify resources. The <code>Config</code> section of the API is used for this purpose, as it enables administrators to make changes to the Nagios XI configuration.</p>



<p>Here’s an example of how you can easily add a host to your Nagios XI setup using the API and PHP. This example walks you through how to structure the API request, send the necessary data, and handle the response. By automating the process like this, you can quickly add hosts to your Nagios XI environment, saving time and reducing the need for manual configuration.</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"><textarea class="code-block-pro-copy-button-textarea" aria-hidden="true" readonly>function add_host_via_api($api_token)
{
    // Example: Prepare the POST data
    $data = [
        &#8216;host_name&#8217;                => &#8216;testapihost&#8217;,
        &#8216;address&#8217;                  => &#8216;127.0.0.1&#8217;,
        &#8216;check_command&#8217;            => &#8216;check_ping!3000,80%!5000,100%&#8217;,
        &#8216;max_check_attempts&#8217;       => 2,
        &#8216;check_period&#8217;             => &#8217;24&#215;7&#8242;,
        &#8216;contacts&#8217;                 => &#8216;nagiosadmin&#8217;,
        &#8216;notification_interval&#8217;    => 5,
        &#8216;notification_period&#8217;      => &#8217;24&#215;7&#8242;,
        &#8216;applyconfig&#8217;              => 1
    ];
    // Set up the POST fields
    $post_fields = http_build_query($data);
    // Get the Nagios server IP address
    $server_ip = get_nagios_server_ip();
    // Prepare the URL for the API call
    $url = &#8220;http://$server_ip/nagiosxi/api/v1/config/host?apikey=$api_token&#8221;;
    // Use cURL to send the POST request
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
    // Execute the cURL request and get the response
    $response = curl_exec($ch);
    // Check for errors in the cURL request
    if ($response === false) {
        return curl_error($ch);
    }
    // Close the cURL handle
    curl_close($ch);
    // Decode the response (optional)
    $response_data = json_decode($response, true);
    
    // Check for success or failure in response
    if (isset($response_data[&#8216;error&#8217;])) {
        return &#8220;API Error: &#8221; . $response_data[&#8216;error&#8217;];
    }
    return true;  // Return true if the host was added successfully
}</textarea><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: #569CD6">function</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">add_host_via_api</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$api_token</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">// Example: Prepare the POST data</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">$data</span><span style="color: #D4D4D4"> = [</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #CE9178">&#39;host_name&#39;</span><span style="color: #D4D4D4">                =&gt; </span><span style="color: #CE9178">&#39;testapihost&#39;</span><span style="color: #D4D4D4">,</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #CE9178">&#39;address&#39;</span><span style="color: #D4D4D4">                  =&gt; </span><span style="color: #CE9178">&#39;127.0.0.1&#39;</span><span style="color: #D4D4D4">,</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #CE9178">&#39;check_command&#39;</span><span style="color: #D4D4D4">            =&gt; </span><span style="color: #CE9178">&#39;check_ping!3000,80%!5000,100%&#39;</span><span style="color: #D4D4D4">,</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #CE9178">&#39;max_check_attempts&#39;</span><span style="color: #D4D4D4">       =&gt; </span><span style="color: #B5CEA8">2</span><span style="color: #D4D4D4">,</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #CE9178">&#39;check_period&#39;</span><span style="color: #D4D4D4">             =&gt; </span><span style="color: #CE9178">&#39;24x7&#39;</span><span style="color: #D4D4D4">,</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #CE9178">&#39;contacts&#39;</span><span style="color: #D4D4D4">                 =&gt; </span><span style="color: #CE9178">&#39;nagiosadmin&#39;</span><span style="color: #D4D4D4">,</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #CE9178">&#39;notification_interval&#39;</span><span style="color: #D4D4D4">    =&gt; </span><span style="color: #B5CEA8">5</span><span style="color: #D4D4D4">,</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #CE9178">&#39;notification_period&#39;</span><span style="color: #D4D4D4">      =&gt; </span><span style="color: #CE9178">&#39;24x7&#39;</span><span style="color: #D4D4D4">,</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #CE9178">&#39;applyconfig&#39;</span><span style="color: #D4D4D4">              =&gt; </span><span style="color: #B5CEA8">1</span></span>
<span class="line"><span style="color: #D4D4D4">    ];</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">// Set up the POST fields</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">$post_fields</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">http_build_query</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$data</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">// Get the Nagios server IP address</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">$server_ip</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">get_nagios_server_ip</span><span style="color: #D4D4D4">();</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">// Prepare the URL for the API call</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">$url</span><span style="color: #D4D4D4"> = </span><span style="color: #CE9178">&quot;http://</span><span style="color: #9CDCFE">$server_ip</span><span style="color: #CE9178">/nagiosxi/api/v1/config/host?apikey=</span><span style="color: #9CDCFE">$api_token</span><span style="color: #CE9178">&quot;</span><span style="color: #D4D4D4">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">// Use cURL to send the POST request</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">$ch</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">curl_init</span><span style="color: #D4D4D4">();</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #DCDCAA">curl_setopt</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$ch</span><span style="color: #D4D4D4">, CURLOPT_URL, </span><span style="color: #9CDCFE">$url</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #DCDCAA">curl_setopt</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$ch</span><span style="color: #D4D4D4">, CURLOPT_RETURNTRANSFER, </span><span style="color: #569CD6">true</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #DCDCAA">curl_setopt</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$ch</span><span style="color: #D4D4D4">, CURLOPT_POST, </span><span style="color: #569CD6">true</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #DCDCAA">curl_setopt</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$ch</span><span style="color: #D4D4D4">, CURLOPT_POSTFIELDS, </span><span style="color: #9CDCFE">$post_fields</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">// Execute the cURL request and get the response</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">$response</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">curl_exec</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$ch</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">// Check for errors in the cURL request</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> (</span><span style="color: #9CDCFE">$response</span><span style="color: #D4D4D4"> === </span><span style="color: #569CD6">false</span><span style="color: #D4D4D4">) {</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #C586C0">return</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">curl_error</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$ch</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">// Close the cURL handle</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #DCDCAA">curl_close</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$ch</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">// Decode the response (optional)</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">$response_data</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">json_decode</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$response</span><span style="color: #D4D4D4">, </span><span style="color: #569CD6">true</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">    </span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #6A9955">// Check for success or failure in response</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> (</span><span style="color: #DCDCAA">isset</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">$response_data</span><span style="color: #D4D4D4">[</span><span style="color: #CE9178">&#39;error&#39;</span><span style="color: #D4D4D4">])) {</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #C586C0">return</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;API Error: &quot;</span><span style="color: #D4D4D4"> </span><span style="color: #D4D4D4">.</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">$response_data</span><span style="color: #D4D4D4">[</span><span style="color: #CE9178">&#39;error&#39;</span><span style="color: #D4D4D4">];</span></span>
<span class="line"><span style="color: #D4D4D4">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #C586C0">return</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">true</span><span style="color: #D4D4D4">;  </span><span style="color: #6A9955">// Return true if the host was added successfully</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<p>Once the request is made, the response will let you know if the host was added successfully or if there were any issues. We’ve included error handling to catch potential problems, such as network errors or invalid parameters. If everything goes as planned, the function will return <code>true</code>, confirming the host was added with no issues.</p>



<p>This example highlights how modifying your Nagios XI configuration through the API is quite different from just retrieving data. With <strong>POST</strong> requests, you gain the ability to create, update, and delete resources, giving you full control over your Nagios XI instance.</p>



<p>The other types of calls that can be made are <strong>PUT </strong>requests which are used to edit existing data in the API and <strong>DELETE </strong>requests, which deletes aspects of the API. We are going to finish with a look at a <strong>DELETE </strong>request to the API.</p>



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



<p>The Nagios XI API is a powerful tool for managing your Nagios XI instance, offering programmatic access to key data and configuration management capabilities. By following the steps outlined here, you can quickly integrate the API into your processes, improving your workflow. Whether you&#8217;re querying status data, managing configurations, or integrating with other systems, the Nagios XI API gives you the flexibility to enhance your Nagios XI experience.</p>



<p>For additional assistance, be sure to check the Nagios XI help section for more in-depth resources and support regarding the API. </p>



<figure class="wp-block-image size-full"><a href="https://library.nagios.com/wp-content/uploads/2025/03/Screenshot-2025-04-02-111353marked.png"><img loading="lazy" decoding="async" width="278" height="482" src="https://library.nagios.com/wp-content/uploads/2025/03/Screenshot-2025-04-02-111353marked.png" alt="API help location " class="wp-image-54096" title="Master Using the Nagios XI API 4" srcset="https://library.nagios.com/wp-content/uploads/2025/03/Screenshot-2025-04-02-111353marked.png 278w, https://library.nagios.com/wp-content/uploads/2025/03/Screenshot-2025-04-02-111353marked-173x300.png 173w" sizes="(max-width: 278px) 100vw, 278px" /></a><figcaption class="wp-element-caption">Where the API docs are located</figcaption></figure>



<p></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How to Integrate MultiTech MTR API with Nagios XI</title>
		<link>https://library.nagios.com/documentation/how-to-integrate-multitech-mtr-api-with-nagios-xi/</link>
		
		<dc:creator><![CDATA[Ayoub Louragli]]></dc:creator>
		<pubDate>Fri, 07 Mar 2025 21:06:20 +0000</pubDate>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Integration]]></category>
		<guid isPermaLink="false">https://library.nagios.com/?p=51712</guid>

					<description><![CDATA[Nagios XI is a robust network monitoring system that can be extended with various integrations to enhance its functionality. One such integration is with MultiTech’s MultiConnect® rCell Series Router (MTR) API, allowing administrators to send SMS notifications directly from Nagios XI. This guide will walk you through the process of integrating the MultiTech MTR API [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Nagios XI is a robust network monitoring system that can be extended with various integrations to enhance its functionality. One such integration is with <strong>MultiTech’s MultiConnect® rCell Series Router (MTR) API</strong>, allowing administrators to send <strong>SMS notifications</strong> directly from Nagios XI.</p>



<p>This guide will walk you through the process of integrating the MultiTech MTR API with Nagios XI, covering configuration, installation, and enabling SMS alerts for users.</p>



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



<p>Before proceeding with the integration, ensure you have the following:</p>



<ul class="wp-block-list">
<li><strong>Nagios XI (version 5.5 or newer)</strong> installed and running.</li>



<li><strong>MultiConnect rCell Series Router</strong> from MultiTech.</li>



<li><strong>Administrator access</strong> to both Nagios XI and the MultiTech MTR device.</li>



<li><strong>Network access</strong> between the Nagios XI server and the MTR device.</li>
</ul>



<h2 class="wp-block-heading">Step 1: Configure MultiTech MTR</h2>



<figure class="wp-block-image size-full"><a href="https://library.nagios.com/wp-content/uploads/2025/03/Picture4.jpg"><img loading="lazy" decoding="async" width="561" height="285" src="https://library.nagios.com/wp-content/uploads/2025/03/Picture4.jpg" alt="Picture4" class="wp-image-51715" title="How to Integrate MultiTech MTR API with Nagios XI 5" srcset="https://library.nagios.com/wp-content/uploads/2025/03/Picture4.jpg 561w, https://library.nagios.com/wp-content/uploads/2025/03/Picture4-300x152.jpg 300w" sizes="(max-width: 561px) 100vw, 561px" /></a><figcaption class="wp-element-caption">MTR</figcaption></figure>



<h3 class="wp-block-heading">Enable HTTPS Access</h3>



<p>Nagios XI communicates with the MultiTech MTR device via <strong>HTTPS</strong> (port 443 by default). Ensure this is enabled in the router settings:</p>



<ol class="wp-block-list">
<li><strong>Login</strong> to the MTR device.</li>



<li>Navigate to <strong>Administration &gt; Access Configuration &gt; Web Server &gt; HTTPS</strong>.</li>



<li>Ensure the port is set to <strong>443</strong> (or another preferred port).</li>
</ol>



<h3 class="wp-block-heading">Enable SMS Functionality</h3>



<p>For SMS alerts to work, ensure that SMS functionality is enabled on the MTR device:</p>



<ol class="wp-block-list">
<li>Go to <strong>SMS &gt; SMS Configuration &gt; SMS Settings</strong>.</li>



<li><strong>Enable SMS messaging</strong> if it is not already active.</li>
</ol>



<h3 class="wp-block-heading">Create a Dedicated User for Nagios XI</h3>



<p>To avoid authentication conflicts, create an administrator account specifically for Nagios XI:</p>



<ol class="wp-block-list">
<li>Navigate to <strong>Administration &gt; User Accounts</strong>.</li>



<li><strong>Create a new user account</strong> for Nagios XI.</li>
</ol>



<h2 class="wp-block-heading">Step 2: Install the MTR Component in Nagios XI</h2>



<p>To integrate MultiTech MTR API with Nagios XI, you need to install the <strong>Nagios XI MTR Component</strong>:</p>



<ol class="wp-block-list">
<li>Download the MTR component:
<ul class="wp-block-list">
<li><strong>URL</strong>: <a href="https://assets.nagios.com/downloads/nagiosxi/components/xi55/mtr.zip" target="_blank" rel="noopener">https://assets.nagios.com/downloads/nagiosxi/components/xi55/mtr.zip</a></li>
</ul>
</li>



<li><strong>Login</strong> to Nagios XI as an administrator.</li>



<li>Navigate to <strong>Admin &gt; System Extensions &gt; Manage Components</strong>.</li>



<li>Upload the <strong>mtr.zip</strong> file.</li>
</ol>



<h2 class="wp-block-heading">Step 3: Configure the MTR Component in Nagios XI</h2>



<p>Once the component is installed, configure it as follows:</p>



<ol class="wp-block-list">
<li>Navigate to <strong>Admin &gt; System Extensions &gt; Manage Components</strong>.</li>



<li>Locate the <strong>MultiTech MTR Component</strong> and click the settings icon.</li>



<li>On the <strong>MultiTech MTR Integration screen</strong>, configure the following:
<ul class="wp-block-list">
<li><strong>Enable Integration</strong>: Check this box.</li>



<li><strong>IP Address or Hostname</strong>: Enter the IP address or domain of the MTR device.</li>



<li><strong>HTTPS Port</strong>: Ensure this matches the MTR configuration (default <strong>443</strong>).</li>



<li><strong>Username and Password</strong>: Enter the credentials for the dedicated Nagios XI user.</li>
</ul>
</li>



<li>Click <strong>Apply Settings</strong> to save the configuration.</li>
</ol>



<figure class="wp-block-image size-full"><a href="https://library.nagios.com/wp-content/uploads/2025/03/Picture5.jpg"><img loading="lazy" decoding="async" width="415" height="430" src="https://library.nagios.com/wp-content/uploads/2025/03/Picture5.jpg" alt="Picture5" class="wp-image-51716" title="How to Integrate MultiTech MTR API with Nagios XI 6" srcset="https://library.nagios.com/wp-content/uploads/2025/03/Picture5.jpg 415w, https://library.nagios.com/wp-content/uploads/2025/03/Picture5-290x300.jpg 290w" sizes="(max-width: 415px) 100vw, 415px" /></a><figcaption class="wp-element-caption">Component configuration</figcaption></figure>



<h2 class="wp-block-heading">Step 4: Enable SMS Alerts for Users</h2>



<p>Each user in Nagios XI who wants to receive SMS notifications must enable them manually:</p>



<ol class="wp-block-list">
<li>Navigate to <strong>User Account Settings</strong>.</li>



<li>Select <strong>Notification Methods</strong> and click the <strong>MTR tab</strong>.</li>



<li>Check the <strong>SMS Text Message</strong> option.</li>



<li>Enter the <strong>mobile phone number</strong> where alerts should be sent.</li>



<li>Click <strong>Update Settings</strong> to enable SMS notifications.</li>
</ol>



<h2 class="wp-block-heading">Step 5: Customize SMS Alert Messages</h2>



<p>Nagios XI allows users to customize SMS alerts using notification macros:</p>



<ol class="wp-block-list">
<li>Navigate to <strong>User Account Settings</strong>.</li>



<li>Click on <strong>Notification Messages</strong> and go to the <strong>MTR tab</strong>.</li>



<li>Customize the format for <strong>host and service alerts</strong> using macros.</li>



<li>Save the changes.</li>
</ol>



<p>For more details on macros, refer to:<br><a href="https://assets.nagios.com/downloads/nagiosxi/docs/Understanding-Nagios-XI-Notification-Variables.pdf" target="_blank" rel="noopener">Understanding Nagios XI Notification Variables</a></p>



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



<p>Integrating MultiTech MTR API with Nagios XI allows administrators to send SMS alerts directly from Nagios XI, enhancing real-time monitoring and response capabilities. By following the steps outlined above, you can successfully configure and enable this integration.</p>



<p>For additional support, visit:</p>



<ul class="wp-block-list">
<li><strong>Nagios Support Forums</strong>: <a href="https://support.nagios.com/forum/" target="_blank" rel="noopener">https://support.nagios.com/forum/</a></li>



<li><strong>Nagios Knowledgebase</strong>: <a href="https://support.nagios.com/kb/" target="_blank" rel="noopener">https://support.nagios.com/kb/</a></li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Monitoring Unconfigured Objects with Nagios XI: A Comprehensive Guide</title>
		<link>https://library.nagios.com/documentation/monitoring-unconfigured-objects-with-nagios-xi-a-comprehensive-guide/</link>
		
		<dc:creator><![CDATA[Ayoub Louragli]]></dc:creator>
		<pubDate>Fri, 07 Mar 2025 16:29:38 +0000</pubDate>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[API]]></category>
		<guid isPermaLink="false">https://library.nagios.com/?p=51626</guid>

					<description><![CDATA[Nagios XI provides a robust monitoring solution that can track the health of various IT infrastructures. One key feature is its ability to process passive check results from external agents via the NSCA (Nagios Service Check Acceptor) or NRDP (Nagios Remote Data Processor) APIs. However, passive check results for hosts and services are not automatically [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Nagios XI provides a robust monitoring solution that can track the health of various IT infrastructures. One key feature is its ability to process passive check results from external agents via the NSCA (Nagios Service Check Acceptor) or NRDP (Nagios Remote Data Processor) APIs. However, passive check results for hosts and services are not automatically processed unless they are pre-configured in Nagios XI. This article outlines the steps to monitor unconfigured objects in Nagios XI effectively.</p>



<h2 class="wp-block-heading">Understanding Passive Check Processing</h2>



<p>Passive check results can be submitted by external applications and agents to Nagios XI. However, when a passive result is received for a host or service that has not been configured, it is ignored by the monitoring engine. Instead, such hosts and services appear in the <strong>Unconfigured Objects</strong> interface of Nagios XI, allowing administrators to take action.</p>



<figure class="wp-block-image size-full"><a href="https://library.nagios.com/wp-content/uploads/2025/03/Pic.jpg"><img loading="lazy" decoding="async" width="322" height="320" src="https://library.nagios.com/wp-content/uploads/2025/03/Pic.jpg" alt="Pic" class="wp-image-51633" title="Monitoring Unconfigured Objects with Nagios XI: A Comprehensive Guide 7" srcset="https://library.nagios.com/wp-content/uploads/2025/03/Pic.jpg 322w, https://library.nagios.com/wp-content/uploads/2025/03/Pic-300x298.jpg 300w, https://library.nagios.com/wp-content/uploads/2025/03/Pic-150x150.jpg 150w" sizes="(max-width: 322px) 100vw, 322px" /></a><figcaption class="wp-element-caption">Unconfigured Objects Processing Diagram </figcaption></figure>



<h2 class="wp-block-heading">Managing Unconfigured Objects in Nagios XI</h2>



<h3 class="wp-block-heading">Navigating to Unconfigured Objects</h3>



<p>To review unconfigured objects:</p>



<ol start="1" class="wp-block-list">
<li>Go to <strong>Admin > Monitoring Config > Unconfigured Objects</strong>.</li>



<li>The list will display hosts or services that have received passive results but are not yet monitored.</li>
</ol>



<figure class="wp-block-image size-full"><a href="https://library.nagios.com/wp-content/uploads/2025/03/Pic1.jpg"><img loading="lazy" decoding="async" width="707" height="405" src="https://library.nagios.com/wp-content/uploads/2025/03/Pic1.jpg" alt="Pic1" class="wp-image-51635" title="Monitoring Unconfigured Objects with Nagios XI: A Comprehensive Guide 8" srcset="https://library.nagios.com/wp-content/uploads/2025/03/Pic1.jpg 707w, https://library.nagios.com/wp-content/uploads/2025/03/Pic1-300x172.jpg 300w" sizes="(max-width: 707px) 100vw, 707px" /></a><figcaption class="wp-element-caption">Unconfigured Objects</figcaption></figure>



<h3 class="wp-block-heading">Adding Unconfigured Objects to Monitoring</h3>



<p>To integrate unconfigured objects into Nagios XI monitoring:</p>



<h4 class="wp-block-heading">Adding a Single Host with Services</h4>



<ul class="wp-block-list">
<li>Click the <strong>play button</strong> next to the unconfigured host to run the <strong>Unconfigured Passive Object wizard</strong>.</li>
</ul>



<h4 class="wp-block-heading">Adding Multiple Hosts with Services</h4>



<ul class="wp-block-list">
<li>Select multiple hosts from the list by checking their boxes.</li>



<li>Click the <strong>gear icon</strong> at the bottom of the list.</li>



<li>Follow the wizard steps, configure settings (notifications, groups, parents), and apply the configuration.</li>



<li>Once applied, these objects will disappear from the Unconfigured Objects section and appear in the monitoring dashboard.</li>
</ul>



<figure class="wp-block-image size-full"><a href="https://library.nagios.com/wp-content/uploads/2025/03/Pic3.jpg"><img loading="lazy" decoding="async" width="705" height="163" src="https://library.nagios.com/wp-content/uploads/2025/03/Pic3.jpg" alt="Pic3" class="wp-image-51641" title="Monitoring Unconfigured Objects with Nagios XI: A Comprehensive Guide 9" srcset="https://library.nagios.com/wp-content/uploads/2025/03/Pic3.jpg 705w, https://library.nagios.com/wp-content/uploads/2025/03/Pic3-300x69.jpg 300w" sizes="(max-width: 705px) 100vw, 705px" /></a><figcaption class="wp-element-caption">status details</figcaption></figure>



<h2 class="wp-block-heading">Automating the Configuration of Unconfigured Objects</h2>



<p>Nagios XI version 5.5 introduced <strong>Auto Configure Settings</strong>, which allows automatic creation of monitoring objects from passive check results. To enable this feature:</p>



<ol start="1" class="wp-block-list">
<li>Go to the <strong>Auto Configure Settings</strong> tab.</li>



<li>Check <strong>Enable Auto Import</strong> to allow Nagios XI to import objects into the Core Config Manager (CCM).</li>



<li>(Optional) Enable <strong>Apply Configuration</strong> to automatically add newly imported objects to Nagios XI’s running configuration.</li>
</ol>



<h3 class="wp-block-heading">Customizing Auto Configuration</h3>



<ul class="wp-block-list">
<li><strong>Notifications</strong>: Define notification settings for new objects.</li>



<li><strong>Groups</strong>: Assign objects to specific host or service groups.</li>



<li><strong>Advanced Settings</strong>: Configure stalking, volatility, and use templates such as <code>xiwizard_passive_host</code> or <code>xiwizard_snmptrap_host</code> for SNMP Traps.</li>
</ul>



<p><strong>Note</strong>: Automatic imports occur every 60 seconds as part of Nagios XI’s background processes.</p>



<h2 class="wp-block-heading">Removing Unwanted Unconfigured Objects</h2>



<p>Unwanted unconfigured objects can be removed using:</p>



<ul class="wp-block-list">
<li><strong>Remove All</strong>: Click <strong>Clear Unconfigured Objects List</strong> to delete all.</li>



<li><strong>Remove One Host with Services</strong>: Click <strong>Delete</strong> next to the host.</li>



<li><strong>Remove Multiple Hosts with Services</strong>: Select hosts and click the <strong>X icon</strong>.</li>
</ul>



<p><strong>Important</strong>: Deleted objects will reappear if more passive results are received. To prevent this, stop unwanted passive checks to conserve system resources.</p>



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



<p>Monitoring unconfigured objects in Nagios XI ensures that all relevant hosts and services are properly integrated into the system. By leveraging the <strong>Unconfigured Objects</strong> interface, administrators can manually or automatically import necessary hosts and services into monitoring. Proper configuration management helps maintain an efficient and reliable monitoring environment.</p>



<p>For further guidance, visit the <a href="https://support.nagios.com/forum" target="_blank" rel="noopener">Nagios Support Forums</a> or check the <a href="https://support.nagios.com/kb" target="_blank" rel="noopener">Nagios Knowledgebase</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<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 loading="lazy" 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 10" 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 loading="lazy" 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 11" 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 loading="lazy" 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 12" 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>
		<item>
		<title>Nagios XI – MultiTech MTR API Integration</title>
		<link>https://library.nagios.com/documentation/nagios-xi-multitech-mtr-api-integration-2/</link>
		
		<dc:creator><![CDATA[Ethan Galstad]]></dc:creator>
		<pubDate>Thu, 14 Nov 2024 03:19:34 +0000</pubDate>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[API]]></category>
		<guid isPermaLink="false">https://newlibrary.nagios.com/?post_type=nagios-xi-document&#038;p=3273</guid>

					<description><![CDATA[This document describes how to integrate the MTR API found on a MultiConnect® rCell Series Router from MultiTech with Nagios XI. It will work with Nagios XI version 5.5 and newer. Nagios XI uses this API to send text notifications to recipients. This document is intended for use by Nagios Administrators experienced with installing and [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>This document describes how to integrate the MTR API found on a MultiConnect® rCell Series Router from MultiTech with Nagios XI. It will work with Nagios XI version 5.5 and newer. Nagios XI uses this API to send text notifications to recipients.</p>



<p>This document is intended for use by Nagios Administrators experienced with installing and configuring network devices.</p>



<p><strong>MultiTech MTR API Integration with Nagios XI &#8211; 2024 &amp; 2026</strong></p>



<p><a href="https://assets.nagios.com/downloads/nagiosxi/docs/MultiTech-MTR-API-Integration-With-XI-2024.pdf" target="_blank" rel="noreferrer noopener">MultTech MTR API Integration with XI 2026</a></p>



<p><strong>MultiTech MTR API Integration with Nagios XI &#8211; v5 (Legacy) </strong></p>



<p><a href="https://assets.nagios.com/downloads/nagiosxi/docs/MultiTech-MTR-API-Integration-With-XI.pdf" target="_blank" rel="noreferrer noopener">MultiTech MTR API Integration with XI 5</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Monitoring Unconfigured Objects With Nagios XI</title>
		<link>https://library.nagios.com/documentation/monitoring-unconfigured-objects-with-nagios-xi/</link>
		
		<dc:creator><![CDATA[Ethan Galstad]]></dc:creator>
		<pubDate>Sun, 06 Mar 2011 05:38:04 +0000</pubDate>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[NRDP]]></category>
		<category><![CDATA[NSCA]]></category>
		<guid isPermaLink="false">https://libtest.nagios.com/library/products/nagios-xi/documentation/monitoring-unconfigured-objects-with-nagios-xi/</guid>

					<description><![CDATA[Passive check results for hosts and services that are submitted to Nagios by external agents and applications using the NSCA or NRDP APIs are not processed by the monitoring engine until they are configured in Nagios XI. This document describes how to configure monitoring of previously unconfigured hosts and services for which a Nagios XI [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Passive check results for hosts and services that are submitted to Nagios by external agents and applications using the NSCA or NRDP APIs are not processed by the monitoring engine until they are configured in Nagios XI. This document describes how to configure monitoring of previously unconfigured hosts and services for which a Nagios XI server has received passive check results.</p>



<p><strong>Monitoring Unconfigured Objects with Nagios XI &#8211; 2024 &amp; 2026</strong></p>



<p><a href="https://assets.nagios.com/downloads/nagiosxi/docs/Monitoring-Unconfigured-Objects-2024.pdf" target="_blank" rel="noopener">Monitoring Unconfigured Objects with XI 2026</a></p>



<p><strong>Monitoring Unconfigured Objects with Nagios XI &#8211; v5 (Legacy) </strong></p>



<p><a href="https://assets.nagios.com/downloads/nagiosxi/docs/Monitoring_Unconfigured_Objects_With_XI.pdf" target="_blank" rel="noreferrer noopener">Monitoring Unconfigured Objects with XI 5</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Nagios XI Backend API Example Code</title>
		<link>https://library.nagios.com/documentation/nagios-xi-backend-api-example-code/</link>
		
		<dc:creator><![CDATA[Ethan Galstad]]></dc:creator>
		<pubDate>Mon, 30 Aug 2010 21:08:00 +0000</pubDate>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[API]]></category>
		<guid isPermaLink="false">https://newlibrary.nagios.com/?post_type=nagios-xi-document&#038;p=3209</guid>

					<description><![CDATA[If you&#8217;d like to integrate host/status information from Nagios XI into a public portal or display of some kind, you&#8217;ll likely be interested in our example backend API access code. The ZIP file below contains some sample code for accessing the backend API. You can modify as needed. The access credentials are invisible to the [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>If you&#8217;d like to integrate host/status information from Nagios XI into a public portal or display of some kind, you&#8217;ll likely be interested in our example backend API access code.</p>



<p>The ZIP file below contains some sample code for accessing the backend API. You can modify as needed. The access credentials are invisible to the public, and the information to be displayed can be customized (if you don&#8217;t mind diving into some PHP).</p>



<p><a href="https://assets.nagios.com/downloads/nagiosxi/misc/backendapi-example.zip" target="_blank" rel="noreferrer noopener">backendapi-example.zip</a></p>



<p><strong>Note for Nagios XI 2024 &amp; 2026 Users</strong></p>



<p>Modern versions of Nagios XI now include a REST API, rather than the legacy Backend API. </p>



<p>This document outlines using the REST API to fetch data in JSON format, and to programmatically control your XI system and configurations:</p>



<p><a href="https://assets.nagios.com/downloads/nagiosxi/docs/Accessing-and-Using-the-XI-REST-API.pdf" target="_blank" rel="noreferrer noopener">How to Access and Use the Nagios XI REST API</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Google Map Integration For Nagios XI</title>
		<link>https://library.nagios.com/documentation/google-map-integration-for-nagios-xi/</link>
		
		<dc:creator><![CDATA[Ethan Galstad]]></dc:creator>
		<pubDate>Wed, 21 Jul 2010 20:54:00 +0000</pubDate>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[API]]></category>
		<guid isPermaLink="false">https://newlibrary.nagios.com/?post_type=nagios-xi-document&#038;p=3262</guid>

					<description><![CDATA[The Google Map component for Nagios XI 5 allowed for host status to be displayed as an overlay on a Google Map.  Although Google Map integration is no longer supported, users of modern Nagios XI versions can leverage the World Map component to achieve similar results: Using the Nagios XI World Map]]></description>
										<content:encoded><![CDATA[
<p>The Google Map component for Nagios XI 5 allowed for host status to be displayed as an overlay on a Google Map.  </p>



<p>Although Google Map integration is no longer supported, users of modern Nagios XI versions can leverage the World Map component to achieve similar results:</p>



<p><a href="https://assets.nagios.com/downloads/nagiosxi/docs/Using-the-Nagios-XI-World-Map-in-Nagios-XI-2024.pdf" target="_blank" rel="noreferrer noopener">Using the Nagios XI World Map </a></p>



<p></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Accessing the Nagios XI API</title>
		<link>https://library.nagios.com/documentation/accessing-the-nagios-xi-backend-api/</link>
		
		<dc:creator><![CDATA[Ethan Galstad]]></dc:creator>
		<pubDate>Fri, 11 Jun 2010 02:16:00 +0000</pubDate>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[API]]></category>
		<guid isPermaLink="false">https://newlibrary.nagios.com/?post_type=nagios-xi-document&#038;p=3206</guid>

					<description><![CDATA[Learn how to access and query Nagios XI's  backend API.]]></description>
										<content:encoded><![CDATA[
<p>Nagios XI includes an API that allows developers to pull current status information and more in XML (XI 5, old API) or JSON (XI 2024 &amp; 2026, modern API) format for use by external systems. This simple API makes it easy to integrate Nagios information into third-party applications and external websites and to programmatically manage the XI system and configurations. This document describes how to access to API and query information.</p>



<p><strong>Nagios XI 2024 &amp; 2026 &#8211; REST API</strong></p>



<p><a href="https://assets.nagios.com/downloads/nagiosxi/docs/Accessing-and-Using-the-XI-REST-API.pdf" target="_blank" rel="noopener">How to Access and Use the Nagios XI REST API</a></p>



<p><strong>Nagios XI v5 (Legacy) &#8211; Backend API</strong></p>



<p><a href="https://assets.nagios.com/downloads/nagiosxi/docs/Accessing_The_XI_Backend_API.pdf" target="_blank" rel="noreferrer noopener">Accessing the Nagios XI 5 Legacy Backend API</a></p>



<p></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
