Anda di halaman 1dari 24

NagiosQL3.

Installation
2012Version2.1 MartinWillisegger Translation WolfgangNieder

Tableofcontents
1 Installation..................................................................................................................................................3 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 2 2.1 2.2 Prerequisites.......................................................................................................................................3 Preparedirectorystructure................................................................................................................ 3 Nagiosconfigurationfiles................................................................................................................... 4 PrepareApacheconfiguration............................................................................................................ 5 InstallPHPmodules(SSH).................................................................................................................. 6 InstallNagiosQL..................................................................................................................................6 NagiosQLinstaller(newinstallation) .................................................................................................. 7 UpdateNagiosQL.............................................................................................................................. 12 Baseconfiguration............................................................................................................................ 1 5 Domainconfig(paths)...................................................................................................................... 1 6 Datadomains ............................................................................................................................ 1 6 Configurationdomain ............................................................................................................... 1 8 RemoteaccessviaFTP.............................................................................................................. 2 0 RemoteaccessviaSSH/SFTP.................................................................................................... 20

ConfigureNagiosQL.................................................................................................................................. 1 5

2.2.1 2.2.2 2.3 2.3.1 2.3.2 3 3.1 3.2

2.3Setupremoteaccess(FTPorSSH/SFTP)..................................................................................... 2 0

NagiosConfiguration................................................................................................................................ 2 2 NagiosConfigurationfile.................................................................................................................. 2 2 Additionalpermissions..................................................................................................................... 2 2 Checkcommand....................................................................................................................... 2 2 Configurationeditor................................................................................................................. 2 3 Restartcommand..................................................................................................................... 2 3 Commonchecks....................................................................................................................... 2 3 Configchecks............................................................................................................................ 2 4

3.2.1 3.2.2 3.2.3 3.3 3.3.1 3.3.2

Supportpage.................................................................................................................................... 2 3

NagiosQL3.2Installation

Page2

1 Installation
1.1 Prerequisites
NagiosQLisawebapplicationandrequiresarunningwebserverincludingPHPsupportandadatabase server. Apachewebserver MySQLServerversion4.1orabove PHPversion5.2orabove Nagios2.xor3.x additionalPHPmodules: session MySQL(php5mysql) gettext filter ftp(optionalforFTPconnectionstoremoteservers) SSH(PECLmoduleoptionalforSSH/SCPconnectionstoremoteservers)

1.2 Preparedirectorystructure
NagiosQLstorestheNagiosconfigurationfilesinaseparatedirectorystructure.Thisshouldpreferablybe createdbyasuperuser(root).Wherethefilesarestoredislefttotheadministrator,inthisguidewewill usethefolder/etc/nagiosql.PleasenotethatthisdirectorystructurehastobeaddedtotheNagios configurationfilenagios.cfglateronsoNagioscanfinditsownconfigurationfiles. ThisdirectorystructurehastobecreatedontheserverrunningNagios.
# # # # # # mkdir mkdir mkdir mkdir mkdir mkdir /etc/nagiosql /etc/nagiosql/hosts /etc/nagiosql/services /etc/nagiosql/backup /etc/nagiosql/backup/hosts /etc/nagiosql/backup/services

ThiswayNagiosQLwillstoreallconfigurationfilesbelow/etc/nagiosql.Hostconfigurationswillbestored in/etc/nagiosql/hosts,serviceconfigurationsin/etc/nagiosql/services.Thebackupstructurewillholdthe previousversionofaconfigurationfile. NagiosQLwillrunasawebapplicationsoyouhavetomakesurethatthewebserverdaemonhaswrite permissionsonthesefoldersifthisisalocalinstallation.FurthermoretheNagiosdaemonmusthaveread permissions.Iftheusersofbothdaemonsareunknownyoucanusethefollowingcommands:


# ps -ef | grep http root 2999 1 wwwrun 3123 2999 0 Jul04 ? 0 Jul04 ? 00:00:10 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf 00:00:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf

Theuserrunningthewebserverdaemoniswwwrun.
# ps -ef | grep nagios nagios 2902 1 0 Jun22 ? 00:05:39 /usr/sbin/nagios -d /etc/nagios/nagios.cfg

