Você está na página 1de 3

GiuseppeTurri

Email:g.turri@giuseppeturri.it

HOW TO Install Nagios Core on RedHat Enterprise Linux Systems......


Without Problems :-)
1- Install system software needed by nagios installation
Webegininstallingandverifyingthepackagerequirementsandso,asrootuser,submitthefollowing
command:
yum install -y wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp

2- Download Nagios core and main plugin


WhenI'mwritingthisdocumentthelatestavailableversionofnagioscoreisthe3.4.1andyoucan
downloaditbrowsingattheurlhttp://prdownloads.sourceforge.net/sourceforge/nagios/nagios3.4.1.tar.gz
ordirectlybywgetwiththiscommand:
cd /tmp
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz
wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins1.4.15.tar.gz
Note:ifyoursystemisbehindaproxyserveryoumayneedtoconfiguretheproxytoallowtheinternetconnectiontowget
followingthesesteps
addyourproxyto/erc/wgetrcconfigurationfile(uncommentandmodifythetypeofproxyusedinyournetwork)
uncommenttheuse_proxy=onsettingor,ifyoudon'twanttousetheproxyatallyoumayturnoffthissettingandissue
thewgetcommandfollowebbyproxy=onproxyuser=userproxypassword=passwordandthentheurl(example
wgetproxy=onproxyuser=userproxypassword=passwordhttp://www.xxx.zzz)

3- Installing Nagios core & main plugin


OnceDownloadedthetarfilewehavetocreatetheuserandgroupfornagiosandsosubmitthese
commands:
useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios

Nowwecanextractthesoftwarefromthetarball
tar zxf nagios-3.4.1.tar.gz
tar zxf nagios-plugins-1.4.15.tar.gz

Pagina 1 di 3

GiuseppeTurri

Email:g.turri@giuseppeturri.it

Andinstallthecorenagiossoftware

cd nagios
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf

andthemainplugin

cd ../nagios-plugin*
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers

Wecanstartthenagionandhttpdservicesbyissuingthecommand
service httpd start
service nagios start

Terminatedtheinstallationcommandwecansetthesystemtostartupnagiosandhttpdatstartuptime:
chkconfig nagios --level 35 on
chkconfig httpd --level 35 on

Nowwehavetocreateanusertoaccesstothenagioswebinterfacesowecreateanusernamed
nagiosadmindefiningapasswordforit:
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Atthispointthenagioscoreisinstalled,upandrunning.
Youcanaccesstoyournagiosinstallationbybrowsingtheurlhttp://yourservername/nagios

You'llbepromptabasicauthenticationwhereyouhavetousethenagiosadminaccountcreatedwiththelatest
commandsubmitted.

Everytimeyoumodifyanagiosconfigurationfileyoumayverifytheconfigurationbythecommand
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

and,ifallisok,youcanrestartthenagiosservicetoexecutethemodifiedcode.

Thenextchapteroftheguideisforhelpingyouincaseofproblems.Toverifyifyourinstallationisfreeofproblems
andtocheckthestatusofyourinstallationIsuggestyouto:
Tryanaccessthroughthewebinterface
Trytoaccesstotheservicessectionandtrytorescheduleachecknow
Trytoverifythemailnotification(changetheemailaddressinthe
/usr/local/nagios/etc/objects/contacts.cfgconfigurationfile).

Pagina 2 di 3

GiuseppeTurri

Email:g.turri@giuseppeturri.it

4- MOST COMMON PROBLEMS RESOLUTION


Error403Forbiddenyoudon'thavepermissiontoaccess/nagios/onthisserver.
whenyoutrytoaccessthenagioswebinterface

Checktheinstallationofthephpsoftwareonyoursystem
yum install php
service httpd restart

Error:Couldnotopencommandfile/var/nagios/rw/nagios.cmdforupdate!
Whenyoutrytorescheduleacheckofaservicebynagioswebinterface
chown nagios.nagcmd /usr/local/nagios/var/rw
chmod g+rwx /usr/local/nagios/var/rw
chmod g+s /usr/local/nagios/var/rw
usermod -G nagcmd apache
service httpd restart
service nagios restart

Youdon'treceiveanyemailnotificationand/oryouareabletosendemail
notificationbycommandline
I'vespentalotoftimewhitthiskindofproblem....

Socheckifyouareabletosendemailbyterminallineasrootuserwiththiscommand:
/usr/bin/printf "Notification Test" | /bin/mail -s "This is a test" youremail@address

Ifyoucanexecutethecommandandyoureceivetheemailnowwecantrytosubmitthesame
commandasnagiosusersoexecute:
su - nagios
/usr/bin/printf "Notification Test" | /bin/mail -s "This is a test" youremail@address

Probablyyou'llgetthiserror

WARNING:RunAsUserforMSPignored,checkgroupids(egid=503,want=51)
cannotchdir(/var/spool/clientmqueue/):Permissiondenied
Programmoderequiresspecialprivileges,e.g.,rootorTrustedUser.

Ifyouhaveasimilarerrormessagewecansolveitbyissuing,asrootuser,thiscommand:
chmod 2755 /usr/sbin/sendmail.sendmail
service sendmail restart

Go to NAGIOS website http://www.nagios.com/#ref=s57X3l

Pagina 3 di 3

Você também pode gostar