ºìÁªLinuxÃÅ»§
Linux°ïÖú

Linux·þÎñÆ÷¼ÜÉ裺ÎÒµÄCACTI£­£­FAQ

·¢²¼Ê±¼ä:2006-06-16 07:32:29À´Ô´:ºìÁª×÷Õß:Myiozzdoc
Ò»¡¢È«¾Ö£º

1¡¢Ê²Ã´ÊÇCACTI£¿ËüÓÐʲôÓã¿

2¡¢cactiµÄ¹Ù·½ÍøÕ¾ÔÚÄÄÀ

3¡¢ÔÚÄÄÀïÏÂÔØ£¿

4¡¢Ôõô°²×°ËüÄØ?

5¡¢Ê¹ÓÃcactiÐèҪʲô֪ʶ£¿

6¡¢ÕÒ²»µ½snmpwalkºÍsnmpgetÃüÁ


¶þ¡¢Ê¹Óãº

1¡¢ÎªÊ²Ã´Í¼Ïñ²»ÄÜÏÔʾ£¿

2¡¢ÎªÊ²Ã´rraĿ¼ÏÂʲô¶¼Ã»ÓУ¿

3¡¢ÎªÊ²Ã´ÄÜÈ¡µ½Á÷Á¿µÄÊý¾Ýµ«È¡²»µ½CPUºÍÄÚ´æµÄÊý¾Ý£¿

4¡¢¿ÉÒÔÈ¡µ½±¾»ú£¨linux£©µÄÊý¾Ý£¬µ«È´²»ÄÜÈ¡µ½Ô¶³ÌÖ÷»úµÄÊý¾Ý£¿

5¡¢ÎÒÒÔÇ°ÓÃMRTG½øÐÐÁ÷Á¿µÄ¼à²â£¬ÊÇ·ñ¿ÉÒÔ½«MRTGÖеÄÊý¾Ýµ¼Èëµ½CactiÖÐÄØ£¿

6¡¢ÎªÊ²Ã´ÎÒµÄÁ÷Á¿´ïµ½100MÒÔÉÏͼÏñ¾Í²»×¼ÄØ£¿

7¡¢09/02/2005 02:59:58 PM - POLLER: Poller[0] Maximum runtime of 296 seconds exceeded. Exiting£¬Ê²Ã´Òâ˼£¿

8¡¢Ôõô±¸·ÝCactiºÍËüµÄÊý¾Ýѽ£¿

9¡¢ÈçºÎ½«Êý¾ÝºÏ²¢£¿ÈçºÎ×Ô¶¨Òå½Å±¾£¿

10¡¢Ê¹ÓÃmonitor¡¢threshld²å¼þ

11¡¢ÎªÊ²Ã´Ô¡¢ÄêµÄÁ÷Á¿Í¼ÏÂÃæµÄ×ÖĸÂÒÂ룿

12¡¢cactiÊÇ·ñÖ§³ÖÖÐÎÄ£¿

13¡¢Ð½¨µÄdeviceµÄData QueryÀïÃæµÄ״̬×ÜÊÇ¡° Success [0 Items, 0 Rows]¡±£¿




Ò»¡¢È«¾Ö£º


1¡¢Ê²Ã´ÊÇCACTI£¿ËüÓÐʲôÓã¿

cactiÊÇÒ»Ì×PHP³ÌÐò£¬ËüÔËÓÃsnmpget²É¼¯Êý¾Ý£¬Ê¹ÓÃrrdtool»æͼ¡£Ê¹ÓÃCactiÄÜͳ¼ÆÍøÂçÉ豸µÄ


Á÷Á¿¡¢CPU¡¢ÏµÍ³¸ºÔصȲÎÊý£¬Ò²¿ÉÒÔ×Ô¶¨Òå¼à²âµÄÖ¸±ê¡£


2¡¢cactiµÄ¹Ù·½ÍøÕ¾ÔÚÄÄÀ

http://www.cacti.net


3¡¢ÔÚÄÄÀïÏÂÔØ£¿

http://www.cacti.net/download_cacti.php


4¡¢Ôõô°²×°ËüÄØ?

¹Ù·½µÄ°²×°Îĵµ£ºhttp://www.cacti.net/documentation.php

ÎÒдµÄ°²×°Îĵµ£ºhttp://bbs.chinaunix.net/viewthread.php?tid=594019


5¡¢Ê¹ÓÃcactiÐèҪʲô֪ʶ£¿

ÐèÒª¾ßÓÐÒ»¶¨µÄʹÓÃnet-snmpºÍrrdtoolµÄ֪ʶ¡£