TheuserrunningtheNagiosdaemonisnagiosbutinthiscaseweneedthegroup.
# id nagios uid=111(nagios) gid=111(nagios) groups=111(nagios)

ThegroupoftheuserrunningtheNagiosdaemoniscallednagiosaswell.
NagiosQL3.2Installation Page3

Nowwecansetthepermissionsofthestructureasfollows:
# chown R wwwrun.nagios /etc/nagiosql

Alternativelythepermissionscanbesetto750(directories),and640(cfgfiles),respectively. UsingremoteNagiosinstallationsbeingadministeredbyNagiosQLviaFTPorSSH/SCPthisdirectory structurehastobecreatedontheremotesystem.Theninsteadofthewebserverdaemonuseryouhave tosetwritepermissionsonthedirectoriesfortheuseraccessingviaFTPorSSH/SCP.

1.3 Nagiosconfigurationfiles
NagiosQLneedsread/writepermissionsonsomeNagiosconfigurationfilesaswell.Thefollowingfilesare affected: Nagiosmainconfigurationfile:nagios.cfg(writepermissions) NagiosCGIconfigurationfile:cgi.cfg(writepermissions) Nagiosprocessfile:nagios.pidornagios.lock(readpermissions) Nagioscommandpipe:nagios.cmd(writepermissions) Thelocationofthesefilescanbedeterminedusingthefindcommand:
# find / -name nagios.cfg /etc/nagios/nagios.cfg # find / -name cgi.cfg /etc/nagios/cgi.cfg # find / -name nagios.pid /var/run/nagios.pid # find / -name cgi.cfg /var/spool/nagios/nagios.cmd

PleasenotethatthewebserverdaemonandtheNagiosdaemonhavetogetthenecessarypermissions. Thiscanbeaccomplishedinseveralwaysviauser/grouppermissions.Followinganexampleforalocal installation:


# # # # # # chown chown chown chmod chmod chmod R wwwrun.nagios /etc/nagios/nagios.cfg R wwwrun.nagios /etc/nagios/cgi.cfg R wwwrun.nagios /var/spool/nagios/nagios.cmd 640 /etc/nagios/nagios.cfg 640 /etc/nagios/cgi.cfg 660 /var/spool/nagios/nagios.cmd

Readpermissionsontheprocessfilearenormallyachievedviastandardpermissions644butinthiscase thepathshouldberemembered.Allotherpathsshouldbejotteddownaswellsoyoucanfillthemininto theNagiosQLconfigurationdomain.

NagiosQL3.2Installation

Page4

1.4 PrepareApacheconfiguration
NowawebserverdirectoryhastobecreatedwheretheNagiosQLwebapplicationcanbeinstalledlater on.Thisguidewilluse/opt/nagiosql.
# mkdir /opt/nagiosql # chown wwwrun /opt/nagiosql

Thesettingoftwooptionsinphp.inioftheApachewebservershouldbeverified(usingopenSuSE/SLESthe locationis/etc/php5/apache/php.ini,Fedora,CentOS/etc/php.ini,Debian/etc/php5/apache2/php.ini):
file_uploads = On session.auto_start = 0 date.timezone = "Europe/Zurich" (bzw. "Europe/Berlin" oder "Europe/London" etc.)

Pleasecreateaconfigurationfileforthewebserver.Thelocationdiffersbetweendistributions.Using openSuSE/SLES/Debianthelocationis/etc/apache2/conf.d,Fedora,CentOS/etc/httpd/conf.d.
# touch /etc/apache2/conf.d/nagiosql.conf Thefilecanbemodifiedusingyourfavouriteeditor(e.g.vi)andshouldhavethefollowingcontents: # # # # # # # NAGIOSQL SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER Last Modified: 03-24-2011 This file contains examples of entries that need to be incorporated into your Apache web server configuration file. Customize the paths, etc. as needed to fit your system.

