Nagios Installation Guide
Nagios Installation Guide
it
Pagina 1 di 3
HOW TO Install Nagios Core on RedHat Enterprise Linux Systems......
Without Problems :-)
1- Install system software needed by nagios installation
Webegininstallingandverifyingthepackagerequirementsandso,asrootuser,submitthefollowing
command:
yumi nst al l - y wget ht t pd php gcc gl i bc gl i bc- 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 / t mp
wget ht t p: / / pr downl oads. sour cef or ge. net / sour cef or ge/ nagi os/ nagi os- 3. 4. 1. t ar . gz
wget ht t p: / / sour cef or ge. net / pr oj ect s/ nagi ospl ug/ f i l es/ nagi ospl ug/ 1. 4. 15/ nagi os- pl ugi ns-
1. 4. 15. t ar . 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:
user add nagi os
gr oupadd nagcmd
user mod - a - G nagcmd nagi os
Nowwecanextractthesoftwarefromthetarball
t ar zxf nagi os- 3. 4. 1. t ar . gz
t ar zxf nagi os- pl ugi ns- 1. 4. 15. t ar . gz
GiuseppeTurri Email:[email protected]
Pagina 2 di 3
Andinstallthecorenagiossoftware
cd nagi os
. / conf i gur e - - wi t h- command- gr oup=nagcmd
make al l
make i nst al l
make i nst al l - i ni t
make i nst al l - conf i g
make i nst al l - commandmode
make i nst al l - webconf
andthemainplugin
cd . . / nagi os- pl ugi n*
. / conf i gur e - - wi t h- nagi os- user =nagi os - - wi t h- nagi os- gr oup=nagi os
make
make i nst al l
cp - R cont r i b/ event handl er s/ / usr / l ocal / nagi os/ l i bexec/
chown - R nagi os: nagi os / usr / l ocal / nagi os/ l i bexec/ event handl er s
Wecanstartthenagionandhttpdservicesbyissuingthecommand
ser vi ce ht t pd st ar t
ser vi ce nagi os st ar t
Terminatedtheinstallationcommandwecansetthesystemtostartupnagiosandhttpdatstartuptime:
chkconf i g nagi os - - l evel 35 on
chkconf i g ht t pd - - l evel 35 on
Nowwehavetocreateanusertoaccesstothenagioswebinterfacesowecreateanusernamed
nagiosadmindefiningapasswordforit:
ht passwd - c / usr / l ocal / nagi os/ et c/ ht passwd. user s nagi osadmi n
Atthispointthenagioscoreisinstalled,upandrunning.
Youcanaccesstoyournagiosinstallationbybrowsingtheurlhttp://yourservername/nagios
You'llbepromptabasicauthenticationwhereyouhavetousethenagiosadminaccountcreatedwiththelatest
commandsubmitted.
Everytimeyoumodifyanagiosconfigurationfileyoumayverifytheconfigurationbythecommand
/ usr / l ocal / nagi os/ bi n/ nagi os - v / usr / l ocal / nagi os/ et c/ nagi os. cf g
and,ifallisok,youcanrestartthenagiosservicetoexecutethemodifiedcode.
Thenextchapteroftheguideisforhelpingyouincaseofproblems.Toverifyifyourinstallationisfreeofproblems
andtocheckthestatusofyourinstallationIsuggestyouto:
Tryanaccessthroughthewebinterface
Trytoaccesstotheservicessectionandtrytorescheduleachecknow
Trytoverifythemailnotification(changetheemailaddressinthe
/usr/local/nagios/etc/objects/contacts.cfgconfigurationfile).
GiuseppeTurri Email:[email protected]
Pagina 3 di 3
4- MOST COMMON PROBLEMS RESOLUTION
Error403Forbiddenyoudon'thavepermissiontoaccess/nagios/onthisserver.
whenyoutrytoaccessthenagioswebinterface
Checktheinstallationofthephpsoftwareonyoursystem
yumi nst al l php
ser vi ce ht t pd r est ar t
Error:Couldnotopencommandfile/var/nagios/rw/nagios.cmdforupdate!
Whenyoutrytorescheduleacheckofaservicebynagioswebinterface
chown nagi os. nagcmd / usr / l ocal / nagi os/ var / r w
chmod g+r wx / usr / l ocal / nagi os/ var / r w
chmod g+s / usr / l ocal / nagi os/ var / r w
user mod - G nagcmd apache
ser vi ce ht t pd r est ar t
ser vi ce nagi os r est ar t
Youdon'treceiveanyemailnotificationand/oryouareabletosendemail
notificationbycommandline
I'vespentalotoftimewhitthiskindofproblem....
Socheckifyouareabletosendemailbyterminallineasrootuserwiththiscommand:
/ usr / bi n/ pr i nt f "Not i f i cat i on Test " | / bi n/ mai l - s "Thi s i s a t est " your -
emai l @addr ess
Ifyoucanexecutethecommandandyoureceivetheemailnowwecantrytosubmitthesame
commandasnagiosusersoexecute:
su - nagi os
/ usr / bi n/ pr i nt f "Not i f i cat i on Test " | / bi n/ mai l - s "Thi s i s a t est " your -
emai l @addr ess
Probablyyou'llgetthiserror
WARNING:RunAsUserforMSPignored,checkgroupids(egid=503,want=51)
cannotchdir(/var/spool/clientmqueue/):Permissiondenied
Programmoderequiresspecialprivileges,e.g.,rootorTrustedUser.
Ifyouhaveasimilarerrormessagewecansolveitbyissuing,asrootuser,thiscommand:
chmod 2755 / usr / sbi n/ sendmai l . sendmai l
ser vi ce sendmai l r est ar t
Go to NAGIOS website ht t p: / / www. nagi os. com/ #r ef =s57X3l