don't dream your life, live your dreams !
Centreon can link with multiple Nagios.
They speak throw NDOutils.
The following configuration shows how to configure Nagios and NDOutils to communicate with a local Centreon.
Contents
I assume that you have a Centos installation.
You can copy/paste this script and use it to configure automatically your server.
#!/bin/bash echo "install tools nagios" dnf -y install nagios nagios-devel nagios-plugins* echo "enable start nagios on boot" systemctl enable nagios.service echo "set config owner" chown nagios:nagios /etc/nagios/ -R service nagios reload echo "check_http get a 403 'forbidden' if index.html is missing. so we create it" touch /var/www/html/index.html myip=`hostname -I` echo "Now meet you here: http://$myip/nagios/" echo "Note, login/passord is nagiosadmin/nagiosadmin"
That’s all 🙂
Install NDOutils:
#!/bin/bash dnf -y install ndoutils ndoutils-mysql echo "update /etc/nagios/ndomod.cfg" sed -i "s/^\(instance_name=\).*/\1Central/g" /etc/nagios/ndomod.cfg sed -i "s/^\(output_type=\).*/\1tcpsocket/g" /etc/nagios/ndomod.cfg sed -i "s/^\(output=\).*/\1localhost/g" /etc/nagios/ndomod.cfg sed -i "s/^\(tcp_port=\).*/\15668/g" /etc/nagios/ndomod.cfg sed -i "s/^\(output_buffer_items=\).*/\15000/g" /etc/nagios/ndomod.cfg echo "update /etc/nagios/ndo2db.cfg" ln -s /var/run/ndoutils/ndoutils.sock /var/run/ndo.sock sed -i "s/^\(ndo2db_user=\).*/\1nagios/g" /etc/nagios/ndo2db.cfg sed -i "s/^\(ndo2db_group=\).*/\1nagios/g" /etc/nagios/ndo2db.cfg sed -i "s/^\(socket_type=\).*/\1tcp/g" /etc/nagios/ndo2db.cfg sed -i "s/^\(socket_name=\).*/\1\/var\/run\/ndo.sock/g" /etc/nagios/ndo2db.cfg sed -i "s/^\(tcp_port=\).*/\15668/g" /etc/nagios/ndo2db.cfg sed -i "s/^\(db_servertype=\).*/\1mysql/g" /etc/nagios/ndo2db.cfg sed -i "s/^\(db_host=\).*/\1localhost/g" /etc/nagios/ndo2db.cfg sed -i "s/^\(db_port=\).*/\13306/g" /etc/nagios/ndo2db.cfg sed -i "s/^\(db_name=\).*/\1centreon_status/g" /etc/nagios/ndo2db.cfg sed -i "s/^\(db_prefix=\).*/\1nagios_/g" /etc/nagios/ndo2db.cfg sed -i "s/^\(db_user=\).*/\1centreon/g" /etc/nagios/ndo2db.cfg sed -i "s/^\(db_pass=\).*/\1centreon/g" /etc/nagios/ndo2db.cfg echo "update /etc/nagios/nagios.cfg" sed -i "s/event_broker_options=-1/event_broker_options=-1/g" /etc/nagios/nagios.cfg sed -i "s/#broker_module=\/somewhere\/module1.o/broker_module=\/usr\/lib64\/nagios\/brokers\/ndomod.so config_file=\/etc\/nagios\/ndomod.cfg/g" /etc/nagios/nagios.cfg chown nagios:nagios /etc/nagios/ -R echo "activate ndo2db at startup and start it" systemctl enable ndo2db.service systemctl stop ndo2db.service systemctl start ndo2db.service systemctl restart nagios.service
In /etc/nagios/ndomod.cfg, check you have theses parameters
instance_name=Central output_type=tcpsocket output=localhost tcp_port=5668 output_buffer_items=5000 |
And check you have the same values in Centreon : Configuration -> Centreon -> ndomod.cfg
In /etc/nagios/ndo2db.cfg, check you have theses parameters
ndo2db_user=nagios ndo2db_group=nagios socket_type=tcp socket_name=/var/run/ndo.sock tcp_port=5668 db_servertype=mysql db_host=localhost db_name=centreon_status db_port=3306 db_prefix=nagios_ db_user=centreon db_pass=centreon |
And check you have the same values in Centreon : Configuration -> Centreon -> ndo2db.cfg
In /etc/nagios/nagios.cfg, configure blockers:
event_broker_options=-1 broker_module=/usr/lib64/nagios/brokers/ndomod.so config_file=/etc/nagios/ndomod.cfg |
And check you have the same values in Centreon : Configuration -> Monitoring Engines -> main.cfg (tab Data)
Now restart services:
/etc/init.d/ndo2db start /etc/init.d/nagios restart |
ndo2db process do not manage to access to ndo2db.cgf file. Execute the following command:
chown apache:apache /etc/nagios/ -R |
Copyright © 2024 My linux world - by Marc RABAHI
Design by Marc RABAHI and encelades.
admin