Alias /nagiosql "/opt/nagiosql" <Directory "/opt/nagiosql"> Options None AllowOverride None Order allow,deny Allow from all # Order deny,allow # Deny from all # Allow from 127.0.0.1 # AuthName "NagiosQL Access" # AuthType Basic # AuthUserFile /etc/nagiosql/auth/nagiosql.users # Require valid-user </Directory>

IfyouwanttousebasicApacheauthenticationthelinesinredhavetobeactivated,theblueones deactivated.ThepathtoAuthUserFilehastobeadaptedtoyourenvironment.Besidesbasicauthentication youcanuseeveryotherauthenticationmethodsupportedbyApache(LDAP/Kerberos/MySQL/etc.) pleaseconsulttheApachedocumentationfordetails. PleaseverifythatApacheprocessesthese*.conffilesatall.Thismightbedoneviahttp.conforusinga suitableVirtualHostconfiguration:


Include /etc/apache2/conf.d/nagiosql.conf

Dontforgettocreatethewebfolder,testthenewconfigurationandactivatethechanges (SLES/openSuSE):
# rcapache2 configtest # rcapache2 restart

Fedora/RHEL/CentOS:
# service http restart

Debian/Ubuntu:
# /etc/init.d/apache2 restart

NagiosQL3.2Installation

Page5

1.5 InstallPHPmodules(SSH)
IfPHPmodulesaremissing(prerequisitesorinstaller),theyhavetobeinstalledbeforecontinuing.Inmost casesthisispossibleusingthetoolsincludedinyourdistribution(YaST/aptget/rpm).Aspecialcaseisthe SSHmodule.FollowingsomeinstructionsonhowtoinstallSSHforNagiosQL. ToinstalltheSSHmodulethetoolPECLisneeded.Normallythiscanbeinstalledusingthepackagetool (YaST/aptget/rpm). IfPECLisinstalleditcanbecalledissuing:
# pecl

Withoutanyparameterssomehelptextisshown.Ifthesystemisbehindaproxyserver,itmightbe necessarytoconfigurePECLtouseit:
# pecl config-set http_proxy # pecl config-show http://proxy.myserver.tld:8080

NowtheSSHmodulecanbeinstalled:
# pecl install ssh2

Thenishastobeincludedinphp.ini.DontforgettorestartApache:
extension = ssh2.so # rcapache2 restart

ThesetupofauserforSSHisshownlateroninthisguide.

1.6 InstallNagiosQL
NowyoucaninstallNagiosQLintothenewwebfolder.Pleasecopyitto/opt(not/opt/nagiosql)and unpackit:
# # # # # cd /opt gunzip c nagiosql_320.tar.gz | tar xf mv nagiosql32 nagiosql chown R wwwrun /opt/nagiosql chmod 750 /opt/nagiosql/config

NowNagiosQLshouldbereachableviayourwebbrowser: http://localhost/nagiosql http://mein.virtualhost.tld/nagiosql

NagiosQL3.2Installation

Page6

1.7 NagiosQLinstaller(newinstallation)
NormallytheinstallerisstartedautomaticallyduringthefirstcallofNagiosQL.Youmightstartitmanually aswell: http://localhost/nagiosql/install/index.php Ifalliscorrectyourbrowsershouldsomethinglikethefollowing:

ThispagejustshowsashortlistofthecurrentprerequisitesfortheinstallationofNagiosQL.Additionallyit ispossibletoselectyourfavouritelanguage. STARTUPDATEisonlyavailableifavalidversionofsettings.phpofapreviousversionwascopiedto /opt/nagiosql/config.Theupdateisdescribedlateronin1.8.

NagiosQL3.2Installation

Page7

ClickSTARTINSTALLATIONtocontinue. Nextaretheenvironmenttestsdividedintosevensections. Thefollowingimageshowsanexecutableenvironment:

CheckingClient: ItischeckedifthebrowserprocessesJavaScriptandifthisisactivated.Somebrowseraddonscandisable JavaScriptifthisisthecaseJavaScripthastobeenabledforNagiosQLexplicitly. CheckinPHPversion: ItischeckedifthePHPversionisadequate.IfthisisnotthecaseyouhavetoupdateyourPHPversion. Consultthedocumentationofyourdistributionfordetails.

