Nagios is great, but sometimes it lacks certain features. Here's an excellent addon that allows you to quickly extract data and enhance capabilities (multisites, cluster...).
In this article, we'll explore some of these possibilities with Check MK (also known as MK Live Status).
./setup.sh
_____________
/___||________||__|\/||//
|||'_ \ / _ \/ __| |/ / | |\/| | '/
||___||||__/(__|<||||.\\____|_||_|\___|\___|_|\_\___|_||_|_|\_\|_____|Check_MKsetupVersion:1.1.12p7
WelcometoCheck_MK.ThissetupwillinstallCheck_MKintouserdefined
directories.Ifyourunthisscriptasroot,installationpathsbelow
/usrwillbesuggested.Ifyourunthisscriptasnon-rootuserpaths
inyourhomedirectorywillbesuggested.Youmayoverridethedefault
valuesorjusthitentertoacceptthem.
Youranswerswillbesavedto/root/.check_mk_setup.confandwillbe
reusedwhenyourunthesetupofthisoralaterversionagain.Please
deletethatfileifyouwanttodeleteyourpreviousanswers.
*FoundrunningNagiosprocess,autodetected17settings.
1)Installationdirectoriesofcheck_mk
Executableprograms
Directorywheretoinstallexecutableprogramssuchascheck_mkitself.
Thisdirectoryshouldbeinyoursearchpath($PATH).Otherwiseyou
alwayshavetospecifytheinstallationpathwhencallingcheck_mk:
(default-->/usr/bin):
Check_MKconfiguration
Directorywherecheck_mklooksforitsmainconfigurationfilemain.mk.
Anexampleconfigurationfilewillbeinstalledthereifnomain.mkis
presentfromapreviousversion.:
(default-->/etc/check_mk):
check_mkchecks
check_mk's different checks are implemented as small Python scriptletsthat parse and interpret the various output sections of the agents. Whereshall those be installed:( default --> /usr/share/check_mk/checks):check_mk modulesDirectory for main componentents of check_mk itself. The setup willalso create a file 'defaults' in that directory that reflects all settingsyou are doing right now:( default --> /usr/share/check_mk/modules):Check_MK Multisite GUIDirectory where Check_mk'sMultisiteGUIshouldbeinstalled.Multisiteis
anoptionalreplacementfortheNagiosGUI,butisalsoneededforthe
logwatchextension.Thatdirectoryshouldnotbe
inyourWWWdocumentroot.Aseparateapacheconfigurationfilewillbe
installedthatmapsthedirectoryintoyourURLschema:
(default-->/usr/share/check_mk/web):
Localizationdir
Basedirectoryforgettextlocalizationfiles.Multisitecomespreparedforlocalzation
butdoesnotshipanylanguageperdefault.:
(default-->/usr/share/check_mk/locale):
documentation
Somedocumentationaboutcheck_mkwillbeinstalledhere.Pleasenote,
however,thatmostofcheck_mk's documentation is available only online athttp://mathias-kettner.de/check_mk.html:( default --> /usr/share/doc/check_mk):check manualsDirectory for manuals for the various checks. The manuals can be viewedwith check_mk -M <CHECKNAME>:( default --> /usr/share/doc/check_mk/checks):working directory of check_mkcheck_mk will create caches files, automatically created checks andother files into this directory. The setup will create several subdirectoriesand makes them writable by the Nagios process:( default --> /var/lib/check_mk):agents for operating systemsAgents for various operating systems will be installed here for yourconveniance. Take them and install them onto your target hosts:( default --> /usr/share/check_mk/agents): 2) Configuration of Linux/UNIX Agentsextensions for agentsThis directory will not be created on the server. It will be hardcodedinto the Linux and UNIX agents. The agent will look for extensions in thesubdirectories plugins/ and local/ of that directory:( default --> /usr/lib/check_mk_agent):configuration dir for agentsThis directory will not be created on the server. It will be hardcodedinto the Linux and UNIX agents. The agent will look for its configurationfiles here (currently only the logwatch extension needs a configuration file):( default --> /etc/check_mk): 3) Integration with NagiosName of Nagios userThe working directory for check_mk contains several subdirectoriesthat need to be writable by the Nagios user (which is running check_mkin check mode). Please specify the user that should own thosedirectories:( autodetected --> nagios):User of Apache processCheck_MK WATO (Web Administration Tool) needs a sudo configuration,such that Apache can run certain commands as root. If you specifythe correct user of the apache process here, then we can create a validsudo configuration for you later::( autodetected --> www-data):Common group of Nagios+ApacheCheck_mk creates files and directories while running as nagios.Some of those need to be writable by the user that is running the webserver.Therefore a group is needed in which both Nagios and the webserver aremembers (every valid Nagios installation uses such a group to allowthe web server access to Nagios'commandpipe)::
(default-->nagios):
Nagiosbinary
ThecompletepathtotheNagiosexecutable.Thisisneededbythe
option-R/--restartinordertodoaconfigurationcheck.:
(autodetected-->/usr/sbin/nagios3):
Nagiosmainconfigurationfile
PathtothemainconfigurationfileofNagios.Thatfileisalways
named'nagios.cfg'.ThedefaultpathwhencompilingNagiosyourself
is/usr/local/nagios/etc/nagios.cfg.Thepathtothisfileisneeded
forthecheck_mkoption-R/--restart:
(autodetected-->/etc/nagios3/nagios.cfg):
Nagiosobjectdirectory
Nagios' object definitions for hosts, services and contacts areusually stored in various files with the extension .cfg. These filesare located in a directory that is configured in nagios.cfg with thedirective 'cfg_dir'. Please specify the path to that directory(If the autodetection can find your configurationfile but does not find at least one cfg_dir directive, then it willadd one to your configuration file for your conveniance):( autodetected --> /etc/nagios3/conf.d):Nagios startskriptThe complete path to the Nagios startskript is used by the option-R/--restart to restart Nagios.:( autodetected --> /etc/init.d/nagios3):Nagios command pipeComplete path to the Nagios command pipe. check_mk needs write accessto this pipe in order to operate:( default --> /var/log/nagios/rw/nagios.cmd):Check results directoryComplete path to the directory where Nagios stores its check results.Using that directory instead of the command pipe is faster.:( autodetected --> /var/lib/nagios3/spool/checkresults):Nagios status fileThe web pages of check_mk need to read the file 'status.dat', which isregularily created by Nagios. The path to that status file is usuallyconfigured in nagios.cfg with the parameter 'status_file'. Ifthat parameter is missing, a compiled-in default value is used. OnFHS-conforming installations, that file usually is in /var/lib/nagiosor /var/log/nagios. If you'vecompiledNagiosyourself,thatfile
mightbefoundbelow/usr/local/nagios:
(autodetected-->/var/cache/nagios3/status.dat):
Pathtocheck_icmp
check_mkshipsaNagiosconfigurationfilewithseveralhostand
servicetemplates.Somehosttemplatesneedcheck_icmpashostcheck.
ThatcheckpluginiscontainedinthestandardNagiosplugins.
Pleasespecifythecompletepath(dir+filename)ofcheck_icmp:
(autodetected-->/usr/lib/nagios/plugins/check_icmp):
4)IntegrationwithApache
URLPrefixforWebaddons
UsuallytheMultisiteGUIisavailableat/check_mk/andPNP4Nagios
islocatedat/pnp4nagios/.Insomecasesyoumightwanttodefinesome
prefixinordertobeabletorunmoreinstancesofNagiosononehost.
Ifyousay/test/here,forexample,thenMultisitewillbelocated
at/test/check_mk/.Pleasedonotforgetthetrailingslash.:
(default-->/):/check_mk
Apacheconfigdir
Check_mkshipsseveralwebpagesimplementedinPythonwithApache
mod_python.Thatmoduleneedsanapacheconfigurationsectionwhich
willbeinstalledbythissetup.Pleasespecifythepathtoadirectory
whereApachereadsinconfigurationfiles.:
(autodetected-->/etc/apache2/conf.d):
HTTPauthenticationfile
Check_mk's web pages should be secured from unauthorized access viaHTTP authenticaion - just as Nagios. The configuration file for Apachethat will be installed contains a valid configuration for HTTP basicauth. The most conveniant way for you is to use the same user file asfor Nagios. Please enter your htpasswd file to use here:( default --> /etc/nagios/htpasswd.users):HTTP AuthNameCheck_mk'sApacheconfigurationfilewillneedanAuthName.That
stringwillbedisplayedtotheuserwhenaskingforthepassword.
YoushouldusethesameAuthNameasforNagios.Otherwisetheuserwill
havetologintwice:
(autodetected-->NagiosAccess):
5)IntegrationwithPNP4Nagios0.6
PNP4Nagiostemplates
Check_MKshipstemplatesforPNP4Nagiosformostofitschecks.
Thosetemplatesmakethehistorygraphslooknice.PNP4Nagios
expectssuchtemplatesinthedirectorypnp/templatesinyour
documentrootforstaticwebpages:
(autodetected-->/usr/share/pnp4nagios/html/templates):
RRAconfigforPNP4Nagios
Check_MKshipsRRAconfigurationfilesforitschecksthat
canbeusedbyPNPwhencreatingtheRRDs.Perdefault,PNP
createsRRDsuchthatforeachvariabletheminimum,maximum
andaveragevalueisstored.Mostchecksneedonlyoneortwo
oftheseaggregations.IfyouinstalltheCheck_MK's RRA configfiles into the configuration directory of PNP, PNP will createRRDs with the minimum of required aggregation and thus savesubstantial amount of disk I/O (and space) for RRDs. The defaultis to install the configuration into a separate directory butdoes not enable them:( default --> /usr/share/check_mk/pnp-rraconf): 6) Check_MK Livestatus Modulecompile livestatus moduleThis version of Check_mk ships a completely new and experimentalNagios event broker module that provides direct access to Nagiosinternal data structures. This module is called the Check_MK LivestatusModule. It aims to supersede status.dat and also NDO. Currenty itis completely experimental and might even crash your Nagios process.Nevertheless - The Livestatus Module does not only allow extremelyfast access to the status of your services and hosts, it does alsoprovide live data (which status.dat does not). Also - unlike NDO -Livestatus does not cost you even measurable CPU performance, doesnot need any disk space and also needs no configuration.Please answer 'yes', if you want to compile and integrate theLivestatus module into your Nagios. You need 'make' and the GNUC++ compiler installed in order to do this:( default --> yes):check_mk'sbinarymodules
Directoryforarchitecturedependentbinarylibrariesandplugins
ofcheck_mk:
(default-->/usr/lib/check_mk):
UnixsocketforLivestatus
TheLivestatusModuleprovidesNagiosstatusdataviaaunix
socket.ThisissimilartotheNagioscommandpipe,butallows
bidirectionalcommunication.Pleaseenterthepathtothatpipe.
ItisrecommendedtoputitintothesamedirectoryasNagios'command pipe:( default --> /var/log/nagios/rw/live):Backends for other systemsDirectory where to put backends and configuration examples forother systems. Currently this is only Nagvis, but other might followlater.:( default --> /usr/share/check_mk/livestatus):----------------------------------------------------------------------You have chosen the following directories: Executable programs /usr/bin Check_MK configuration /etc/check_mk check_mk checks /usr/share/check_mk/checks check_mk modules /usr/share/check_mk/modules Check_MK Multisite GUI /usr/share/check_mk/web Localization dir /usr/share/check_mk/locale documentation /usr/share/doc/check_mk check manuals /usr/share/doc/check_mk/checks working directory of check_mk /var/lib/check_mk agents for operating systems /usr/share/check_mk/agents extensions for agents /usr/lib/check_mk_agent configuration dir for agents /etc/check_mk Name of Nagios user nagios User of Apache process www-data Common group of Nagios+Apache nagios Nagios binary /usr/sbin/nagios3 Nagios main configuration file /etc/nagios3/nagios.cfg Nagios object directory /etc/nagios3/conf.d Nagios startskript /etc/init.d/nagios3 Nagios command pipe /var/log/nagios/rw/nagios.cmd Check results directory /var/lib/nagios3/spool/checkresults Nagios status file /var/cache/nagios3/status.dat Path to check_icmp /usr/lib/nagios/plugins/check_icmp URL Prefix for Web addons /check_mk Apache config dir /etc/apache2/conf.d HTTP authentication file /etc/nagios/htpasswd.users HTTP AuthName Nagios Access PNP4Nagios templates /usr/share/pnp4nagios/html/templates RRA config for PNP4Nagios /usr/share/check_mk/pnp-rraconf compile livestatus module yes check_mk'sbinarymodules/usr/lib/check_mk
UnixsocketforLivestatus/var/log/nagios/rw/live
Backendsforothersystems/usr/share/check_mk/livestatus
Proceedwithinstallation(y/n)?y
(CompilingMKLivestatus.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................)Installationcompletedsuccessfully.
PleaserestartNagiosandApacheinordertoupdate/activecheck_mk'swebpages.
YoucanaccessthenewMultisiteGUIathttp://localhost/check_mkcheck_mk/
servicelivestatus
{type=UNLISTED
port=6557socket_type=stream
protocol=tcp
wait=no
cps=1003instances=500per_source=250flags=NODELAY
user=nagios
server=/usr/bin/unixcat
server_args=/var/lib/nagios3/rw/live
only_from=127.0.0.1# modify this to only allow specific hosts to connect, currenly localhost onlydisable=no
}