Page 1 of 1

Clone Nagios XI

Posted: Sat May 23, 2020 3:09 pm
by OmarNaji1
Dear All,

we have 2 servers of Nagios ( one is the main server - other is backup server [in case of the first server is down or have some issue :!: they will use 2nd server] )
so every configuration we did in the first server we must to do it for 2nd server. :ugeek:

my question is do we have an option to take a copy of configuration of ( configurations files, host, services, SNMP traps, MIBS .. ) better than below steps.

note: if no option to do that from Nagios itself, please guide me to a better way to do it manually.

Best regards.

Re: Clone Nagios XI

Posted: Tue May 26, 2020 11:10 am
by lmiltchev
You could backup up your "main" XI server regularly, and restore it to your "backup" server in case you needed to. Read more on backup up and restoring your Nagios XI system here:

https://support.nagios.com/kb/article.php?id=180

If you are interested more into high availability/failover setups, I would recommend reading through the document below:

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Re: Clone Nagios XI

Posted: Mon Jun 01, 2020 11:09 am
by OmarNaji1
Thank you for your replay :D ,

can you please list the back up what exactly will take a copy?
like example is it will take all host and services and SNMP traps and mibs?
what about the database configuration it will be same of active server?

I see in the document the below points will be covered in the backup.
• Nagios Core files (/usr/local/nagios/)
• Nagios XI files (/usr/local/nagiosxi/)
• NagiosQL files (/var/www/html/nagiosql/ and /etc/nagiosql/)
◦ These do not exist on fresh installs of Nagios XI 5.5 or newer
• MRTG files (/var/lib/mrtg/ and /etc/mrtg/)
• NRDP files (/usr/local/nrdp/)
• NagVis files (/usr/local/nagvis/)
• CRON files (in /var/spool/cron/apache)
• Apache config files (in /etc/httpd/conf.d/)
• logrotate config files (in /etc/logrotate.d/)
• MySQL databases (nagios, nagiosql, nagiosxi)
• PostgresQL database (nagiosxi)
but I feel some confusion if it will be the same my requirements or not. :roll:

question:
if I have some issue in passive server like Database Maintainance, event manager, Feed Processor is always red.
and for the active server is working fine.
after this activity, is this issue will be resolved and will be same of active server? :?:


Best regards.

Re: Clone Nagios XI

Posted: Mon Jun 01, 2020 12:55 pm
by lmiltchev
can you please list the back up what exactly will take a copy?
like example is it will take all host and services and SNMP traps and mibs?
what about the database configuration it will be same of active server?
You already saw what's going to be copied (as per the doc). There are other things that would be copied/restored as well, e.g. SNMP configs and MIBs. See the blocks of code that do that:

In /usr/local/nagiosxi/scripts/backup_xi.sh

Code: Select all

# SNMP configs and MIBS
echo "Backing up the SNMP directories"
tar czfp $mydir/etc-snmp.tar.gz /etc/snmp
tar czfp $mydir/usr-share-snmp.tar.gz /usr/share/snmp
In /usr/local/nagiosxi/scripts/restore_xi.sh

Code: Select all

# SNMP configs and MIBS
if [ -f $backupdir/etc-snmp.tar.gz ]; then
    echo "Restoring SNMP configuration files..."
    cd $rootdir && tar xzfps $backupdir/etc-snmp.tar.gz
fi
if [ -f $backupdir/usr-share-snmp.tar.gz ]; then
    echo "Restoring SNMP MIBs..."
    cd $rootdir && tar xzfps $backupdir/usr-share-snmp.tar.gz
fi
You can open these two files in a text editor, and review the code yourself to see what else is backed up and restored.
if I have some issue in passive server like Database Maintainance, event manager, Feed Processor is always red.
and for the active server is working fine.
after this activity, is this issue will be resolved and will be same of active server?
Such issues usually indicate that crond is not running on this system. Is your nagios user expired? Can you run the following commands from the command line on the backup machine, and show the output?

Code: Select all

ps -ef | grep cron | grep -v grep
tail -50 /var/log/cron
chage -l nagios
Do you see any errors / crashed tables in the database log?

Code: Select all

tail /var/log/mysqld.log
or

Code: Select all