NagiosQL3.2Installation

Page8

CheckingPHPextensions: ThefirstPHPextensionsaremandatory.MissingonesmustbeinstalledtobeabletouseNagiosQL.The optionalextensionsonlyhavetobeinstalledifyouwanttousetheappropriateoptionsofNagiosQL. Checkingavailabledatabaseconnections: NagiosQLrequiresatleastonePHPmoduletointerfacewithadatabase(e.g.moduleMySQL). Checkingphp.ini/.htaccesssettings: Itischeckediftherequiredsettingsinphp.iniarecorrect(see1.4) CheckingSystemPermissions: ItischeckedifallNagiosQLfilesarereadable/writeable.Atthemostsomepermissionshavetobe modified.Ifyoufollowedthisguideallsettingsshouldbecorrectalready. Youcanrechecktheenvironmentbycallinginstall/index.phpandclickingSTARTINSTALLATIONonceagain. IfalltestsaresuccessfulyoucanclickonNexttogettothenextpage:


NagiosQL3.2Installation

Page9

Onthispagetheinformationforthedatabaseserverisspecified. DatabaseType: Selectthedatabasetype(notyetactivein3.2.0) DatabaseServer: Hostnameofthedatabaseserver LocalhostnameorIPaddress: HostnameorIPaddressofthewebserver Important:ifthedatabaseserverisnotrunningonthesamesystemasthewebservertheentrylocal hostnameisusedtospecifytheaccess(source)forthedatabaseserver! (allowaccessfor:nagiosql_user@webserver) DatabaseServerPort: TCPportofthedatabaseserverdaemon Databasename: NameofthedatabasetobecreatedforNagiosQL NagiosQLDatabaseUser: UsernamefortheNagiosQLdatabase NagiosQLDatabasePassword: PasswordoftheNagiosQLdatabaseuser TheNagiosQLdatabaseuserwillnotexistduringanewinstallationandwillbecreatedaccordingthe informationgivenhere. AdministrativeDatabaseUser: Adminuser AdministrativeDatabasePasswort: Adminpassword Theadministrativeuser(e.g.root)hastoexistalreadyandmusthavesufficientrightstocreateanew databaseandauserwhichwillbegivenaccesstothenewdatabase.Thedataoftheadministrativeuserwill NOTbestoredinNagiosQLitwillonlybeusedtocreatethedatabase. Dropdatabaseifalreadyexists: Deleteadatabasewiththesamename(Attention)

InitialNagiosQLUser: NagiosQLadminuser(admin) InitialNagiosQLPassword: NagiosQLadminpassword AdministrativeuserforlogintotheNagiosQLwebapplication.Thisusercannotbedeletedlateron. ImportNagiossampleconfigwouldimportsomesampledataintothedatabase. CreateNagiosQLconfigpathscreatesadirectorystructureasdecribedin1.2(whichisntnecessary anymoreifyouarefollowingthisguide).OnerequirementwouldbethattheNagiosQLconfigdirectoryis writeableforthewebserverdaemon.AmodificationofUID/GIDisnotpossiblesoithastobedonelateron manually. NagiosQLconfigpath: Nagiosconfigpath: Basedirectoryfortheconfigfiles BasedirectoryfortheNagiosconfigfiles(containsnagios.cfg)

Thisinformationisusedtopreconfigurethelocalhostdomain.

NagiosQL3.2Installation

Page10

Ifallinformationwasenteredcorrectlyandthedatabasecouldbecreated,yougetthefollowingoutput:

Afterwardsthedirectory/opt/nagiosql/installshouldbedeleted.
# rm rf /opt/nagiosql/install

AftersuccessfulinstallationsomebaseconfigurationswithinNagiosQLhavetobecheckedorset.Thenext chapterdealswiththistask.

NagiosQL3.2Installation

Page11

