超详细CentOS 7 xUbuntu 1504 安装icinga Web 2.docx
《超详细CentOS 7 xUbuntu 1504 安装icinga Web 2.docx》由会员分享,可在线阅读,更多相关《超详细CentOS 7 xUbuntu 1504 安装icinga Web 2.docx(12页珍藏版)》请在冰豆网上搜索。
超详细CentOS7xUbuntu1504安装icingaWeb2
IcingaisanopensourcenetworkmonitoringapplicationthatprovidesuswithIcingaWeb1andIcingaWeb2interfacestofullymanageandmonitorthehostsandservicesthroughitsdashboard.IcingaWeb2isthesuccessorofIcingawebwhichislightweight,fastandflexibletoembedintootherprojectsthatsupportsmultipleauthenticationmethodslikeActiveDirectory,LDAPordatabaseandmultiplemonitoringbackends.So,thisamajoradvanceinthecreationofhostsandservicesactions,insteadofdefiningthemviaIcinga'sconfigurationfilesandeveryuserisnowenabledtocreatethemwiththewebinterfaceandevensharethemtoothers.
WecancustomizeandconfiguretheIcingaWeb2usingmanymodulesforitsviews,filtersanddashboards.Timestampsandstatusupdatescanberefreshedautomaticallyeverysecond,rollingalongsmoothlysavingyoureyesthestrainofflickeringdisplays.
InthisarticlewewillbeusingtheCentOS7forthecompleteinstallationandconfigurationofIcingaWeb2.IfyouwanttouseUbuntuasyourbaseOperatingsystemthenyoucanalsorefertoourpreviousarticleofIcinga2onUbuntu15.04.
InstallingPrerequisites
IcingaWeb2installationdependsuponanumberoffollowingpackagesthatmustbeinstalledonyoursystembeforetheinstallationofIcingaWeb2onCentOS7orUbuntu15.
Let'sfollowthebelowstepstocompletetheprerequisitesbyinstallingrequiredpackagesandothersettings.
1)SystemUpdate
Logintoyoursystemwithrootorsudouserprivilegesandrunthefollowingcommandtoupdateyoursystem.
ForCentOS:
#yumupdate
ForUbuntu:
#apt-getupdate
2)InstallingIcinga2
ToinstallIcinga2wewillusetheofficialpackagerepositoriesthatcanbedownloadedfromthisIcingaWebPage.
TosetupEPRLrepositoriesforIcingaInstallationrunthefollowingcommands.
ForCentOS:
ToimportthearchivekeyandtosetupthesurrentstablebuildsofIcinga,runbelowcommand.
#rpm--importhttp:
//packages.icinga.org/icinga.key
#wgethttp:
//packages.icinga.org/epel/ICINGA-release.repo-O/etc/yum.repos.d/ICINGA-release.repo
#yummakecache
NowruntheIcinga2Installationcommandasshownbelow.
#yuminstallicinga2
Thefollowingnumberofpackagesincludingthedependencieswillbeinstalledasshown.Toproceedruntypethe"Y"keytocontinue.
===========================================================================================
PackageArchVersionRepositorySize
===========================================================================================
Installing:
icinga2x86_642.3.10-1.el7.centosicinga-stable-release9.1k
Installingfordependencies:
boost-program-optionsx86_641.53.0-23.el7base155k
boost-regexx86_641.53.0-23.el7base294k
boost-systemx86_641.53.0-23.el7base39k
boost-threadx86_641.53.0-23.el7base56k
icinga2-binx86_642.3.10-1.el7.centosicinga-stable-release2.2M
icinga2-commonx86_642.3.10-1.el7.centosicinga-stable-release73k
TransactionSummary
===========================================================================================
Install1Package(+6Dependentpackages)
Totaldownloadsize:
2.8M
Installedsize:
15M
Isthisok[y/d/N]:
y
ForUbuntu
RunthebelowcommandstoaddtheIcingarepositorytoyourpackagemanagementconfigurationusingPPA.
#add-apt-repositoryppa:
formorer/icinga
#apt-getupdate
#apt-getinstallicinga2
TheinstallationprocesswillbeinstallingtheIcinga2includingsomeofitsrequireddependencies.
Thefollowingextrapackageswillbeinstalled:
icinga2-binicinga2-commonicinga2-doclibboost-program-options1.55.0libboost-regex1.55.0libboost-system1.55.0
libboost-thread1.55.0libyajl2nagios-plugins-basicnagios-plugins-common
Suggestedpackages:
nagios3icinga
ThefollowingNEWpackageswillbeinstalled
icinga2icinga2-binicinga2-commonicinga2-doclibboost-program-options1.55.0libboost-regex1.55.0libboost-system1.55.0
libboost-thread1.55.0libyajl2nagios-plugins-basicnagios-plugins-common
0toupgrade,11tonewlyinstall,0toremoveand92nottoupgrade.
Needtoget3,201kBofarchives.
Afterthisoperation,18.4MBofadditionaldiskspacewillbeused.
Doyouwanttocontinue?
[Y/n]Y
3)StartingIcinga2
UponsuccessfulinstallationofIcinga2,nowstartitsservicesandenablethemtostartateachreboot.
ForCentOS7/Ubuntu15
RunthefollowingcommandstoEnable,StartandcheckthethestatusofIcinga2serviceonCentos7andUbuntu15.
#systemctlenableicinga2
#systemctlstarticinga2
#systemctlstatusicinga2
4)MySQLDatabaseSetup
WewillbeusingtheMySQLdatabasethatwillbeusedforIcingaweb2interface.So,let'srunthebelowcommandstoinstallMySQLMariaDB.
ForCentOS7
#yuminstallmariadb-servermariadb
Afterinstallationcompletes,startthemariadbservicesandconfigureitsrootpasswordusingthebelowcommand.
#systemctlenablemariadb
#systemctlstartmariadb
#mysql_secure_installation
ForUbuntu15
ToinstalltheMySQLdatabaserunthebelowcommandandconfiguretherootpasswordduringtheinstallationprocess.
#apt-getinstallmysql-servermysql-client
#servicemysqlstart
CreateNewDatabase
Nowlogintothemysql/mariadbandcreatethenewdatabasewithanewuserwithitsspecificprivilegesonthedatabaseusingthebelowcommands.
MariaDB[(none)]>CREATEDATABASEicinga2;
QueryOK,1rowaffected(0.00sec)
MariaDB[(none)]>GRANTSELECT,INSERT,UPDATE,DELETE,DROP,CREATEVIEW,INDEX,EXECUTEONicinga2.*TO'icinga2'@'localhost'IDENTIFIEDBY'icinga123';
QueryOK,0rowsaffected(0.00sec)
MariaDB[(none)]>exit
5)InstallingMySQLIDOModule
ForCentOS:
RunthebelowcommandtoinstallIDOMySQLmoduleforIcinga2.
#yuminstallicinga2-ido-mysql
NowimporttheIcinga2IDOschemausingthefollowingcommand.
#mysql-uroot-picinga2
AnewconfigurationfilewillbecreatedafterinstallationofIcingaIDOModulewhichislocatedin/etc/icinga2/features-available/ido-mysql.conf.So,openthisfileusinganyeditorandupdatethedatabasecredentialsinthisfile.
library"db_ido_mysql"
objectIdoMysqlConnection"ido-mysql"{
//user="icinga"
//password="icinga"
//host="localhost"
//database="icinga"
}
Thenenablemoduleandcheckthelistitshouldnowlistedundertheenabledmodulebyusingthefollowingcommandincentos7.
[root@centos-7~]#icinga2featureenableido-mysql
warning/cli:
Feature'ido-mysql'alreadyenabled.
[root@centos-7~]#icinga2featurelist
Disabledfeatures:
apicommandcompatlogdebugloggelfgraphiteicingastatuslivestatusopentsdbperfdatastatusdatasyslog
Enabledfeatures:
checkerido-mysqlmainlognotification
ForUbuntu:
InubuntuduringtheinstallationprocessofIDOMySQLModule,youwillbeaskedConfiguretheicinga2-ido-mysqlwhetheryouwanttoenableitornot.
#apt-getinstallicinga2-ido-mysql
So,youwillchoosethe"Yes"optionandpressOKtoproceedtheninthenextstepsyouhavetoconfigureitsconfigurationfilebyprovidingtheMySQLrootcredentialsthatwillconfigurethefollowingnewconfigurationfiles.
Creatingconfigfile/etc/dbconfig-common/configwithnewversion
Settingupicinga2-ido-mysql(2.3.10-1~ppa1~vivid1)...
dbconfig-common:
writingconfigto/etc/dbconfig-common/icinga2-ido-mysql.conf
Creatingconfigfile/etc/dbconfig-common/icinga2-ido-mysql.confwithnewversion
Creatingconfigfile/etc/icinga2/features-available/ido-mysql.confwithnewversion
grantingaccesstodatabaseicinga2idomysqlforicinga2-ido-mysq@localhost:
success.
verifyingaccessforicinga2-ido-mysq@localhost:
success.
creatingdatabaseicinga2idomysql:
success.
verifyingdatabaseicinga2idomysqlexists:
success.
populatingdatabaseviasql...done.
dbconfig-common:
flushingadministrativepassword
LikethesamewayrunthebelowcommandtoenaleIDOMySQLIcingaModule.
root@ubuntu-15:
~#icinga2featureenableido-mysql
Enablingfeatureido-mysql.MakesuretorestartIcinga2forthesechangestotakeeffect.
root@ubuntu-15:
~#serviceicinga2restart
root@ubuntu-15:
~#icinga2featurelist
Disabledfeatures:
apicommandcompatlogdebugloggelfgraphiteicingastatuslivestatusopentsdbperfdatastatusdatasyslog
Enabledfeatures:
checkerido-mysqlmainlognotification
Youcheckandchangethedtaabaseconfigurationsettingifrequiredbyusingthebelowfile.
#vim/etc/icinga2/features-available/ido-mysql.conf
6)WebserverSetup
Aftercompletingthedatabaseinstallationandconfigurationsetup,nowwemovetowardsApachewebserverinstallationbeforestartingtheIcingaWeb2.
Let'srunthebelowcommandstotosetupyourwebserverinstallation.
ForCentOS
IncentOS,youcanusethefollowingcommandstoinstallapacheserverandstartitsservicesasshown.
#yuminstallhttpd
#systemctlenablehttpd
#systemctlstarthttpd
ForUbuntu
Forubuntuyouwillusethefollowingcommandsfortheapachewebserverinstallation.
#apt-getinstallapache2
#serviceapache2start
FirewallSetting
Usethefollowingcommandstoallowapacheservicesinyourfirewall.
#firewall-cmd--add-service=http
#firewall-cmd--permanent--add-service=http
#firewall-cmd--reload
#iptables-AINPUT-ptcp-mtcp--dport80-jACCEPT
#serviceiptablessave
7)ExternalCommandPipeSetup:
ToenabletheExternalCommandPipewewillbeusingthebelow,sothattheWebinterfacesandotherIcingaaddonsareabletosendcommandstoIcinga2throughtheexternalcommandpipe.
#icinga2featureenablecommand
Enablingfeaturecommand.MakesuretorestartIcinga2forthesechangestotakeeffect.
#serviceicinga2restart
#icinga2featurelist
Disabledfeatures:
apicompatlogdebugloggelfgraphiteicinga