Èç¹ûÒª×Ô¶¨Òå¼à²âµÄÖ¸±ê»¹ÐèÒªÒ»¶¨µÄshell½Å±¾»òxmlÓïÑÔÄÜÁ¦¡£Èç¹ûÄãÏë°ïÖúcactiµÄ¿ª·¢£¬Ôò


ÐèҪͨÏþphp½Å±¾¡£


6¡¢ÕÒ²»µ½snmpwalkºÍsnmpgetÃüÁ

Ç밲װеÄnet-snmp°ü»ò´ònet-snmp-utils °ü¡£


¶þ¡¢Ê¹Óãº


1¡¢ÎªÊ²Ã´Í¼Ïñ²»ÄÜÏÔʾ£¿

ÏÈÈ·¶¨ÄãµÄIPµØÖ·¡¢snmp comunite¡¢snmp versionµÈÐÅÏ¢ÅäÖÃûÓдíÎó¡£


Èç¹ûÊÇÔÚlinuxÏ°²×°cactiµÄ»°£¬¿ÉÒÔ°´ÒÔϲ½Öè¼ì²â£º

1.1¡¢cactiµÄdata sourcesºÍGraph Management¾ùÓÐdebug¡£¿´ÊÇ·ñÓдíÎ󣬱ÈÈçrrdÎļþÕÒ²»µ½µÈ¡£


1.2¡¢data sourcesÀï¿´rrdÎļþµÄÃû³Æ£¬È»ºóµ½/cacti/rraĿ¼Öп´ÊÇ·ñÓиÃÎļþ´æÔÚ¡£


1.3¡¢Èç¹ûÓÐrrdÎļþ´æÔÚ£¬Ôò¿ÉÒÔʹÓÃ



CODE:[Copy to clipboard]rrdtool fetch yourRRDfile.rrd AVERAGE

ÃüÁ¿´¸ÃÎļþµÄ²É¼¯µÄÊý¾Ý£¬Èç¹û¶¼ÊÇ¡°nan¡±£¬ÄǾÍÊÇûÓÐÈ¡µ½Êý¾Ý¡£


1.4¡¢ÓпÉÄÜÊÇsnmpget¡¢snmpwalkºÍrrdtoolµÄ·¾¶´íÎó¡£


1.5¡¢Åųý´íÎóºó£¬ÐèÒªÖØн¨Á¢¸Ã¼à²âµã£¨graph£©¡£


Ìáʾ£ºÃ¿Ò»¸öͼÏñµÄÎļþ¾ù»á±£´æΪrraĿ¼ÀïµÄÒ»¸örrdΪºó׺µÄÎļþ£¨¿ÉÒÔÔÚ¡°Data Sources¡±Öп´µ½£©


¡£¡°Data Sources¡±ºÍ¡°Graph Management¡±Öоù¿ÉÒÔ½øÐÐdebug£¬¿ÉÒÔ´ÓdebugÖеóö´íÎóÐÅÏ¢¡£



2¡¢ÎªÊ²Ã´rraĿ¼ÏÂʲô¶¼Ã»ÓУ¿

2.1¡¢Çë²é¿´¸ÃĿ¼µÄȨÏÞ¡£¸ÃĿ¼µÄȨÏÞӦΪcactiuser¿ÉÒÔ¶Áд¡£


2.2¡¢Èç¹ûĿ¼µÄȨÏÞûÓÐÎÊÌ⣬ÄÇô¿ÉÄÜÊÇsnmpµÄÉèÖÃÓÐÎÊÌ⣬ÇëÊÖ¹¤²âÊÔһϣº



CODE:[Copy to clipboard]snmpwalk -v 2c -c public yourIP if

Èç¹ûÓÐÊý¾Ý·µ»Ø£¬ÔòsnmpµÄÊý¾ÝûÓÐÎÊÌâ¡£Èç¹û³öÏÖ¡°Timeout: No Response from ...¡±Ö®ÀàµÄ


´íÎóÐÅÏ¢ÔòÊÇsnmpÉèÖõÄÎÊÌâ¡£


2.3¡¢Ò²¿ÉÄÜÊÇsnmpwalk¡¢snmpgetºÍrrdtoolµÄ·¾¶Ã»ÓÐÉèÖúÃÔÚSettings£­¡·PathsÖмì²éÉèÖÃÊÇ·ñÕýÈ·¡£


Ð޸ĺóÇëÖؽ¨¸Ã¼à²âµã£¡·ñÔò²»ÉúЧ¡£



3¡¢ÎªÊ²Ã´ÄÜÈ¡µ½Á÷Á¿µÄÊý¾Ýµ«È¡²»µ½CPUºÍÄÚ´æµÄÊý¾Ý£¿