1.8 UpdateNagiosQL
Updateissimilartotheinstallationasdescribedin1.7.Pleasenotethatthefileconfig/settings.phpofthe oldNagiosQLinstallationwillnotbemodifiedandiscopiedtotheconfigdirectoryofthenewinstallation. Youmustnevercopythefilesofanewversionintotheexistingdirectoryofanold/previousNagiosQL version! Itisveryimportanttobackuptheexistingdatabasebeforeyoustart!Otherwiseifanythinggoeswrong duringtheupdateitcannotberepeatedandthedatabasemaybecorruptandinanundefinedstate.In mostcasesyouthenhavetorunanewinstallationandimportallconfigurationdata. AbackupcanbemadeveryeasilyusingcommontoolslikephpMyAdmin.Alternativelytherearecommand linetoolslikemysqldump.

ClickSTARTUPDATEtocontinue. Afterwardsthesameenvironmenttestsareexecutedasduringanewinstallation.Pleaseconsultthepage fordetails.

NagiosQL3.2Installation

Page12

IfalltestsaresuccessfulyoucanclickonNexttogettothenextpage:

Toruntheupdateasexpectedyouonlyhavetoentertheinformationregardingtheadministrative databaseuser.Theotherdataismodifiableaswellbutyoushouldonlyalteritifyouaresurethatyou knowwhatyouaredoing. AdministrativeDatabaseUser: Adminuser AdministrativeDatabasePasswort: Adminpassword Theadministrativeuser(e.g.rootuser)hastoexistalreadyandmusthavesufficientrightstocreateanew databaseandauserwhichwillbegivenaccesstothenewdatabase.Thedataoftheadministrativeuserwill NOTbestoredinNagiosQLitwillonlybeusedtocreatethedatabase.

NagiosQL3.2Installation

Page13

Ifallinformationwasenteredcorrectlyandthedatabasecouldbecreated,yougetthefollowingoutput:

Afterwardsthedirectory/opt/nagiosql/installshouldbedeleted.
# rm rf /opt/nagiosql/install

NagiosQL3.2Installation

Page14

2 ConfigureNagiosQL
2.1 Baseconfiguration
TheNagiosQLbaseconfigurationcanbeaccessedinthewebapplicationclickingAdministrationSettings. Hereyouwillfindsomeotherdatawhichyouenteredusingtheinstaller.Thebluequestionmarksymbol nexttoeachitemwillshowashorthelptext.

Worthmentioningarethefollowingvalues: TemporaryDirectory: Serverprotocol: Language: ThedirectoryNagiosQLusestostoretemporaryfiles.Normallythiswill be/tmp. IfNagiosQLisinstalledinanSSLenvironmentyoucanchoosehttps. Settinganincorrectvaluemightaffect/endtheoperation! TheNagiosQLinterfacemightbechangedtouseanotherlanguage. Sometimesthebrowsercachehastobecleared,thebrowserand/or Apachetoberestartedsothatthenewsettingtakeseffect. IftheApacheauthenticationistobeusedthisvaluehastobeset accordingly. Thenumberoflinesinlistviewscanbesethere. TheNagiosQLsupportpagewillshowifanewNagiosQLversionis available. Environmentsusingaproxyserverwillhavetosettheappropriatevalues.

Authenticationtype: Datalinesperpage: Onlineversioncheck:

NagiosQL3.2Installation

Page15

2.2 Domainconfig(paths)
ThedifferentdomainsandpathsoftheNagiosinstallationstobecontrolledaredeterminedusingthe domainadministration.ThisistobefoundbelowAdministration. Therearetwosortsofdomains:

2.2.1 Datadomains
Datadomainsareusedfordatastorage,i.e.theycontaintheconfigurationobjects.Theselectionfieldin theupperleftoftheviewalwaysshowsthecurrentlyactivedatadomain.

Therearetwogivendatadomainswhichcannotbedeletedorrenamed: CommonDataDomain Ageneraldatadomainwhichcanbeincludedintoeveryotherdatadomain.Thismightbeusefulfor contacts,timeperiods,orcommands,whichareidenticalineverydatadomain.Thereareonlyveryfew settingsavailable. LocalhostDataDomain Thedatadomainofthelocalserver.Apartfromthefactthatthisdatadomaincannotberenamedthereis nodifferencetootherdatadomains.

