Monday, March 25, 2024

Install NAGIOS Core Plugins

Nagios basic plugins are obligatory to be able install later on the probes for the machines you wanted to observe. Sudo should be installed. I don't cover non-text but dbase based logging here, so no sql / mariadb is used or needed. In addition in certain cases, if mistakenly you installed mariadb server and it is up and running, it can cause compatibility issues, errors and hiccups and often even uninstalling won't help resolving the issues. In this case, you should restart with a clean Debian. 


****************************************

https://www.nagios.org/downloads/nagios-plugins/
https://support.nagios.com/kb/article/nagios-plugins-installing-nagios-plugins-from-source-569.html#Debian

****************************************

INSTALL COMMON PREREQUISITES for PLUGINS:

    apt-get install -y autoconf automake gcc libc6 libmcrypt-dev make libssl-dev wget bc gawk dc build-essential snmp libnet-snmp-perl gettext
    apt-get install -y libdlap2-dev
    apt-get install -y libdmysqlclient-dev
    apt-get install -y smbclient
    apt-get install -y libfreeradius-client-dev
    * apt-get install -y libmariadbclient-dev  libmariadbclient-dev-compat  (normally, no need for mariadb, unless we use database back and for logging)
    apt-get install -y dnsutils
    apt-get install -y qstat
    apt-get install -y fping
    apt-get install -y qmail-tools
    
DOWNLOAD PLUGINS:
    cd /home/nagios/downloads
    wget https://nagios-plugins.org/download/nagios-plugins-2.4.9.tar.gz
    
UNZIP PLUGINS:
    tar -zxvf nagios-plugins-2.4.9.tar.gz
        
ENTER DIRECTORY:
    cd nagios-plugins-2.4.9/
    
COMPILE PLUGINS AND INDICATE USER:
    ./configure --with-nagios-user=nagios --with-nagios-group=nagcmd
    
    config log:
        more /home/nagios/downloads/nagios-plugins-2.4.9/config.log

COMPILE BINARIES:
    make

INSTALL PLUGINS:
    make install
    
--------------------------------
PLUGINS INSTALL MAJOR PART DONE    
--------------------------------


CHANGE the NAGIOS USER SHELL to BASH SH if needed:
    chsh -s /bin/bash nagios

TEST NAGIOS with -v:
    /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
    
CREATE COMMANDE SHORTCUT FOR TEST NAGIOS -> testNagios :    
    echo "alias testNagios='/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg'" >> /home/nagios/.bashrc    

AUTHORIZE FOR COMMANDE "systemctl restart nagios" for nagios user under linux with sudo priviliges:
    echo "nagios ALL=NOPASSWD:/bin/systemctl restart nagios" >> /etc/sudoers
    
CREATE SHORTCUT FOR RESTART NAGIOS:
    echo "alias restartNagios='sudo systemctl restart nagios'" >> /home/nagios/.bashrc
    
ENTER NAGIOS USER:
    su - nagios
    
-------------------------------------
EXECUTE:
    restartNagios
    testNagios
    systemctl status nagios | grep Active

-------------------------------------

YOU SHOULD SEE SOMETHING LIKE THIS:

    systemctl status nagios | grep Active

testNagios

 

                                                                   _dnhyper

No comments:

Post a Comment

Sharepoint sync and lock issues - solutions

 Sharepoint synced down to your PC by onedrive can have a ton of errors. It is caused by the simple dis-functionality of this badly thought ...