Ó¦¸ÃÊÇsnmpȨÏÞµÄÉèÖÃÎÊÌâ¡£¿ÉÒÔÓÃsnmpwalkÊÖ¹¤²âÊÔһϡ£

Èç¹ûҪȡCPUµÈÊý¾Ý£¬ÐèÒªÐÞ¸Änet-snmpµÄÅäÖá£ÈçºÎÐÞ¸ÄÇë¿´£º

http://bbs.chinaunix.net/viewthread.php?tid=594019µÄ4Â¥¡£



4¡¢¿ÉÒÔÈ¡µ½±¾»ú£¨linux£©µÄÊý¾Ý£¬µ«È´²»ÄÜÈ¡µ½Ô¶³ÌÖ÷»úµÄÊý¾Ý£¿

CactiÓкܶàÄ£°å£¬ÓеÄÊÇÓÃSNMP½øÐÐÊý¾Ý²É¼¯£¬ÓеÄÊÇÓÃshell½Å±¾½øÐвɼ¯¡£Èç¹ûûÓÐÌرðµÄÔ­Òò½¨Ò鶼ʹÓÃSNMPµÄ¡£

Associated Graph Templates

Ç°Ãæ´ø¡°ucd/net¡±µÄ¾ÍÊÇÄÜʹÓÃucd-snmpºÍnet-snmpµÄÄ£°å¡£È磺ucd/net - CPU Usage

Associated Data Queries

Ç°Ãæ´øSNMPµÄ¾ÍÊÇÄÜʹÓÃsnmpµÄ¡£È磺SNMP - Interface Statistics


µ±È»£¬Ä㻹¿ÉÒÔ´Ówww.cacti.netÉÏÕÒµ½ÐµÄÄ£°å»òÌí¼Ó×Ô¼ºµÄÄ£°å¡£



5¡¢ÎÒÒÔÇ°ÓÃMRTG½øÐÐÁ÷Á¿µÄ¼à²â£¬ÊÇ·ñ¿ÉÒÔ½«MRTGÖеÄÊý¾Ýµ¼Èëµ½CactiÖÐÄØ£¿

µ±È»¿ÉÒÔ£¡ÒòΪÎÒ¾ÍÊÇÕâÑù×öµÄ¡£

Çë¿´£ºhttp://bbs.chinaunix.net/viewthread.php?tid=595090



6¡¢ÎªÊ²Ã´ÎÒµÄÁ÷Á¿´ïµ½100MÒÔÉÏͼÏñ¾Í²»×¼ÄØ£¿

ÕâÓësnmpµÄ°æ±¾Óйأ¬snmp1µÄÊý¾ÝÊÇ32λ¶øsnmp2cÒÔÉÏÊÇ64λ¡£

Ê×ÏÈҪȷ¶¨ÄãʹÓõÄÊÇsnmp2c»òÒÔÉÏ£¨ÏÖÔÚµÄÍøÂçÉ豸һ°ã¶¼Ö§³Ö£©¡£

È»ºóµã»÷CactiµÄÒ³Ã棺¡°Console ->; Create New Graphs ->;Data Query¡±¡£ÄãÔÚÏÂÃæ¿´µ½

¡°Select a graph type:¡±µÄÏÂÀ­²Ëµ¥£¨Ä¬ÈÏÊÇ¡°In/Out bits¡±£©£¬ÒªÈ¡64bitsµÄÊý¾ÝËùÒÔ½«Æä¸ÄΪ

¡°In/Out bits(64-bit Counters)¡±£¬È»ºóÑ¡ÔñÄãÒª¼à²âµÄÍø¿¨¼´¿É¡£

ÁíÍ⣬¸Ã¼à²âµãµÄ¡°Maximum Value¡±±ØÐëÉèÖÃΪ100MÒÔÉÏ¡£


Èç¹ûÊÇLinuxÖ÷»úÒª¼à²â100MÒÔÉϵÄÁ÷Á¿£¨Ò»°ã²»»á·¢Éú£©£¬ÐèÒª´ø¡°--enable-mfd-rewrites¡±²ÎÊýÖØбàÒë×îеÄnet-snmp¡£



7¡¢09/02/2005 02:59:58 PM - POLLER: Poller[0] Maximum runtime of 296 seconds exceeded. Exiting£¬Ê²Ã´Òâ˼£¿

Ó¦¸ÃÊÇÄãµÄ¼à²âµãÉèÖÃÌ«¶à£¬µ¼ÖÂcactiͨ¹ýsnmpgetÈ¡ÍêËùÓÐÊý¾ÝµÄʱ¼ä³¬¹ý300Ãë¡£

