<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.nixos.org/w/index.php?action=history&amp;feed=atom&amp;title=Nagios</id>
	<title>Nagios - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.nixos.org/w/index.php?action=history&amp;feed=atom&amp;title=Nagios"/>
	<link rel="alternate" type="text/html" href="https://wiki.nixos.org/w/index.php?title=Nagios&amp;action=history"/>
	<updated>2026-06-22T16:29:25Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://wiki.nixos.org/w/index.php?title=Nagios&amp;diff=7500&amp;oldid=prev</id>
		<title>imported&gt;Ciarandg: Fix module syntax</title>
		<link rel="alternate" type="text/html" href="https://wiki.nixos.org/w/index.php?title=Nagios&amp;diff=7500&amp;oldid=prev"/>
		<updated>2022-09-30T20:40:43Z</updated>

		<summary type="html">&lt;p&gt;Fix module syntax&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 20:40, 30 September 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l51&quot;&gt;Line 51:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 51:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Now a possible configuration looks like this:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Now a possible configuration looks like this:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{file|/etc/nixos/configuration.nix|nix|&amp;lt;nowiki&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{file|/etc/nixos/configuration.nix|nix|&amp;lt;nowiki&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{config, &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pkg&lt;/del&gt;, lib, ...}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{config, &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pkgs&lt;/ins&gt;, lib, ...}&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      # [...]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      # [...]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key mediawiki:diff:1.41:old-7499:rev-7500:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;Ciarandg</name></author>
	</entry>
	<entry>
		<id>https://wiki.nixos.org/w/index.php?title=Nagios&amp;diff=7499&amp;oldid=prev</id>
		<title>imported&gt;Nix: add Software/Applications subcategory</title>
		<link rel="alternate" type="text/html" href="https://wiki.nixos.org/w/index.php?title=Nagios&amp;diff=7499&amp;oldid=prev"/>
		<updated>2021-09-20T06:12:18Z</updated>

		<summary type="html">&lt;p&gt;add Software/Applications subcategory&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 06:12, 20 September 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l109&quot;&gt;Line 109:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 109:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/nowiki&amp;gt;}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/nowiki&amp;gt;}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Applications]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key mediawiki:diff:1.41:old-7498:rev-7499:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;Nix</name></author>
	</entry>
	<entry>
		<id>https://wiki.nixos.org/w/index.php?title=Nagios&amp;diff=7498&amp;oldid=prev</id>
		<title>imported&gt;Symphorien: add nagios page to describe how to configure the web interface</title>
		<link rel="alternate" type="text/html" href="https://wiki.nixos.org/w/index.php?title=Nagios&amp;diff=7498&amp;oldid=prev"/>
		<updated>2020-04-12T19:24:05Z</updated>

		<summary type="html">&lt;p&gt;add nagios page to describe how to configure the web interface&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Nagios is a monitoring daemon. It comprises the daemon itself, and a web interface.&lt;br /&gt;
