Professional Documents
Culture Documents
Cacti
Cacti
ThisHowTowillexplainhowtoinstallandconfiguretheNetSNMPagent.Attimeofwriting,thelatestversion availableis5.4(publishedon12/06/2006).
GettingNetSNMPbinaries
Dependingonyouroperatingsystem,you'llfindpackagesortarballstoinstallNetSNMP: Linux UsuallyeveryLinuxdistributioncomeswithNetSNMPpackages: RedHat/Fedora:installthenetsnmp,netsnmplibsandnetsnmputilspackages Debian/Ubuntu:installthelibsnmpbase,libsnmp5,snmpandsnmpdpackages SuSE:installthenetsnmppackage Gentoo:simplyemergethenetsnmpebuild Mandriva:installthelibnetsnmp5,netsnmpandnetsnmputilspackages. AIX PackageswereareavailableintheUniversityofCaliforniaRepository,butit'snolongeravailable. YoucanfindNetSNMP5.0.3forAIX5.1ontheBullAIXfreewaresite. Solaris Solaris10shipswithNetSNMP5.0.9ForolderSolarisreleases,packagesareavailableintheSunfreeware repository: release5.1.1forSolaris9Sparc release5.1.1forSolaris9Intel release5.1.1forSolaris8Sparc release5.1.1forSolaris8Intel release5.1.1forSolaris7Sparc release5.1.1forSolaris2.6Sparc release5.1.1forSolaris2.5SparcForthesepackagestowork,OpenSSLandGCClibrariesneedtobe installedalso.TarballsarealsoavailablefromtheNetSNMPmainsite: release5.2.2forSolaris9onsun4uhardware release5.2.2forSolaris8onsun4uhardware release5.2.2forSolaris7onsun4uhardwareThesetarballshavetobeextractedfrom/hastheycontain absolutepaths. Filesarecopiedto/usr/local/share/snmp,/usr/local/libs,/usr/local/include/netsnmp,/usr/local/man, /usr/local/binand/usr/local/sbin HPUX TarballsareavailablefromtheNetSNMPmainsite: release5.4forHPUX11.11PARISC release5.4forHPUX11.00PARISC release5.4forHPUX10.20PARISCThesetarballshavetobeextractedfrom/hastheycontainabsolute paths.Bewarethatthebinariesarenotstrippedinthesetarballs,thiswastealotspace. Filesarecopiedto/usr/local/share/snmp,/usr/local/libs,/usr/local/include/netsnmp,/usr/local/man, /usr/local/binand/usr/local/sbin FreeBSD NetSNMPisavailablethroughtheports
BuildingtheNetSNMPagentfromsource
Ifyoucan'tfindbinariesforyourarchitecture,youcanbuildtheNetSNMPagentfromsources. Here'showtogettheconfigureoptionsofanalreadyrunningNetSNMPagent:
ConfiguringtheNetSNMPagent
Dependingonhowyou'veinstalledNetSNMP,themainconfigurationfile(snmpd.conf)islocatedin/etc/snmp (installationfrompackage)or/usr/local/share/snmp(installationfromtarball). Pleasenotethatyouneedtorestart(orsendtheHUPsignal)thesnmpddaemonwheneveryoumodifysnmpd.conf Theminimumconfigurationisthisone:
rcmuiypbi oomntulc
BydefaultNetSNMPlistensonUDPport161onallIPv4interfaces. Withthefollowingexample,NetSNMPwilllistenonUDPport10000on10.20.30.40IPaddress:
aetdrs02.04:00 gnades1.03.0100
YoucanalsomakeitlistensonTCP,whichissupportedbyCacti
aetdrsc:6 gnadestp11
ThetcpkeywordcanthenbeusedinCacti:
Forthosewhowantsomemoresecurity,youcanusetheSNMPversion3protocol,withMD5orSHAhashing:
cetUerdrcM5mpsprsE raesrfeeiDyashaeDS gopgop3umrdrc ruruvsfeei vealicueio0 iwlnldd.s8 acsruv"nuhxcalall cesgop3"ayateatllal
Thiscreatesauserfredericwhosepasswordismypassphrase.Totestit:
#smgtlAtNPiufeeiAmpsprs05.04yNm. npev3uhorvrdrcyashae1.08.5ssae0 SMvI:ssae0=SRN:ccoe NP2MB:yNm.TIGylps
InCacti,addyourdevice,chooseSNMPversion3,andfilltheusernameandpasswordfields:
Nowthatyou'redonewithaccesscontrol,addthese2linesinsnmpd.conftoindicatethelocationandcontactnameof yourdevice:
ssoainBt2 ylctoa.C ssotcoen@oehr.r ycnatsmoesmweeog
TheywillthenappearinCactimanagementinterface:
SomeOIDsreturnaunit,eg153.1dBm. It'sasafeideatoturnthisoff,byaddingthistosnmpd.conf:
dnPitntre otrnUistu
NextstepistographfilesystemsinCactitheeasyestwayistoaddthislineinsnmpd.conf:
icuelDss nldAlik
Whenyou'llruntheucd/netGetMonitoredPartitionsDataQuery,allthemountedfilesystemswillshowup:
Ifyouwantafilesystemnottobelistedhere,addthislinetosnmpd.conf:
inrdsdvrs/020 goeik/e/dkctd
Unfortunatly,someolderversionsofNetSNMPdonotfullyworkwiththeincludeAllDiskskeyword You'llthenhavetolistexplicitlyallfilesystemsyouwanttograph:
ds ik/ dsur ik/s dsvr ik/a dsoal ik/rce
TocompileNetSNMPandbuildacompressedarchive,followthesesteps:
$.cniuewtorotos /ofgrihyupin $mk ae #mdr/s/oa/it kiurlclds #mkntlrfx/s/oa/iturlclee_rfx/s/oa/iturlcl aeisalpei=urlclds/s/oaxcpei=urlclds/s/oa #curlclds d/s/oa/it #trcf/m/enp531ds.as avtpntsm..ittrur #gitpntsm..ittr zp/m/enp531ds.a #rrurlclds mf/s/oa/it
Youcanthencopythe/tmp/netsnmp5.3.1dist.tar.gzfiletootherservers,anduncompressitfromtherootdirectory (everythingwillgetextractedto/usr/local).
Testyourconfiguration
OnceNetSNMPisconfiguredandstarted,here'showtotestit:
$smwlv1ulclclot......... npakcpbioahs136121110 SMvI:ssec.TIGiurns2422SPvnjn141:1CT2066 NP2MB:yDsr0=SRN:Lnxcoo..8#Mea41:20E05i8
ThisbasicqueryshowsthatyourNetSNMPagentisreachable. YoucanevenquerywhichNetSNMPversionisrunningonahost:
$smwlv1ulclclot.......011020 npakcpbioahs13614122.0.. UDSMI:vrina.TIG... CNPMB:esoTg0=SRN:5212
Ananswerlikethatone
$smwlv1ooahs136121110 npakcfolclot......... TmotoRsosrmlclot ieu:Nepnefooahs
indicatesthateithertheagentisnotstarted,orthatthecommunitystringisincorrect,orthatthisdeviceisunreachable. Checkyourcommunitystring,addfirewallrulesifnecessary,etc.
IfusingSNMPversion3,specifyinganunknownuserwillresultinthiserrormessage:
$smgtlAtNPiujhAmpsprs05.04yNm. npev3uhorvonyashae1.08.5ssae0 smgtnnwsrnm npe:Ukonueae
Anincorrectpassphrasewillresultinthiserrormessage:
$smgtlAtNPiufeeiAbdashae1.08.5ssae0 npev3uhorvrdrcapsprs05.04yNm. smgtuhniainfiue(norcasodomntrky npe:Atetctoalricretpswr,cmuiyoe)
Thisquerywillshowyouwhatfilesystemsaremounted:
$smwlv1ulclclot.......01912 npakcpbioahs13614122... UDSMI:dkah1=SRN:/ CNPMB:sPt.TIG UDSMI:dkah2=SRN:/B CNPMB:sPt.TIGB UDSMI:dkah3=SRN:/e/h CNPMB:sPt.TIGdvsm
ExtendingtheSNMPAgent
AgreatfunctionnalityofNetSNMPisthatyoucanextendit. Let'srunthe/tmp/foo.shscript:
$/m/o.hr1 tpfosag 13 2
Nowputthisinsnmpd.conf:
eeobnstpfosag xcfo/i/h/m/o.hr1
extOutputtranslatesto.1.3.6.1.4.1.2021.8.1.101Asfooisourfirstexecdirective,add.1attheendoftheOID. InCacti,usetheSNMPGenericOIDTemplatelikethis:
Voila!Resultofthe/tmp/foo.shscriptisnowgraphedinCacti. Nowlet'srunthissecondscript,whichreturnsmorethanoneresult:
$/m/a.h tpbrs 46 5 79 8
Itreturnstwovalues,oneperline(thisisimportant). Anotherwaytocallscriptsfromsnmpd.confisbyspecifyinganOID,likethis:
ee13614122.5bnstpbrs xc.......0155/i/h/m/a.h
Runthisquery:
$smwlv1ulclclot.......0155 npakcpbioahs13614122.5 UDSMI:udvs5511=ITGR CNPMB:cai.5..NEE:1 UDSMI:udvs5521=SRN:"bns" CNPMB:cai.5..TIG/i/h UDSMI:udvs5531=SRN:"tpbrs" CNPMB:cai.5..TIG/m/a.h UDSMI:udvs55101=ITGR CNPMB:cai.5.0.NEE:0 UDSMI:udvs55111=SRN:"5" CNPMB:cai.5.0.TIG46 UDSMI:udvs55112=SRN:"8" CNPMB:cai.5.0.TIG79 UDSMI:udvs55121=ITGR CNPMB:cai.5.0.NEE:0 UDSMI:udvs55131=" CNPMB:cai.5.0."
UDSMI:lgacCutr1=Cutr2 CNPMB:oMthone.one3:1 UDSMI:lgacCut1=ITGR CNPMB:oMthon.NEE:0 UDSMI:lgacCce1=ITGR2 CNPMB:oMthyl.NEE:10 UDSMI:lgacErrlg1=ITGR CNPMB:oMthroFa.NEE:0 UDSMI:lgacRgxoplto.TIGucs CNPMB:oMtheECmiain1=SRN:Sces
TheSquidSNMPtreewillbeavailableunderthe.1.3.6.1.4.1.3495.1branch. Let'squerythishost:
$smwlv1ulc1.5.33ssec npakcpbi0113.ydsr SMvI:ssec.TIGiur1focm26811mk#rc25:1CS04i8 NP2MB:yDsr0=SRN:Lnxsv.o.o...2d1FiOt11:34ET2066
Andhere'stheSquidpart(thisspecificOIDreturnstheSquidversion):
$smwlv1ulc1.5.33.......451230 npakcpbi0113.13614139.... SMvM:etrrss39....TIG25SAL6 NP2SI:nepie.451230=SRN:"..TBE"
Here,you'llfindhowtoenabletheSquidSNMPagent. 1_installation.1_install_unix.5_install_and_configure_cacti
1_installation.1_install_unix.3_configure_mysql
manual
623617!
fair.lastresort.co.jp