CactiµÄ×÷ÕßÒ»Ôç¾Í¿¼Âǵ½ÕâÎÊÌ⣬ËùÒÔÔÚcactiÖÐÓÐÁ½ÖÖ½â¾ö·½·¨£º


7.1¡¢½«POLLER¸ü¸ÄΪcactid¡£

ĬÈϵÄPOLLERÊÇcmd.php£¬¶øcactidÊÇʹÓÃCдµÄ³ÌÐò£¬Ð§ÂÊ»á±Ècmd.php¸ß¼¸±¶£¡

×¢Ò⣬ËäÈ»POLLERµÄÑ¡ÏîÖÐÓÐcactidµÄÑ¡Ôñ£¬µ«cactidĬÈϲ¢Ã»Óа²×°£¬ËùÒÔ¼´Ê¹ÄãÑ¡ÔñÁËËüÒ²²»»áÉúЧµÄ¡£

Äã¿ÉÒÔ´ÓÕâÀhttp://www.cacti.net/cactid_download.php£©ÏÂÔØcactidµÄÔ´Âë»òrpm£¨bin£©Îļþ½øÐа²×°¡£È»ºóÔÚPATHÖÐÖ¸¶¨cactidµÄ·¾¶¼´¿É¡£


7.2¡¢ÔÚPOLLERµÄÉèÖÃÖмӴócmd.phpµÄ½ø³ÌÊý£¬¼´Í¬Ê±ÔËÐжà¸öcmd.php½øÐÐÊý¾ÝµÄ²É¼¯¡£µ«ÕâÑùµÄ»°»á¼ÓÖØÄãµÄϵͳ¸ºÔØ¡£

Èç¹ûÄãµÄ»úÆ÷ÐÔÄÜÌ«²î£¬½¨Ò黹ÊǸÄÓÃcactidΪºÃ¡£


PS£ºµ±´ÅÅÌ¿Õ¼äÂúµÄʱºò»á³öÏÖÕâ¸öÎÊÌ⣬ԭÒòÊÇ´ÅÅÌ¿Õ¼äÂýµ¼ÖÂsnmpgetµÄʱ¼ä±ä³¤¡£


8¡¢Ôõô±¸·ÝCactiºÍËüµÄÊý¾Ýѽ£¿

Ö»ÐèÒª±¸·ÝrraĿ¼ºÍÊý¾Ý¿â¾Í¿ÉÒÔÁË¡£Äãϲ»¶Ò²¿ÉÒÔ½«logĿ¼һÆ𱸷ݡ£

Èç¹ûÄã×Ô¼ºÌí¼ÓÁËһЩ²å¼þµÄ»°¼ÇµÃÒ²¿½¹ýÈ¥¡£


9¡¢ÈçºÎ½«Êý¾ÝºÏ²¢£¿ÈçºÎ×Ô¶¨Òå½Å±¾£¿

Çë¿´£ºhttp://bbs.chinaunix.net/viewthread.php?tid=631801


10¡¢Ê¹ÓÃmonitor¡¢threshld²å¼þ

Çë¿´:http://bbs.chinaunix.net/viewthread.php?tid=631801

µÄËÄÂ¥¡£


11¡¢ÎªÊ²Ã´Ô¡¢ÄêµÄÁ÷Á¿Í¼ÏÂÃæµÄ×ÖĸÂÒÂ룿

»Ø´ðbyÏôóãó㣺


ÊÇÓÉÓÚrrdtool²»Ö§³ÖÖÐÎĵ¼Öµġ£ÎÒµÄÇé¿ö¸üΪÑÏÖØ£¬µ±Í¼ÖгöÏÖÖÐÎÄʱ£¬rrdtool graphµÄʱºòË÷ÐÔ¾Ísegment faultµôÁË¡£


ÒòΪÖÐÎÄ»·¾³ÏµÄÈÕÆÚÏÔʾ»áȱʡµÄ°ÑÐÇÆÚºÍÔÂÏÔʾ³ÉÖÐÎÄ£¬ÒÔÖÂÓÚÄãµÄͼÉÏÓÉÓÚÎÞ·¨ÏÔʾÖÐÎĶø³öÏÖÂÒÂë¡£


