That's cool.
I use Nagios4 in Ubuntu 24.04 for that.
I'll include excerpts of my Nagios config for those who are curious.  This
Koha Status Monitor is probably a lot easier to setup.


On Mon, Jan 27, 2025 at 10:10 AM Atanu from Koha Support Team via
Koha-devel <koha-devel@lists.koha-community.org> wrote:

> Dear Community,
>
> I'm excited to share a solution we've developed to address a common
> challenge in managing Koha ILS installations - monitoring and automated
> notifications on Koha server status.
>
>
>
> Problem:
>
> - Multiple Koha instances requiring constant uptime monitoring
>
> - Need for immediate alerts when OPAC or Staff Client becomes unavailable
>
> - Lack of centralized status dashboard for multiple libraries
>
> - Manual checking of service status consuming staff time
>
>
>
> Solution:
>
> The Koha Status Monitor (
> https://github.com/ai4libraries/koha-status-monitor) provides:
>
> - Real-time monitoring of multiple Koha instances
>
> - Instant email notifications for service disruptions
>
> - Daily status summary reports
>
> - Clean, responsive web dashboard
>
>
>
> Live Example:
>
> You can see it in action at https://socialwell.in, where we monitor
> multiple library installations. The dashboard shows real-time status with
> visual indicators for both OPAC and Staff interfaces.
>
>
>
> Technical Details:
>
> - Built with Node.js
>
> - Simple configuration for email alerts and instance monitoring
>
> - Easy deployment on any server
>
> - MIT licensed for community use and modification
>
>
>
> Getting Started:
>
> 1. Clone the repository
>
> 2. Configure your Koha instances
>
> 3. Set up email notifications
>
> 4. Deploy and monitor
>
>
>
> We welcome contributions and feedback from the community to make this tool
> even better.
>
>
>
> Best regards,
>
> Atanu from Koha Support Team
>
>
> _______________________________________________
> Koha-devel mailing list
> Koha-devel@lists.koha-community.org
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : https://www.koha-community.org/
> git : https://git.koha-community.org/
> bugs : https://bugs.koha-community.org/
>


-- 
Michael Hafen
Washington County School District Technology Department
Systems & Security Analyst
# On nagios server
#   It is assumed that nagios and the monitoring-plugins* packages are 
installed and working
#   At least monitoring-plugins-common and monitoring-plugins-basic packages 
are required
#   And nagios should be running as a system user
# Create openssh user key in the nagios system user home directory
#   Do NOT enter a passphrase for the key
sudo -u nagios ssh-keygen

# Add to nagios config
#   Included here are the relevant blocks from my config
#   These blocks tie services to hosts using host templates and host groups
editor /etc/nagios4/objects/koha.cfg
--------------------------------------------
# 'by_ssh_wrapper' command definition
define command {
        command_name    by_ssh_wrapper
        command_line    /usr/lib/nagios/plugins/check_by_ssh -H '$HOSTADDRESS$' 
-C "/usr/local/sbin/nagios_wrapper $ARG1$"
}

# check service templates for server stats with check_by_ssh and a wrapper 
script
define service {
        hostgroup_name                  group_stats_by_ssh
        service_description             CPU_BY_SSH_WRAPPER
        check_command                   by_ssh_wrapper!cpu
        use                             service_check_template
}

define service {
        hostgroup_name                  group_stats_by_ssh
        service_description             MEM_BY_SSH_WRAPPER
        check_command                   by_ssh_wrapper!mem
        use                             service_check_template
}

define service {
        hostgroup_name                  group_stats_by_ssh
        service_description             NIC_BY_SSH_WRAPPER
        check_command                   by_ssh_wrapper!nic
        use                             service_check_template
}

define service {
        hostgroup_name                  group_stats_by_ssh
        service_description             DISK_BY_SSH_WRAPPER
        check_command                   by_ssh_wrapper!disk
        use                             service_check_template
}

# service check templates
define service {
    name             service_check_template
    register         0
    notifications_enabled           1
    event_handler_enabled           1
    flap_detection_enabled          1
    process_perf_data               0
    retain_status_information       1
    retain_nonstatus_information    1
    check_period                    24x7
    check_interval                  5
    retry_interval                  1
    max_check_attempts              1
    notification_interval           0
    notification_period             24x7
    notification_options            w,u,c,r
}

# host templates and host groups
define hostgroup {
    hostgroup_name group_stats_by_ssh
    alias          Host with stats service over ssh
    register       0
}
define host {
    name                  with_stats_by_ssh
    register              0
    hostgroups            group_stats_by_ssh
}

# host check template
define host {
    name             check_host_ping
    register         0
    notifications_enabled           1
    event_handler_enabled           1
    flap_detection_enabled          1
    process_perf_data               0
    retain_status_information       1
    retain_nonstatus_information    1
    check_period                    24x7
    check_interval                  5
    retry_interval                  1
    max_check_attempts              1
    notification_interval           0
    notification_period             24x7
    notification_options            d,u,r
    check_command                   check-host-alive
}

#  Contacts
define contact {
        contact_name                    sysadmin
        alias                           System Admin
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    w,c,r
        host_notification_options       d,r
        service_notification_commands   notify-service-by-email
        host_notification_commands      notify-host-by-email
        email                           sysad...@example.org
}

define contactgroup {
        contactgroup_name   netadmins
        alias               Network Admin Team
        members             sysadmin
}

#  Hosts to monitor with Nagios
define host {
        host_name       www.example.org
        alias           Client_A
        address         192.168.1.1
        use             check_host_ping
        contact_groups  netadmins

define host {
        host_name       koha.example.org
        alias           client_a_koha
        address         192.168.1.50
        parents         Client_A
        use             with_stats_by_ssh
        contacts        sysadmin
        action_url      https://koha.example.org/
        notes_url       https://opac.example.org/
}
--------------------------------------------
# Add a host definition block for each Koha server to be monitored
# If you don't want to use host groups then
#   Enter the Koha server host object host_name instead of hostgroup_name in 
service definitions

==============================================================
# On server to be monitored

# Add system user with nagios server's ssh key
adduser --system --home /var/lib/nagios --group nagios
sudo -u nagios mkdir /var/lib/nagios/.ssh

# Setup ssh authorized_keys
sudo -u nagios editor /var/lib/nagios/.ssh/authorized_keys
--------------------------------------------
from="nagios.example.org",command="/usr/local/sbin/nagios_wrapper 
${SSH_ORIGINAL_COMMAND#* }" __NAGIOS_SERVER_USER_KEY__
--------------------------------------------

# Setup Check scripts
mkdir -p /usr/local/sbin
editor /usr/local/sbin/nagios_wrapper
--------------------------------------------
#!/bin/bash

case "$1" in
        "cpu")
        /usr/local/lib/nagios/plugins/check_linux_stats.pl -C -w 80 -c 90 -s 1
        exit $?
        ;;

        "mem")
        /usr/local/lib/nagios/plugins/check_linux_stats.pl -M -w 80,80 -c 90,90
        exit $?
        ;;

        "nic")
        /usr/local/lib/nagios/plugins/check_eth -i eth0 -p -w 75 -c 90 -b 1g
        exit $?
        ;;

        "disk")
        /usr/local/lib/nagios/plugins/check_linux_stats.pl -D -p 
/dev/sda1,/dev/sda2 -u % -w 75 -c 90 -s 1
        exit $?
        ;;

        *)
        echo "Unknown sub-process requested: $1"
        exit 1
        ;;
esac
--------------------------------------------

# Adjust ethernet device name and drive partition do be monitored in "nic" and 
"disk" cases
#  and make the wrapper script executable

# Acquire and place check programs/scripts
#   utils.pl comes from monitoring-plugins-common package in Ubuntu
mkdir -p /usr/local/lib/nagios/plugins
cp check_eth check_linunx_stats.pl utils.pl /usr/local/lib/nagios/plugins

_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : https://www.koha-community.org/
git : https://git.koha-community.org/
bugs : https://bugs.koha-community.org/

Reply via email to