&lt;br /&gt;
=== Daemon configuration ===&lt;br /&gt;
&lt;br /&gt;
The simplest way of having the Nagios daemon run is to write its configuration in a &amp;lt;code&amp;gt;main.cfg&amp;lt;/code&amp;gt; alongside &amp;lt;code&amp;gt;configuration.nix&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/nixos&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Then&lt;br /&gt;
{{file|/etc/nixos/configuration.nix|nix|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
{config, pkg, lib, ...}&lt;br /&gt;
{&lt;br /&gt;
   # [...]&lt;br /&gt;
   services.nagios = {&lt;br /&gt;
      enable = true;&lt;br /&gt;
      objectDefs = [ ./main.cfg ];&lt;br /&gt;
   };&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
{{Evaluate}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Nagios configuration files contain a lot of boilerplate, it is possible to reuse some of the default configuration files. For example to reuse &amp;lt;code&amp;gt;templates.cfg&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;timeperiods.cfg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;commands.cfg&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;nix&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    services.nagios.objectDefs =&lt;br /&gt;
      (map (x: &amp;quot;${pkgs.nagios}/etc/objects/${x}.cfg&amp;quot;) [ &amp;quot;templates&amp;quot; &amp;quot;timeperiods&amp;quot; &amp;quot;commands&amp;quot; ]) ++&lt;br /&gt;
      [ ./main.cfg ];&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To enable verbose logging into &amp;lt;code&amp;gt;/var/log/nagios/debug.log&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;nix&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    services.nagios.extraConfig = {&lt;br /&gt;
        debug_level = &amp;quot;-1&amp;quot;;&lt;br /&gt;
        debug_file = &amp;quot;/var/log/nagios/debug.log&amp;quot;;&lt;br /&gt;
     };&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
The NixOS module for Nagios does not automatically configure the web interface for your favorite web server. The section below describes a possible configuration for [[Nginx]].&lt;br /&gt;
&lt;br /&gt;
The web interface does not handle authentication; instead it is delegated to the web server. We will use HTTP basic authentication. This is only safe over HTTPS, of course. You need to create a htpasswd file readable by the nginx user only:&lt;br /&gt;
{{Commands|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
htpasswd -c /var/lib/nagios/htpasswd admin_account&lt;br /&gt;
chmod 0440 /var/lib/nagios/htpasswd&lt;br /&gt;
chown nginx:nginx /var/lib/nagios/htpasswd &lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Now a possible configuration looks like this:&lt;br /&gt;
{{file|/etc/nixos/configuration.nix|nix|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
{config, pkg, lib, ...}&lt;br /&gt;
{&lt;br /&gt;
     # [...]&lt;br /&gt;
     services.phpfpm.pools.nagios = {&lt;br /&gt;
        user = &amp;quot;nagios&amp;quot;;&lt;br /&gt;
        settings = {&lt;br /&gt;
          &amp;quot;listen.owner&amp;quot; = config.services.nginx.user;&lt;br /&gt;
          &amp;quot;pm&amp;quot; = &amp;quot;ondemand&amp;quot;;&lt;br /&gt;
          &amp;quot;pm.max_children&amp;quot; = 2;&lt;br /&gt;
          &amp;quot;pm.process_idle_timeout&amp;quot; = &amp;quot;60s&amp;quot;;&lt;br /&gt;
          &amp;quot;pm.max_requests&amp;quot; = 200;&lt;br /&gt;
        };&lt;br /&gt;
      };&lt;br /&gt;
      services.fcgiwrap = {&lt;br /&gt;
        enable = true;&lt;br /&gt;
        user = &amp;quot;nagios&amp;quot;;&lt;br /&gt;
      };&lt;br /&gt;
      services.nginx.virtualHosts.&amp;quot;nagios.example.com&amp;quot; = {&lt;br /&gt;
        forceSSL = true;&lt;br /&gt;
        enableACME = true;&lt;br /&gt;
        root = &amp;quot;${pkgs.nagios}/share/&amp;quot;;&lt;br /&gt;
        extraConfig = &amp;#039;&amp;#039;&lt;br /&gt;
          index index.php;&lt;br /&gt;
          auth_basic &amp;quot;Nagios&amp;quot;;&lt;br /&gt;
          auth_basic_user_file /var/lib/nagios/htpasswd;&lt;br /&gt;
        &amp;#039;&amp;#039;;&lt;br /&gt;
        locations = {&lt;br /&gt;
          &amp;quot;/&amp;quot;.tryFiles = &amp;quot;$uri /index.php&amp;quot;;&lt;br /&gt;
          &amp;quot;/nagios/&amp;quot;.alias = &amp;quot;${pkgs.nagios}/share/&amp;quot;;&lt;br /&gt;
          &amp;quot;~ \\.cgi$&amp;quot; = {&lt;br /&gt;
            root = &amp;quot;${pkgs.nagios}/sbin/&amp;quot;;&lt;br /&gt;
            extraConfig = &amp;#039;&amp;#039;&lt;br /&gt;
              rewrite ^/nagios/cgi-bin/(.*)$ /$1;&lt;br /&gt;
&lt;br /&gt;
              include ${pkgs.nginx}/conf/fastcgi.conf;&lt;br /&gt;
              include ${pkgs.nginx}/conf/fastcgi_params;&lt;br /&gt;
&lt;br /&gt;
              fastcgi_param AUTH_USER       $remote_user;&lt;br /&gt;
              fastcgi_param REMOTE_USER     $remote_user;&lt;br /&gt;
              fastcgi_param SCRIPT_FILENAME ${pkgs.nagios}/share/sbin$fastcgi_script_name;  &lt;br /&gt;
&lt;br /&gt;
              fastcgi_pass unix:${config.services.fcgiwrap.socketAddress};&lt;br /&gt;
            &amp;#039;&amp;#039;;&lt;br /&gt;
          };&lt;br /&gt;
          &amp;quot;~* \\.php$&amp;quot; = {&lt;br /&gt;
            tryFiles = &amp;quot;$uri =404&amp;quot;;&lt;br /&gt;
            extraConfig = &amp;#039;&amp;#039;&lt;br /&gt;
              include ${pkgs.nginx}/conf/fastcgi_params;&lt;br /&gt;
              include ${pkgs.nginx}/conf/fastcgi.conf;&lt;br /&gt;
              fastcgi_split_path_info ^(.+\.php)(/.+)$;&lt;br /&gt;
              fastcgi_pass unix:${config.services.phpfpm.pools.nagios.socket};&lt;br /&gt;
              fastcgi_index index.php;&lt;br /&gt;
            &amp;#039;&amp;#039;;&lt;br /&gt;
          };&lt;br /&gt;
        };&lt;br /&gt;
      };&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;/div&gt;</summary>
		<author><name>imported&gt;Symphorien</name></author>
	</entry>
</feed>