½â¾öµÄ°ì·¨ÓÐ2ÖÖ˼·£¬Ò»ÖÖ¾ÍÊÇÈÃrrdtoolÏÔʾӢÎĵÄÈÕÆÚ£¬Ò»ÖÖ¾ÍÊÇÈÃrrdtoolÖ§³ÖÖÐÎÄ¡£Á½ÖÖ·½·¨¶¼Ç£Éæµ½ÐÞ¸ÄrrdtoolµÄÔ´´úÂë¡£ÎÒ²ÉÈ¡µÄÊǵÚÒ»ÖÖ˼·£¬ÈÃrrdtool²»ÒªÈ¥¶ÁÖÐÎÄ»·¾³µÄÓïÑÔ»·¾³±äÁ¿£¬Ç¿ÖÆÈÃËüÓÃÓ¢ÎÄ¡£


ÎÒÊÇÔÚ±àÒërrdtool1.2ʱ°Ñsrc/rrd_graph.cÎļþÖеÄÕâ¶ÎÄÚÈݸĵô£º


setlocale(LC_TIME,"");

¸Ä³É

setlocale(LC_ALL,"en_US.ISO-8859-1");


È»ºóÔÙ±àÒë¡£ÕâÑù¾ÍºÃÁË¡£Èç¹û»¹²»ÐУ¬Äã¾Í°ÑÄãµÄ»·¾³±äÁ¿ÀïµÄÓïÑÔ»·¾³¶¼¸Ä³ÉÓ¢ÎÄ£º

export LC_ALL=en_US

export LANG=en_US

export LANGUAGE=en_US

export LC_CTYPE=en_US

export LC_TIME=en_US


»òÕߣ¬Äã¾ÍË÷ÐÔ¸ù¾ÝabelÀÏ´óµÄ·½·¨ÈÃrrdtoolÖ§³ÖÖÐÎÄ°É¡£

http://bbs.chinaunix.net/viewthr ... p;extra=&page=1


12¡¢cactiÊÇ·ñÖ§³ÖÖÐÎÄ£¿

cactiĬÈÏÔÚijЩҳÃæ²»ÄÜÕý³£ÏÔʾÖÐÎÄ£¬rrdtoolĬÈÏÒ²²»¿ÉÒÔÏÔʾÖÐÎÄ¡£

Èç¹ûÕæµÄÐèҪʹÓÃÖÐÎÄ£¬Çë²Î¿¼ÏÂÃæÁ¬½Ó¡£

http://bbs.chinaunix.net/viewthread.php?tid=631801


13¡¢Ð½¨µÄdeviceµÄData QueryÀïÃæµÄ״̬×ÜÊÇ¡° Success [0 Items, 0 Rows]¡±£¿


ÇëÏÈÈ·ÈÏÄãµÄsnmpd.confÖеÄȨÏÞÉèÖã¬ÊÇ·ñÔÊÐícactiÈ¡ÕâЩOIDµÄÊý¾Ý¡£¿ÉÒÔʹÓÃsnmpwalkÃüÁîÀ´½øÐвâÊÔ£¬±ÈÈ磺


CODE:[Copy to clipboard]snmpwalk -c community -v 2c hostIP if

Èç¹ûÄãµÄsnmpd.confÉèÖÃûÓÐÎÊÌ⣬ÄÇ¿ÉÄÜÊÇÏÂÃæÕâÖÖÇé¿ö£º

¾É°æ±¾µÄsnmpwalk(±ÈÈçredhatĬÈÏ°²×°µÄ5.0.6)ȱÉÙһЩ²ÎÊý,±ÈÈç-OÖеÄ"U"²ÎÊý.(¿ÉÒÔÓÃsnmpwalk --helpÀ´²é¿´ÊÇ·ñÓиòÎÊý)¡£

¶øcacti-0.86g»òÒÔÉÏ°æ±¾ÐèÒªÕâЩ²ÎÊý,½â¾ö°ì·¨ÊÇ°²×°Ò»¸öеÄnet-snmp°ü(Èç:net-snmp5.2.1)£¬´Ó¶øµÃµ½Ò»¸öÐÂsnmpwalkµÄ°æ±¾¡£


ÆäËüµÄÇë´ó¼ÒÉÏ

www.cacti.net

¿´¿´°É¡£ÄÇÀïÓйٷ½µÄÂÛ̳£¬¿ÉÒÔÔÚÄÇÀïÌáÎÊ¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 4 ÌõÆÀÂÛ

  1. junËøÇåÇï ÓÚ 2011-10-14 13:54:02·¢±í:

    À´È¡¾­µÄ£¬Ð»Ð»

  2. nicmonicmo ÓÚ 2006-08-08 18:33:34·¢±í:

    ͬÉÏ

  3. langzibjf ÓÚ 2006-08-01 13:23:32·¢±í:

    ͬȡ

  4. sonwfly ÓÚ 2006-08-01 12:29:48·¢±í:

    À´È¡¾­µÄ£¬Ð»Ð»