How to monitor Apache2 Using Icinga 2

Step 1 - Install icinga2 in Agent Server
    8  apt update
    9  apt -y install apt-transport-https wget gnupg
   10  wget -O - | gpg --dearmor -o /usr/share/keyrings/icinga-archive-keyring.gpg
   11  . /etc/os-release; if [ ! -z ${UBUNTU_CODENAME+x} ]; then DIST="${UBUNTU_CODENAME}"; else DIST="$(lsb_release -c| awk '{print $2}')"; fi;  echo "deb [signed-by=/usr/share/keyrings/icinga-archive-keyring.gpg] icinga-${DIST} main" >  /etc/apt/sources.list.d/${DIST}-icinga.list
   12  apt update
   13  apt install icinga2
   14  apt install monitoring-plugins

Step 2 - Enable icinga2 Agent

root@ip-172-31-4-57:~# icinga2 node wizard
Welcome to the Icinga 2 Setup Wizard!

We will guide you through all required configuration details.

Please specify if this is an agent/satellite setup ('n' installs a master setup)                                                                               [Y/n]: Y

Starting the Agent/Satellite setup routine...

Please specify the common name (CN) [ip-172-31-4-57.ap-south-1.compute.internal]:

Please specify the parent endpoint(s) (master or satellite) where this node should connect to:
Master/Satellite Common Name (CN from your master/satellite node): ip-172-31-12-175.ap-south-1.compute.i                                                      nternal

Do you want to establish a connection to the parent node from this node? [Y/n]: Y
Please specify the master/satellite connection information:
Master/Satellite endpoint host (IP address or FQDN):
Master/Satellite endpoint port [5665]:

Add more master/satellite endpoints? [y/N]: N
Parent certificate information:

 Version:             3
 Subject:             CN = ip-172-31-12-175.ap-south-1.compute.internal
 Issuer:              CN = Icinga CA
 Valid From:          May 10 04:17:19 2024 GMT
 Valid Until:         Jun 11 04:17:19 2025 GMT
 Serial:              f0:c6:d1:1c:f0:78:1b:6b:2d:7c:20:4b:1b:50:3c:be:f0:25:a2:17

 Signature Algorithm: sha256WithRSAEncryption
 Subject Alt Names:   ip-172-31-12-175.ap-south-1.compute.internal
 Fingerprint:         54 FD AD AC 55 39 7F 7A 5F C2 2D BB 09 22 BE 43 08 15 FB DF 0D F6 5C 2B 76 15 0F C                                                      1 DD 29 00 7B

Is this information correct? [y/N]: y

Please specify the request ticket generated on your Icinga 2 master (optional).
 (Hint: # icinga2 pki ticket --cn 'ip-172-31-4-57.ap-south-1.compute.internal'): 94deed8004eefccb459689dbc6fe1112543b01eb
Please specify the API bind host/port (optional):
Bind Host []:
Bind Port []:

Accept config from parent node? [y/N]: y
Accept commands from parent node? [y/N]: y

Reconfiguring Icinga...
Disabling feature notification. Make sure to restart Icinga 2 for these changes to take effect.
Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect.

Local zone name [ip-172-31-4-57.ap-south-1.compute.internal]:
Parent zone name [master]:

Default global zones: global-templates director-global
Do you want to specify additional global zones? [y/N]:

Do you want to disable the inclusion of the conf.d directory [Y/n]: n


Now restart your Icinga 2 daemon to finish the installation!\
$ systemctl restart icinga2

Step 3 - Install Apache 2
   26  apt-get update
   27  apt install apache2
   28  clear
   29  ls
   30  systemctl start apache2
   31  systemctl status apache2

Step 4 - Verify if Mod_Staus module in Apache2
$ ls /etc/apache2/mods-enabled | grep status*
$ sudo /usr/sbin/a2enmod status
Module status already enabled

Note - If you want to enable - follow this -

Step 5 - Enable Mod Status Module from icinga server

$ more /etc/apache2/mods-enabled/status.conf
$ vi /etc/apache2/mods-enabled/status.conf
$ systemctl restart apache2

<IfModule mod_status.c>
        # Allow server status reports generated by mod_status,
        # with the URL of http://servername/server-status
        # Uncomment and change the "" to allow access from other hosts.

        <Location /server-status>
                SetHandler server-status
                Require local
                Require ip

        # Keep track of extended status information for each request
        ExtendedStatus On

        # Determine if mod_status displays the first 63 characters of a request or
        # the last 63, assuming the request itself is greater than 63 chars.
        # Default: Off
        #SeeRequestTail On

        <IfModule mod_proxy.c>
                # Show Proxy LoadBalancer status in mod_status
                ProxyStatus On


Step 6 - Enable Apache check in Icinga Server
   49  cd /etc/icinga2/conf.d/
   50  ls
   51  vi commands.conf

object CheckCommand "check_apache_status" {
    import "plugin-check-command"
    command = [ PluginDir + "/check_http" ]
    arguments = {
        "-H" = "$address$"
        "-u" = "/server-status?auto"


object CheckCommand "check_apache_status" {
    import "plugin-check-command"
    command = [ PluginDir + "/check_http" ]
    arguments = {
        "-H" = ""
        "-u" = "/server-status?auto"

$ systemctl restart icinga2
$ systemctl status icinga2
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x