Install Nagios XI on AWS EC2 Redhat

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
tigerpeng
Posts: 26
Joined: Mon Jan 04, 2016 5:26 pm

Install Nagios XI on AWS EC2 Redhat

Post by tigerpeng »

Followed https://support.nagios.com/forum/viewto ... =6&t=34289 and https://forums.aws.amazon.com/thread.js ... eID=551601, my manual installation end with message as below

Code: Select all

[root@ip-10-136-87-143 nagiosxi]# tail install.log 
Running transaction
  Installing : iptables-services-1.4.21-16.el7.x86_64                       1/1 
warning: /etc/sysconfig/iptables created as /etc/sysconfig/iptables.rpmnew
  Verifying  : iptables-services-1.4.21-16.el7.x86_64                       1/1 

Installed:
  iptables-services.x86_64 0:1.4.21-16.el7                                      

Complete!
Failed to execute operation: Access denied
and the server seems not up

Code: Select all

[root@ip-10-136-87-143 nagiosxi]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      10485/mysqld        
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      4427/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1846/master         
tcp6       0      0 :::22                   :::*                    LISTEN      4427/sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      1846/master 
What is wrong?
How to check the server status from command line?
How to start/stop the Nagios XI server from command line?
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Install Nagios XI on AWS EC2 Redhat

Post by bwallace »

For starters, we'll need to know what exact version of Red Hat this is. You can use this cmd to find the RHEL release version:

Code: Select all

rpm -qa '*release*'
The cmd's used to check status, /stop/start services depend on the RHEL version. Prior to RHEL 7x, these would be used:

Code: Select all

service nagios status

Code: Select all

service nagios stop|start|restart 

If RHEL 7x, you may need to use 'systemctl'

Code: Select all

systemctl status nagios

Code: Select all

systemctl stop|start|restart nagios

