How to Install Adagios on NixOS Latest

Adagios is a web-based Nagios configuration interface that provides an easy way to keep an eye on your entire infrastructure. In this tutorial, we will guide you step-by-step on how to install Adagios on NixOS Latest.

Prerequisites

Before you proceed, ensure that you have the following prerequisites:

  • A server running NixOS Latest
  • A user account with sudo privileges
  • A web browser for accessing Adagios web interface

Step 1: Update the System

First, update the installed packages and the NixOS system:

sudo nix-channel --update
sudo nixos-rebuild switch

Step 2: Install Adagios

To install Adagios, add the following lines to the system configuration file /etc/nixos/configuration.nix:

nixpkgs.config.packageOverrides = pkgs: {
  adagios = pkgs.callPackage (pkgs.fetchurl {
    url = "http://sourceforge.net/projects/adagios/files/adagios/1.6.3/adagios-1.6.3.tar.gz/download";
    sha256 = "1r56hq0cblwvlrpmcql8ry0qsqqz7lbg5si6g1ks5zghy6kwz7sg";
  }) {};
  nagios = pkgs.nagios310;
};

services.nagios = {
  enable = true;
  package = adagios;
  extraConfig = ''
    cfg_dir=$USER_CONFDIR/adagios/etc/nagios/servers
    cfg_file=$USER_CONFDIR/adagios/etc/nagios/nagios.cfg
    cfg_dir=$USER_CONFDIR/adagios/etc/nagios/objects
    cfg_dir=$USER_CONFDIR/adagios/etc/nagios4/plugins
    '' + pkgs.writeText "adagios-nagios-fragments.conf" ''
    cfg_file=$USER_CONFDIR/adagios/etc/nagios/servers/fragments.cfg
    cfg_file=$USER_CONFDIR/adagios/etc/nagios/objects/fragments.cfg
    include=$USER_CONFDIR/adagios/etc/nagios/servers/*.cfg
    include=$USER_CONFDIR/adagios/etc/nagios/objects/*.cfg   
    '' + pkgs.writeText "nagios-import-folder.conf" ''
    cfg_dir=$USER_CONFDIR/adagios/import
    import_file=$USER_CONFDIR/adagios/import/somename.cfg
  '';  
};

After making changes to the system configuration file, run the following command to update the system:

sudo nixos-rebuild switch

Step 3: Configure Adagios

Once you have installed Adagios, you need to configure it. Open the Adagios configuration file located at /var/lib/adagios/etc/adagios.conf:

sudo nano /var/lib/adagios/etc/adagios.conf

In this file, update the nagios_url value to your Nagios URL:

nagios_url = http://localhost/nagios

Save and close the file.

Step 4: Access Adagios Web Interface

Once you have configured Adagios, you can access the Adagios web interface using the following URL:

http://<YOUR_SERVER_IP>/adagios

This will open the Adagios login page. Enter the Nagios admin username and password to log in to the Adagios dashboard.

Congratulations! You have successfully installed and configured Adagios on NixOS Latest. You can now easily monitor your entire infrastructure using the Adagios web interface.