NagiosQL3.2Installation

Page16

Configurationoptions

Internalnameofthedatadomain(willbeshownintheconfigviews). Detaileddescriptionofthedatadomain Selectionofthetargetconfigurationdomain(see2.2.2). VersionoftheNagiosinstallation(version2.xor3.xaresupported)depending ontheversionadditionaloptionsaredisplayedintheviews. Usecommondomain: Thecommondatadomaincanbeswitchedonoroff.Assoonasthecommon datadomainisswitchedonandobjectsaredefined,theseobjectswillbewritten intotheconfigfilesofthecurrentdatadomain. Accessgroup: Selectwhichusergroupgetsaccesstothisdatadomain. Active: Definewhetherthedatadomainisactiveornot. Domain: Description: Configurationtarget: NagiosVersion:

NagiosQL3.2Installation

Page17

2.2.2 Configurationdomain
ConfigurationdomainsareusedtodefineaNagiosinstallation(site),theycontainthepathsandconnection settings. Configurationoptions

Domain: Description: Servername: Method: Internalnameoftheconfigurationdomain (willbeshownindatadomainconfigtarget) Detaileddescriptionofdomain HostnameofthesystemrunningtheNagiosinstallationofthisdomainmustbe resolvabletoanIPaddress TheconnectiontypespecifieshowNagiosQLwillaccesstheconfigfiles.Valid optionsare: Fileaccess Thefilesarestoredonthelocalfilesystemoftheserver orareaccessiblefromthere(NFS/SMB/CIFSetc.) FTP TheconfigfilesareaccessedviaFTP SSH/SFTP TheconfigfilesareaccessedviaSSH/SFTP Inthenextchapter(2.3)wewillgivesomeshortinstructionsonhowtosetupFTP andSSH/SFTP Usernametologinontothetargetsystem(onlyFTPorSSH/SFTP) Passwordtologinontothetargetsystem(onlyFTPorSSH/SFTP) LocaldirectorywheretheSSHkeyisstored(onlySSH/SFTP)
Page18

Username: Password: Dir.withSSHkey pair:


NagiosQL3.2Installation

BasedirectoryforNagiosconfigfiles.Allconfigfilesapartfromthoseforhosts andservicesarestoredinthisfolder. /etc/nagiosql Hostdirectory: DirectoryfortheNagioshostconfigfiles /etc/nagiosql/hosts Servicedirectory: DirectoryfortheNagiosserviceconfigfiles /etc/nagiosql/services Backupdirectory: DirectorywhereNagiosQLwillstorebackupversionsofconfigfiles(exceptfor hosts/services) /etc/nagiosql/backup Hostbackupdir.: DirectorywhereNagiosQLwillstorebackupversionsofhostconfigfiles /etc/nagiosql/backup/hosts Servicebackupdir.: DirectorywhereNagiosQLwillstorebackupversionsofserviceconfigfiles /etc/nagiosql/backup/services Nagiosbasedir.: BasedirectoryoftheNagiosinstallation.Thefilesnagios.cfgandcgi.cfgare storedinthisdirectoryandNagiosQLexpectsthemtobethere! /etc/nagios Importdirectory: Alternativeimportdirectory.Configfilesinthisdirectoryareofferedtobe importedaswell /etc/nagios/objects Picturebasedir.: Alternativeimagedirectory.NormallythepathtoimagesisstaticinNagios(e.g. /usr/local/nagios/share/images/logos).Thisdirectorycanbeusedasasecond basedirectoryforadditionalfiles/directories.Otherdefinitionsusingthefolder arerelativetothisentry. Nagioscommandfile: PathtotheNagioscommandfile(nagios.cmd).Thisfileisrequiredtosend externalcommandstotheNagiosdaemon.Pleasenotethatthisfileisonly created/readwhencheck_external_commands=1issetinnagios.cfg! /var/nagios/rw/nagios.cmd Nagiosbinaryfile: PathtotheNagiosbinary /opt/nagios/bin/nagios NagiosProcessfile: PathtotheNagiosprocessfile(PIDorLOCKfile) /var/nagios/nagios.lock Nagiosconfigfile: Pathtonagios.cfg /etc/nagios/nagios.cfg Nagiosversion: VersionoftheNagiosinstallation(Version2.xor3.xaresupported). Accessgroup: Selectwhichusergroupgetsaccesstothisdatadomain Active: Definewhetherthedatadomainisactiveornot