Lastly, was this a clean, minimal install of this OS?
(refer to the XI Installation Prerequisites here https://assets.nagios.com/downloads/nag ... ctions.pdf

*Fedora has a good cheat sheet for service management when it comes to 'service' vs 'systemctl' commands:
https://fedoraproject.org/wiki/SysVinit ... Cheatsheet
Be sure to check out the Knowledgebase for helpful articles and solutions!
tigerpeng
Posts: 26
Joined: Mon Jan 04, 2016 5:26 pm

Re: Install Nagios XI on AWS EC2 Redhat

Post by tigerpeng »

It is a 'clean' instance from Amazon Image: RHEL-7.2_HVM_GA-20151112-x86_64-1-Hourly2-GP2 (ami-2051294a)

Code: Select all

[root@ip-10-183-55-56 ~]# rpm -qa '*release*'
epel-release-7-2.noarch
redhat-release-server-7.2-9.el7.x86_64
rpmforge-release-0.5.3-1.el7.rf.x86_64
It seems nagios has not been installed successfully

Code: Select all

[root@ip-10-183-55-56 ~]# service nagios status
Redirecting to /bin/systemctl status  nagios.service
● nagios.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
Ran ./fullinstall again got error as below

Code: Select all

.....
===================
INSTALLATION ERROR!
===================
Installation step failed - exiting.
Check for error messages in the install log (install.log).

If you require assistance in resolving the issue, please include install.log
in your communications with Nagios XI technical support.

The script that failed was: './6-firewall'
I perform the installation in /var/tmp dir

Code: Select all

[root@ip-10-183-55-56 nagiosxi]# ls -ld /var/tmp
drwxrwxrwt. 4 root root 4096 Jan  5 13:27 /var/tmp
BTW. The AWS AMI ami-e0613b88 (766915741798/Nagios XI Infrastructure Monitoring) mentioned in https://assets.nagios.com/downloads/nag ... -Cloud.pdf does not work. When tried to ssh to the new launched instance from the image, I got error:

Code: Select all

Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Install Nagios XI on AWS EC2 Redhat

Post by hsmith »

Can you go to the Nagios XI installation directory, and run the following command:

Code: Select all

touch installed.firewall
Then try to run the fullinstall again:

Code: Select all

./fullinstall
Let us know what happens.
Former Nagios Employee.
me.
tigerpeng
Posts: 26
Joined: Mon Jan 04, 2016 5:26 pm

Re: Install Nagios XI on AWS EC2 Redhat

Post by tigerpeng »

ran ./6-firewall with bash -x

Code: Select all

[root@ip-10-183-55-56 nagiosxi]# bash -x ./6-firewall 
+ . ./xi-sys.cfg
++ apachegroup=apache
++ apacheuser=apache
++ chownbin=/bin/chown
++ groupaddbin=/usr/sbin/groupadd
++ groupdelbin=/usr/sbin/groupdel
++ htpasswdbin=/usr/bin/htpasswd
++ httpdconfdir=/etc/httpd/conf.d
++ httpdconf=/etc/httpd/conf/httpd.conf
++ httpdroot=/var/www/html
++ httpd=httpd
++ ntpd=ntpd
++ crond=crond
++ mkdirbin=/bin/mkdir
++ mrtgcfg=/etc/mrtg/mrtg.cfg
++ pgsqlrootpass=postgres
++ pgsqlpass=nagiosxi
++ nagioscmdgroup=nagcmd
++ nagiosgroup=nagios
++ nagiosuser=nagios
++ nagioswebpwd=nagiosadmin
++ nagioswebuser=nagiosadmin
++ phpconfd=/etc/php.d
++ phpini=/etc/php.ini
++ proddir=/usr/local/nagiosxi
++ useraddbin=/usr/sbin/useradd
++ usermodbin=/usr/sbin/usermod
++ userdelbin=/usr/sbin/userdel
++ mibsdir=/usr/share/snmp/mibs
++ phpconfdcli=/etc/php.d
++ xiver=5.2.3
++ distro=RedHatEnterpriseServer
++ version=7.2
++ ver=7
++ architecture=x86_64
++ dist=el7
++ arch=x86_64
++ php_extension_dir=/usr/lib64/php/modules
++ mysqld=mariadb
++ mysqlpass=nagiosxi
+ '[' '!' -f installed.sudoers ']'
+ '[' -f installed.firewall ']'
+ '[' RedHatEnterpriseServer == Ubuntu ']'
+ '[' RedHatEnterpriseServer == Debian ']'
+ '[' -f /offline ']'
+ cp -f nagiosxi/iptables /etc/sysconfig
+ '[' 7 -eq 7 ']'
+ '[' -z '' ']'
+ yum install iptables-services -y
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Package iptables-services-1.4.21-16.el7.x86_64 already installed and latest version
Nothing to do
+ systemctl mask firewalld.service
Failed to execute operation: Access denied
+ systemctl enable iptables.service
Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.
+ systemctl stop firewalld.service
Failed to stop firewalld.service: Unit firewalld.service not loaded.
+ iptables-save
+ systemctl restart iptables.service
+ echo 'Firewall rules updated OK'
Firewall rules updated OK
+ touch installed.firewall
Ran the failed comand

Code: Select all

[root@ip-10-183-55-56 nagiosxi]# systemctl mask firewalld.servic
Failed to execute operation: Access denied
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Install Nagios XI on AWS EC2 Redhat

Post by hsmith »

Did you try this?
hsmith wrote:Can you go to the Nagios XI installation directory, and run the following command:

Code: Select all

touch installed.firewall
Then try to run the fullinstall again:

Code: Select all

./fullinstall
Let us know what happens.
Former Nagios Employee.
me.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Install Nagios XI on AWS EC2 Redhat

Post by scottwilkerson »

It looks like you are missing the firewalld service which you can likely circumvent if you wish by just running the following which will skip the step of modifying th efirewall/iptables

Code: Select all

touch installed.firewall
./fullinstall
tigerpeng wrote:
BTW. The AWS AMI ami-e0613b88 (766915741798/Nagios XI Infrastructure Monitoring) mentioned in https://assets.nagios.com/downloads/nag ... -Cloud.pdf does not work. When tried to ssh to the new launched instance from the image, I got error:

Code: Select all

Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
On this note, what you described is typical UNTIL the installation is complete (about 20 minutes from first launch), after which case you should be able to login as ec2-user with your key file...
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
tigerpeng
Posts: 26
Joined: Mon Jan 04, 2016 5:26 pm

Re: Install Nagios XI on AWS EC2 Redhat

Post by tigerpeng »

With

Code: Select all

touch installed.firewall
./fullinstall
Nagios XI installed successfully! Thank you for your help!

The Cron Daemon is sending mail to root:

Code: Select all

From: "(Cron Daemon)" <[email protected]>
To: [email protected]
Subject: Cron <root@ip-10-183-55-56> LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
Precedence: bulk
X-Cron-Env: <XDG_SESSION_ID=9>
X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/0>
X-Cron-Env: <LANG=en_US.UTF-8>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
Date: Tue,  5 Jan 2016 14:10:02 -0500 (EST)
Status: RO

Subroutine SNMP_Session::pack_sockaddr_in6 redefined at /usr/share/perl5/vendor_perl/Exporter.pm line 66.
 at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMP_Session::unpack_sockaddr_in6 redefined at /usr/share/perl5/vendor_perl/Exporter.pm line 66.
 at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149.
Subroutine SNMPv1_Session::pack_sockaddr_in6 redefined at /usr/share/perl5/vendor_perl/Exporter.pm line 66.
 at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 604.
Subroutine SNMPv1_Session::unpack_sockaddr_in6 redefined at /usr/share/perl5/vendor_perl/Exporter.pm line 66.
 at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 604.
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: Install Nagios XI on AWS EC2 Redhat

Post by bwallace »

Thanks for that update and glad to hear XI installed successfully (thanks hsmith, scottwilkerson). Were there any other questions or may I go ahead and lock this thread?
Be sure to check out the Knowledgebase for helpful articles and solutions!
tigerpeng
Posts: 26
Joined: Mon Jan 04, 2016 5:26 pm

Re: Install Nagios XI on AWS EC2 Redhat

Post by tigerpeng »

I redirect the stderr of the cronjob in /etc/cron.d/mrtg to /dev/null to make it silent. It would be better to eliminate the noise from the source.

Code: Select all

[root@nagiosxi cron.d]# cat /etc/cron.d/mrtg
*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg --lock-file /var/lock/mrtg/mrtg_l --confcache-file /var/lib/mrtg/mrtg.ok 2>/dev/null
Thank you for your help. You can lock this topic.
Locked