tail /var/log/mariadb/mariadb.log
Provided your "main" server operates properly, the "cloned" server should also function well, unless you have some other issues on your backup server, e.g. lack of resources, hardware issues, etc.

Re: Clone Nagios XI

Posted: Tue Jun 02, 2020 12:12 pm
by OmarNaji1
Dear,

Thank you for your support and reply, it was very helpful for me.

after restoring activity, I faced one issue that I cant start Nagios service - Monitoring Engine. [ Screen attached ]

and tried to start it manually but it's not resolved.

the output of /bin/systemctl status nagios.service is :

Code: Select all

● nagios.service - Nagios Core 4.4.3
   Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2020-06-02 20:58:52 +04; 5min ago
     Docs: https://www.nagios.org/documentation
  Process: 36714 ExecStopPost=/usr/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd (code=exited, status=0/SUCCESS)
  Process: 36668 ExecStop=/usr/bin/kill -s TERM ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 36614 ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
  Process: 36609 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
 Main PID: 36615 (code=exited, status=1/FAILURE)

Jun 02 20:58:50 maslvvmnagios01 nagios[36609]: Checking misc settings...
Jun 02 20:58:50 maslvvmnagios01 nagios[36609]: Total Warnings: 0
Jun 02 20:58:50 maslvvmnagios01 nagios[36609]: Total Errors:   0
Jun 02 20:58:50 maslvvmnagios01 nagios[36609]: Things look okay - No serious problems were detected during the pre-flight check
Jun 02 20:58:50 maslvvmnagios01 systemd[1]: Started Nagios Core 4.4.3.
Jun 02 20:58:50 maslvvmnagios01 systemd[1]: nagios.service: main process exited, code=exited, status=1/FAILURE
Jun 02 20:58:50 maslvvmnagios01 kill[36668]: kill: cannot find process ""
Jun 02 20:58:50 maslvvmnagios01 systemd[1]: nagios.service: control process exited, code=exited status=1
Jun 02 20:58:52 maslvvmnagios01 systemd[1]: Unit nagios.service entered failed state.
Jun 02 20:58:52 maslvvmnagios01 systemd[1]: nagios.service failed.

Can you please support on this.

Best regards and thank you.

Re: Clone Nagios XI

Posted: Tue Jun 02, 2020 1:34 pm
by lmiltchev
Can you PM me the profile (profile.zip) from the problem machine?

Admin > System Profile > Download Profile

Re: Clone Nagios XI

Posted: Tue Jun 02, 2020 1:45 pm
by OmarNaji1
Dear,

its not allowed to send PM as below error.
You are not allowed to access this file.
please find the attached file.

Best regards.

Moderator's Note: The profile has been shared with the support team but has been removed from the public forum.

Re: Clone Nagios XI

Posted: Tue Jun 02, 2020 2:22 pm
by lmiltchev
I see the following error in the nagios.log:
[1591116520] Error: Could not load module '/opt/OV/HPBsmIntNagios/lib64/libbsmintneb4.so' -> /opt/OV/HPBsmIntNagios/lib64/libbsmintneb4.so: cannot open shared object file: No such file or directory
[1591116520] Error: Failed to load module '/opt/OV/HPBsmIntNagios/lib64/libbsmintneb4.so'.
and this line in the nagios.cfg:
# NDOUtils module
broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg
broker_module=/opt/OV/HPBsmIntNagios/lib64/libbsmintneb4.so
This is definitely NOT something that we installed... It seems like nagios won't start because of some custom changes that you made on this system. You could try deleting (or commenting out) the line in red, and restarting nagios to see if this is going to fix your issue.

Re: Clone Nagios XI

Posted: Tue Jun 02, 2020 2:25 pm
by OmarNaji1
Dear,

Thank you for your support.
its resolved now.
there was some integration in active server and removed the broker for below file
/usr/local/nagios/etc/nagios.cfg



Best regards.

Re: Clone Nagios XI

Posted: Tue Jun 02, 2020 2:26 pm
by scottwilkerson
OmarNaji1 wrote:Dear,

Thank you for your support.
its resolved now.
there was some integration in active server and removed the broker for below file
/usr/local/nagios/etc/nagios.cfg



Best regards.
Glad to hear it is resolved!

Locking thread