Basedirectory:

NagiosQL3.2Installation

Page19

2.3 2.3

Setupremoteaccess(FTPorSSH/SFTP)

2.3.1 RemoteaccessviaFTP
OnthelocalsystemthePHPmoduleftphastobeinstalled. OnthetargetsystemanFTPserverhastobeinstalled.AdditionallyaseparateuserforNagiosQLissetup. TheNagiosQLdirectorystructureasdescribedin1.2willbecreatedonthetargetsystem.Furthermorethe permissionsontheremotesystemhavetobesetupasdescribedin1.2and1.3.Insteadofthewebserver daemontheNagiosQLFTPuserhastogetwritepermissions. ThecredentialsoftheNagiosQLFTPuserhavetofilledintothefieldsuserandpasswordinthedomain configuration(2.2).

ItisrecommendedtochecktheFTPconnectionusinganFTPclientbeforeyouenterthevalues. UsingFTPthefunctionalityinToolsNagioscontrolislimited.CheckconfigurationfilesandRestart NagiosviaFTPwillonlyworkonaserversupportingREMOTEEXECbutduetosecuritylimitations nowadaysthisisrarelyseen.

2.3.2 RemoteaccessviaSSH/SFTP
OnthelocalsystemthePHPmodulessh2hastobeinstalled(1.5). OnthetargetsystemanSSHserverhastobeinstalled.Allowaccess(firewalletc.)fromthelocalsystemto thetargetsystem. CreateanewuserforNagiosQLonthetargetsystem,e.g.nagiosql_usr.Pleasenotethatsomedistributions maylimitthelengthofusernames.Thenyouhavetocreateakeypairasfollows. Localsystem: 1. CreateapathfortheSSHkeys:
# mkdir /etc/nagiosql/ssh

2. Createakeypaironlyrsaissupported:
# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): /etc/nagiosql/ssh/id_rsa

>leavethepasswordempty! Thenameofthekeyfilemustbeid_rsa! 3. Thekeyistobecopiedtothetargetsystem:


# ssh-copy-id -i /etc/nagiosql/ssh/id_rsa/id_rsa.pub nagiosql_usr@remote-system

4. Thekeyin/etc/nagiosql/sshhastobereadableforthewebserverdaemon!
# chown R wwwrun.nagios /etc/nagiosql/ssh # chown R wwwrun.nagios /etc/nagiosql/ssh/id_rsa

5. Pleasecheckloginmanually:
# ssh -i /etc/nagiosql/ssh/id_rsa nagiosql_usr@remote-system

>Loginhastobepossiblewithoutenteringapassword! ThenameoftheNagiosQLSSHuser(nagiosql_usr)willbesetinthedomainconfig(2.2)fillinginUser name.ThefieldfortheSSHkeypairdirectorywillholdthevalueofthedirectory(/etc/nagiosql/ssh/).

NagiosQL3.2Installation

Page20

Thefieldpasswordcanbeleftemptybecauseitisnotused. Anauthenticationusinguserandpassword(withoutkey)ispossiblebutstronglydiscouragedbecauseitis generallymoreerrorprone.Ifyoustillwanttouseitthenyouhavetosetthefollowingvaluein sshd_configonthetargetsystem:


PasswordAuthentication yes

NagiosQL3.2Installation

Page21

3 NagiosConfiguration
3.1 NagiosConfigurationfile
TheNagiosconfigurationfilenagios.cfghastobeadaptedsothatNagioscanfindandusetheconfiguration fileswrittenbyNagiosQL.ThiscanbedoneusingtheintegratededitorofNagiosQL,iftheaccess permissionsweresetcorrectly(1.3). Importantarethepathsofthestandardconfigfiles: cfg_file=/etc/nagiosql/contacttemplates.cfg cfg_file=/etc/nagiosql/contactgroups.cfg cfg_file=/etc/nagiosql/contacts.cfg cfg_file=/etc/nagiosql/timeperiods.cfg cfg_file=/etc/nagiosql/commands.cfg cfg_file=/etc/nagiosql/hostgroups.cfg cfg_file=/etc/nagiosql/servicegroups.cfg
cfg_dir=/etc/nagiosql/hosts cfg_dir=/etc/nagiosql/services

