Packages that nagrestconf depends on, such as Nagios and Apache, will be installed automatically.
The instructions on this page are for installing nagrestconf and its requirements on a new server,
It is not recommended to follow these instructions on an existing server that is currently being used. It might break other applications on the server since packages will be upgraded.
Installation consists of the following steps:
Get the RPM packages for Centos/Redhat 5 from the download page then copy them to the server.
Open a terminal window or ssh session then add the EPEL repository to satisfy dependencies later on.
rpm -ivh http://mirror.bytemark.co.uk/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
Nagios 3 is not available from the default repositories or from EPEL. Copy and paste the next command to get Nagios 3 from CentALT.
cat >/etc/yum.repos.d/centalt.repo <<EnD [CentALT] name=CentALT Packages for Enterprise Linux 5 - \$basearch baseurl=http://centos.alt.ru/repository/centos/5/\$basearch/ enabled=1 gpgcheck=0 EnD
If php has been installed then it must be uninstalled as php53 is required
rpm -qa | grep php | grep -v php53 | xargs rpm -e
Open a terminal window or ssh session then install nagrestconf and all plugins:
yum --nogpg install nagrestconf-1.174.4.noarch.rpm \ nagrestconf-services-tab-plugin-1.174.4.noarch.rpm \ nagrestconf-services-bulktools-plugin-1.174.4.noarch.rpm \ nagrestconf-hosts-bulktools-plugin-1.174.4.noarch.rpm \ nagrestconf-backup-plugin-1.174.4.noarch.rpm
Finally update 'grep' (This is a workaround for a bug).
For 64 bit OS, x86_64:
rpm -Uvh http://nagrestconf.sourceforge.net/temp/grep-2.6.3-2el5.x86_64.rpm
For 32 bit OS, i386/i686:
rpm -Uvh http://nagrestconf.sourceforge.net/temp/grep-2.6.3-2.el5.i386.rpm
Ensure selinux is disabled, instructions here.
Use the two helper scripts 'nagrestconf_install' and 'slc_configure'.
nagrestconf_install -a slc_configure --folder=local
Create a password for nagiosadmin - for GUI access to nagios.
htpasswd -bc /etc/nagios/htpasswd.users nagiosadmin a_password
Create a password for nagrestconfadmin - for GUI access to nagrestconf.
htpasswd -bc /etc/nagios/nagrestconf.users nagrestconfadmin a_password
Note that, by default, the nagrestconf GUI can only be reached from the host it was installed on, localhost. To enable connecting to nagrestconf from other hosts edit the apache configuration.
cp /etc/httpd/conf.d/nagios.conf /tmp sed -i 's#Alias /nagios/ #Alias /nagios #i' \ /etc/httpd/conf.d/nagios.conf sed -i 's/allow from 127.0.0.1/allow from all/i' \ /etc/httpd/conf.d/nagios.conf sed -i 's#AuthUserFile .*#AuthUserFile /etc/nagios/htpasswd.users#i' \ /etc/httpd/conf.d/nagios.conf
cp /etc/httpd/conf.d/nagrestconf.conf /tmp sed -i 's#AuthUserFile .*#AuthUserFile /etc/nagios/nagrestconf.users#i' \ /etc/httpd/conf.d/nagrestconf.conf sed -i 's/allow from 127.0.0.1/allow from all/i' \ /etc/httpd/conf.d/nagrestconf.conf sed -i 's/#Require/Require/i' /etc/httpd/conf.d/nagrestconf.conf sed -i 's/#Auth/Auth/i' /etc/httpd/conf.d/nagrestconf.conf
service httpd restart
The nagrestsconf and nagios web interfaces should be accessible now.
Log into nagrestconf with user 'nagrestconfadmin', and the password that was set above.
The nagrestconf interface, at 'http://server/nagrestconf', will look like the following screen shot.
Log into nagios with user 'nagiosadmin', and the password that was set above.
The nagios interface, at 'http://server/nagios', will look like the following screen shot.
To create a simple test configuration use a script that makes REST calls, or use the 'Backup/Restore' button in the nagrestconf GUI. The latter method will be used in this guide.
An example configuration can be downloaded from this link, then log into nagrestconf and use the 'Backup/Restore' button.
Click 'Close' in the 'Backup/Restore' dialog then refresh the page.
The new configuration will not appear in the Nagios Web interface until the 'Apply Changes' button is clicked, and then applied.
Nagios and Nagrestconf should be installed and working, however, the plugins are probably not installed so Nagios will show errors trying to run the host and service checks.
Install the plugins your distribution provides.
Choose the required plugins or install them all as below.
yum install nagios-plugins-all nagios-plugins-nrpe
That's it!comments powered by Disqus