Nagios ReadMe

Embed Size (px)

Citation preview

  • 7/31/2019 Nagios ReadMe

    1/9

    HowtointegrateNagiosandCCMStomonitorSAPsystemlandscapes

    StefanSchindewolf

    Copyright2004byStefanSchindewolf

    2004-07-28ver1.0

    Abstract

    SAPAGsComputingCenterMonitoringSystemisaunifiedplatformformonitoringandadministratingallsystemsinaSAPSystemLandscape.NearlyeverythingcanbecheckedbyCCMS,fromthelowesthardwareleveloveroperatingsystemdataanddatabasesuptowholebusinessprocessesinanERPsystem.

    Nagiosisanopensourcetoolforsystemmonitoringandoffersalsoawiderangeoftoolstocheckandmanageasystemlandscape.Itdisplaysitsdatainanicebrowserinterfaceandiscabableofautomaticreactiontofailures,es-calationroutesandnotifyingadminsviamail,smsorpager.

    ThisdocumentaimstoexplainhowtoconfigureNagiossothatitcollectsdatafromSAPsystems.StrongNagiosknowhowisrecommended.

    ...............................................................................

    TableofContents1.Administrata1.1.AuthorshipandCopyright1.2.Acknowldedgements1.3.CommentsandCorrections1.4.LatestVersionsandTranslations

    2.HowNagiosworks

    2.1.TheArchitecture2.2.ThePlugins

    3.HowCCMSworks3.1.TheArchitecture3.2.ImportantTechnicalTerms3.3.HowCCMSDatacanberetrievedbyNagios

    4.HowtoconfigureNagios4.1.InstallingthePlugins4.1.1.RPMinstallation4.1.2.Sourcetarballinstallation4.1.3.Furthersteps

    4.2.FeaturesandChoosingConfiguration4.3.PreparationsinyourSAPSystem4.4.TheFilesin/etc/sapmon4.4.1.Theagent.cfg4.4.2.Thelogin.cfg4.4.3.Themoni_tr.cfg4.5.NagiosConfiguration4.5.1.Nagios`hosts.cfg4.5.2.Nagios`commands.cfg4.5.3.Nagios`services.cfg

  • 7/31/2019 Nagios ReadMe

    2/9

    4.6.Testing

    5.Errata5.1.Resources

    ...............................................................................

    1.Administrata

    1.1.AuthorshipandCopyright

    Thisdocumentiscopyright(c)2004StefanSchindewolf,Permissionisgrantedtocopy,distributeand/ormodifythisdocumentunderthetermsoftheOpenSoftwareLicens(OSL),version1.1,exceptfortheprovisionsIlistinthenextparagraph.TheOSLlicensetermscanbefoundathttp://opensource.org/licences/osl-1.1.txt.

    IfyouwanttocreateaderivativeworkorpublishthisHOWTOforcommercialpurposes,Ireallywouldappreciateitifyoucontactmefirst.Youwillthenbegiventhemostrecentversionofthisdocument.Additionallyitwouldbeveryniceifyouwouldprovidemewithacopyofyourwork,sothatthebenefitisalsoonmysideofthetable.Ifsomeonerecognizesfactualerrors,pleasedo

    nothesitatetoprovidemewithacorrectedversionofthisdocument.-------------------------------------------------------------------------------

    1.2.AcknowledgementsThankstotheSAPLinuxLabforalltheirgreatworktheydoandallthesupporttheygiveeventotheslightestofproblems.OntheirbehalfItookoverthemaintenanceofthisproject.Ifanyonewantstojoinandhelpme-Iwouldmorethanappreciateit!-------------------------------------------------------------------------------

    1.3.CommentsandCorrectionsTherearenoCommentsorCorrectionsinversion1.0atthistime.-------------------------------------------------------------------------------

    1.4.LatestVersionsandTranslationsYouarenowreadingthelatestversion.Notranslationsintowhatsoeverlanguageareplanned.-------------------------------------------------------------------------------

    2.HowNagiosworks

    2.1.TheArchitecture

    Nagiosisaplugin-basedsystemmonitoringsolution.Thepluginscanbe

    writteninanylanguage.WhatNagiositselfdoesisstartingtheplugininashellandreadingtheoutputofthecommandandthereturncode.Thereforethepluginshouldalwaysreturnanexitcodeandsometext.ThistextwilllaterbedisplayedintheField"StatusInformation"inNagioswhiletheexitcodeisthebasisforthe"Status"fieldofNagios(Unknown,Warning,Critical,OK)NagiosisfreesoftwarebytermsoftheGPLandcanbeobtainedviahttp://www.nagios.org-------------------------------------------------------------------------------

  • 7/31/2019 Nagios ReadMe

    3/9

    2.2.ThePlugins

    Nagios'pluginsprovidetheactualdatagatheringfortheNagioscore.Theyconnecttohostsanddatabases,collectvariousdataofsystemresourcesanddeliverthedatabacktoNagios.Thepluginsfornagioscanbeobtainedviahttp://nagiosplug.sourceforge.net-------------------------------------------------------------------------------

    3.HowCCMSworks3.1.TheArchitecture

    WithSAPBasisRelease4.0theCCMSMonitoringArchitecturewasintroduced.Itisasystemtonoticeproblems(calledalerts)inatreestructure,assig-ningdifferentwarninglevelstothem(green,yellow,red).CCMSconsistsofseverallayersanddifferentelementsmakingitveryflexibleandcapable.ThebasisofCCMSaretheDataSuppliers.Theyprovidemonitoringdataforex-ternalmonitoringsystems,thesocalledDataConsumer.SAPAlertmonitorissuchaDataConsumers.Itprovidesthenecessaryinfra-structuretocontrolmonitoringobjectsandtheirthresholdsandinitiatingalertstoadministrators.

    FormoreinformationonCCMSpleaseseehttp://service.sap.com/monitoring-------------------------------------------------------------------------------

    3.2.ImportantTechnicalTerms

    Alert-ProblemnotificationwithintheCCMSAlertmonitor.Thevaluesofadatasupplierarecomparedtothegiventhreholds.TheAdministratorsattentionisthenguidedtotheproblemsbydifferentcolors.

    Monitor-CollectionofMTE(MonitorTreeElements),assembledinahierarchy

    MTE-MonitorTreeElementsareknotsinthemonitortree.Therearethree

    differentkinds:monitorattributes,monitorobjectsandmonitorcol-lections.

    Monitorobjects-Representobjectswhichyoucanmonitor.Theycanbedatabasetable-spaces,harddisksorSAPSystemcomponents.

    Monitorattributes-Thesearethebasicelementsinthemonitortree.Theydescribethestatusofthemonitorobjects.Fourdifferentkindsexist:Performanceattr.,Statusattr.,Protocolattr.andTextattr.ExceptforTextattr.allattributescanraisealerts(andarethereforevaluabletoNagios).

    -------------------------------------------------------------------------------

    3.3.HowCCMSDatacanberetrievedbyNagios-------------------------------------------------------------------------------

    4.HowtoconfigureNagios

  • 7/31/2019 Nagios ReadMe

    4/9

    4.1.InstallingtheCCMSPlugins

    TheeasiestwayofinstallationatthemomentshouldbetheRPMway.PleasedownloadtheRPMsfromoneofthevariousFTPServersoftheSuSEcompany.IwillprovideSourceRPMsandselfcompiledRMPsasap.Additionallytherewillbeatarballsoon.-------------------------------------------------------------------------------

    4.1.1.RPMinstallation

    PleaserefertothemostrecentversionofSuSELinuxProfessionalandtakethepackagesfromitsFTPserver.YoushouldalwaysinstallthewholeNagiossuitefromRPM.BetterdonotcompileNagiosyourselfandthentrytoinstalltheRPMsbecausethesourcecodeversionofNagioslackscertainfeatureswewillneedfortheCCMSPlugins.

    Example:-Gotoftp.gwdg.deandenterthedirectory/pub/suse/i386/9.1/suse/i586-Downloadallpackagesbymgettingnagios*-InstalltheRPMsonyourLinuxbox

    YounowonlywouldhavetoedittheconfigurationfilesandstartNagios.-------------------------------------------------------------------------------

    4.1.2.RPMinstallation

    ThissectionwillfollowwhenIfinishedthesourcetarballs.-------------------------------------------------------------------------------

    4.1.3.Furthersteps

    PleaseconfigurenowyournagiossystemforallthemonitoringyouwanttodoexcepttheSAPpart.IwillnotcoverthewholeconfigurationprocedureofNagiosinthisdocument.Thisisverywellanddetaileddocumentedon

    http://www.nagios.org/docs/-------------------------------------------------------------------------------

    4.2.FeaturesandChoosingConfiguration

    -Starting/StoppingofSAPSystems-StartSAPGUIandconnecttoSAPSystem-OpenSecureShelltoSAPHostGiventhatyouconfiguredyourNagios"alias"valuesaccordingtoSAPstandardyouwillbeabletostart/stopyourSAPSystembyclickingonthehostnameinNagiosandchoosingtheoptioninthenextwindow.ThesamecountsforSSHandSAPGUIconnection.

    -ChangethresholdsofCCMSMonitorsClickingontheNagioscommandresultontherightoftheNagiosstatusscreenyouwillbeabletochangethethresholdsofthequeriedmonitors.

    -CommandList:ThesecommandsprovideHTML/CGIoutputfornagios,enablingthefeaturesabovementioned.NotethatforfullfeatureuseyouwillhavetoinstalltheSuSEnagiosversionwhichprovidesthecorrectinterfaceforallfeatures

  • 7/31/2019 Nagios ReadMe

    5/9

    check_sap Showsasinglevaluefromthegivenmonitortemplatecheck_sap_multiple Showsasetofvaluesatatimecheck_sap_instance ProvidesSAPstandarddataforanappserver-CCMS

    PinghastobeinstalledontheHostcheck_sap_system Checksawholesystemlandscapeincludingapplication

    serversandtheirdata

    Thecommandsprovidethesamedataastheaboveones,buttheiroutputisplaintext,makingthemcompatiblewitheverynagiosversion.

    check_sap_conscheck_sap_system_conscheck_sap_instance_conscheck_sap_mult_no_thr Consoleversionofcheck_sap_multiple-------------------------------------------------------------------------------

    4.3.PreparationsinyourSAPSystems

    Given,youhavechosenascenarioforNagios(seesection3.3fordeatils)youcancontinuewiththeconfigurationoftheSolutionManageroryourSAPSystems.IneachSAPInstanceyouwanttomonitorwithNagiosyouwillhavetocreateaRFCuserwithminimumcredentials.Or,asalreadymentioned,youcreatethe

    useronceintheSolutionManager.Mostlyyouwillonlywanttocheckyourproductivesystemsandleavetherestunattendedsothatprocedureshouldbeofminimumimpact.IwilldescribetheprocedureforanR34.6Csystem,itmightdifferforotherSAPproducts.

    FirstcreatetheusercredentialsinyourSAPsystem.Pleasecheckwithyouruseradministrationforaminimumsetofcredentialsandanexplicitrole.

    Forexample:-LogontoyourSAPSystem-Gototransaction"PFCG"-Choose"0000:B:NAG"asrolenameand"CredentialsforNagiosuser"asdes-

    cription-SelectCreatefromtheButtonsbelow-Selectthecredentialsforyourrole.AsIdidthispointnotmyself,Istronglyrecommendyoutoletanexperiencedroleadmnistratordothis.-Applythesettings,generatetheroleandexit

    Nextstepistocreatetheuserandassigntheroletohim.

    Example:-LogontoyourSAPSystem-Gototransaction"SU01"-Choose"nagios"astheuserid-SelectCreatefromthebuttonsabove

    -Maintainminimumpersonaldataforthisuser-Selectthetab"LogonData"-Choose"Usergroupforauthorizationcheck"->SUPPORT-Choose"Usertype"->SERVICE-Choose"InitialPassword"->"monitor"-Selecttab"roles"-Choose"0000:B:NAG"-Selecttab"Profiles"-Choose"0000:B:NAG"-Saveyourdataandexit

  • 7/31/2019 Nagios ReadMe

    6/9

    YouhavenowcreatedyourRFCuserfornagios.AftereditingtheconfigfilesfortheCCMSPluginsyoushouldbeabletoretrievedatafromyoursystem.------------------------------------------------------------------------------

    4.4.TheFilesin/etc/sapmon

    Inastandardinstallationalltheconfigurationdataofthepluginsisstoredin/etc/sapmon.Adetaileddescriptionofeachfilefollows.------------------------------------------------------------------------------

    4.4.1.Theagent.cfg

    ThisfileprovidesinformationabouttheCCMSAgentsyouwanttoquerywithNagios.TheseAgentsarerepresentedinthisfileasTEMPLATES.Therearetwokindoftemplates,simpleonesandextendedones.------------------------------------------------------------------------------

    4.4.1.1.Commandstructureandnamesofthetemplates

    Asdescribedindetailinsection4.4.2.thecommandstructureoftheNagiospluginsisasfollows.

    4.4.1.2.SimpleTemplates

    SimpleTemplates:[TEMPLATE_]ChooseanameforthetemplateDESCRIPTION=ArbitrarydescriptionfieldSYSTEM=WildcardsmaybeusedAPPL-SERVER=WildcardsmaybeusedVALUE=Whatdoyouwanttomonitor?

    Exampleforasimpletemplate:[TEMPLATE_MYFIRSTTEMPLATE]SYSTEM=P03

    APPL-SERVER=*VALUE=DIALOG_RESPONSE_TIME

    ThistemplatewillshowthedialogresponsetimeofallapplicationserversofthesystemP03.Note:TheVALUEparameterisastringwhichhastobetakencharacterforcharacterfromthemonitornamesintransactionRZ20inyourSAPsystem.Important:ThenameofthetemplateinTEMPLATE_mustbeinuppercase!!-------------------------------------------------------------------------------

    4.4.1.3.ExtendedTemplates

    ExtendedTemplatesprovidemuchmoreinformationastheycanbeusedtoquery

    wholeCCMSmonitorsets.Wildcardsarealsoallowed.

    Thetemplatesarestructuredasfollows:

    [TEMPLATE_]DESCRIPTION= ArbitrarydescriptionfieldMONI_SET_NAME= MonitorcollectioninRZ20MONI_NAME= NameofthespecificmonitorMAX_TREE_DEPTH= MonitorloadingdepthPATTERN_0=\\\

  • 7/31/2019 Nagios ReadMe

    7/9

    MONI_SET_NAMEistthenameofthemonitorcollectionintheentryscreenoftransactionRZ20,e.g."SAPAdminWorkplace"oranyselfconfiguredmonitorset.MONI_NAMEisthenameofthemonitorwithinthegivenmonitorset,forexample"OperatingSystem".MAX_TREE_DEPTHcontrolshowmuchlevelsofthemonitorareloaded.InRZ20youcanexpandthemonitortreetoseethemonitorobjectsandattributes.Eachexpandinglevelisastepinthemonitortree.Thedefaultvalueis0,loadingthewholemonitor.PATTERN_0isapatternwhichyoucouldusetoselectthedataprovidedtoNagiosmoregranular.Examples:

    PATTERN_0="P03\sapserv01_P03_00\CPU\5minLoadAverage"selectsthemonitorattribut"5minLoadAverage"fromthemonitorobject"CPU".Theserver(context)willbe"sapserv01_P03_00".

    PATTERN_0="P03\*\CPU\5minLoadAverage"willselectthesamedataasabovebutforallserversofthesystemlandscapeofsystemP03.

    PATTERN_0="*\*\/oracle\Percentage_Used"willselectthe"Percentage_Used"valueofthefilesystem"/oracle"inthesystemtowardsthecommandisrun.

    Important:ThenameofthetemplateinTEMPLATE_mustbeinuppercase!!-------------------------------------------------------------------------------

    4.4.2.Thelogin.cfg

    ThisfileprovidesthelogoninformationforeachSAPSystemyouwanttocheckwithNagios.Pleasecutitscredentialsforothersandthegroupsothatnoonecanspyoutyourlogondata.Again->thisfileisapotentialsecurityrisktoyoursystemlandscape!Makeitsafeanddonotassignanyadministra-tiverolesorprofilestoyournagiosRFCuser!

    Theentriesinthisfilefollowthisscheme:

    [LOGIN_]LOGIN=-d-u-p-c-h-s\

    Forinstance:[LOGIN_sapser01]LOGIN=-dP03-unagios-pmonitor-c030-hsapser01-s02

    Thiswilllogontheuser"nagios"withthepassword"monitor"intotheSAPSystem"P03"onhost"sapser01".Clientwillbe"030",systemnumber"02".-------------------------------------------------------------------------------

    4.4.3.Themoni_tr.cfg

    NothingtoedithereforNagiosAdmins.-------------------------------------------------------------------------------

    4.5.NagiosConfiguration

    DependingonwhichfeaturesoftheCCMSpluginsyouwouldliketouseseveralchangestoyourNagiosinstallationandconfigurationhavetobemade.

  • 7/31/2019 Nagios ReadMe

    8/9

    Notethattheoutputofyourcommandsshouldnotexceed80charactersasthisisthemaximumNagioswillaccept.ThisisespeciallyimportantifyouusethecommandsprovidingHTMLoutput.-------------------------------------------------------------------------------

    4.5.1.Nagios`hosts.cfg

    DefineyourSAPHostlikeanyotherhostinyournagioslandscape.Afterthatedittheparameter"alias"like"__.Example:

    definehost{host_name sapserv01alias sapserv01_P03_00address 10.17.72.234....

    }-------------------------------------------------------------------------------

    4.5.2.Nagios`commands.cfg

    TheCCMScommandshavetobedefinedasfollows:

    definecommand{command_name check_sapcommand_line $USER1$/check_sap$ARG1$$ARG2$

    }

    Repeatthesedefinitionforeachcommandyouwouldliketouse.Seesection4.2."FeaturesandChoosingConfiguration"forallcommandsyoucanconfigure.-------------------------------------------------------------------------------

    4.5.3.Nagios`services.cfg

    AserviceforCCMSisdefinedlikeanyotherserviceforNagios.Themostim-portantlineisthecheck_commandwhereyoudefinetheparametersforyourcheckcommands.

    defineservice{use genericservicehost_name sapserv01....check_command check_sap!!...

    }-------------------------------------------------------------------------------

    4.6.TestingandTroubleshooting

    Usetheconsolecommandoutput(e.g.check_sap_cons)totestyourconfigu-ration.Inyourworkingdirectoryafilenamed"def_rfc.trc"willbegeneratedindicatingproblemswithyoulogondata.Ifyourcommanddoesnotreturnanydata,perhapsyoudidnotconfigureyouragent.cfgcorrectly.Lookoutformisspelling,especiallyupper/lowercasemiswritings.

  • 7/31/2019 Nagios ReadMe

    9/9

    Testingextendedtemplates:Startconfiguringyourextendedtemplatelikethis:[TEMPLATE_01]DESCRIPTION=LoadaverageMONI_SET_NAME=SAPCCMSAdminWorkplaceMONI_NAME=OperatingsystemMAX_TREE_DEPTH=0PATTERN_0="*"

    Thencheckitwith./check_sap_cons01.GivenyouhavespelledMONI_SET_NAMEandMONI_NAMEcorrectlyyoushouldreceivealistfromyourSAPsystemwithallmonitorcontextsyoucanquery.Onceyouhavethelist,editPATTERN_0torefineyoulist.Repeatthisuntilyouhaveconfiguredyourtemplatecorrectly.-------------------------------------------------------------------------------

    5.Errata

    FeelfreetousethisdocumentasabasisforyourNagiosandCCMSconfi-guration,butonlyatyourownrisk!Igivenoguaranteethateverythingworksfineorthatyoursystemlandscapeissafefromdamage.AlsoIcannottakeresponsibilityfortheresultstheuseofthisdocument

    leadsto.IfyouareuncertainofsomepointspleasewritetomedirectlyortothemailinglistforgeneralSAP/Linuxissues:

    [email protected]@listserv-sap.com-------------------------------------------------------------------------------