Someadditionalconfigfilesiftheyareused:
cfg_file=/etc/nagiosql/hosttemplates.cfg cfg_file=/etc/nagiosql/servicetemplates.cfg cfg_file=/etc/nagiosql/servicedependencies.cfg cfg_file=/etc/nagiosql/serviceescalations.cfg cfg_file=/etc/nagiosql/hostdependencies.cfg cfg_file=/etc/nagiosql/hostescalations.cfg cfg_file=/etc/nagiosql/hostextinfo.cfg cfg_file=/etc/nagiosql/serviceextinfo.cfg

Allexistinglinesstartingwithcfg_file=orcfg_dir=havetoberemovedordeactivatedusingaleadinghash sign(#)!Theremustbenoothercfglinesexcepttheonesmentionedabove. RestartingNagiosfromNagiosQLrequiresthatNagioshastoacceptexternalcommandswhichiscontrolled bythefollowinglineinnagios.cfg:


check_external_commands=1

3.2 Additionalpermissions
ForcompletefunctionalityofNagiosQLsomeNagiosfileshavetobeaccessibleforNagiosQL(see1.3).For localinstallationstheuserrunningthewebserverdaemonhastobepermitted,remoteinstallations requiretheNagiosQLFTPorSSH/SCPusertobepermitted.Subsequentlytheguideusesthetermuser.

Thepathstothesefileshavetobesetinthedomainconfiguration(see2.2).Regardingthe permissionsthereareseveralways(filepermissions,sudo,acl).Furthermoretheinstallations differindividually. 3.2.1 Checkcommand


TocheckthecurringconfigurationNagiosQLwillusetheinternalverifymethodofNagios:
# nagios v nagios.cfg

<nagiosbinary>v<nagiosconfigurationfile> TheusermusthavepermissionstoexecutetheNagiosbinaryandreadpermissionsonnagios.cfg.

NagiosQL3.2Installation

Page22

3.2.2 Configurationeditor
Thefilesnagios.cfgandcgi.cfgcanbeediteddirectlyfromwithinNagiosQLusingasimpleeditor.

Theusermusthavewritepermissionsontheconfigfilesnagios.cfgandcgi.cfg. 3.2.3 Restartcommand


ToactivateanewconfigurationdirectlyfromwithinNagiosQLpermissionsonthecommandfile nagios.cmdandtheprocessfilenagios.lockarerequired. Theusermusthavewritepermissionsonthecommandfilenagios.cmdandreadpermissionsonthe processfilenagios.lock,ornagios.pid,respectively.

3.3 Supportpage
SinceNagiosQL3.2.0wehaveasupportpagerunningthemostimportantinternalchecksandshowingthe results.Commonmisconfigurationsaredetectedquicklyandyouareabletosolveyourproblems.

3.3.1 Commonchecks

Youwillfindsomehelpfullinks.Basicenvironmentchecksareexecuted.Ifsomethingdoesntworkaftera systemupgradeyoumightfindahint. IfenableditwillbecheckedifthemostcurrentversionofNagiosQLisinstalled.

NagiosQL3.2Installation

Page23

3.3.2 Configchecks

ItwillbecheckedifallrelevantNagiosfilesareavailableandiftheuserpermissionsarecorrect(see1.3). ThelastpartprocessestheNagiosconfigfile(nagios.cfg)andchecksifthenecessarypathsettings(see3.1) weremadeandiftheyareequaltotheonesintheselectedconfigdomain. Generallyallredentriesonthesupportpageindicateaproblemwhichmustbesolved.Yellowentries indicateproblemswhichmightpopuplater.

NagiosQL3.2Installation

Page24