{"id":613,"date":"2008-08-25T14:20:00","date_gmt":"2008-08-25T06:20:00","guid":{"rendered":"http:\/\/note.systw.net\/note\/?p=613"},"modified":"2023-11-04T14:25:20","modified_gmt":"2023-11-04T06:25:20","slug":"mrtg","status":"publish","type":"post","link":"https:\/\/systw.net\/note\/archives\/613","title":{"rendered":"MRTG"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">MRTG(multi router traffic grapher)<br>\u88fd\u4f5c\u7db2\u8def\u6d41\u91cf\u7d71\u8a08\u5716\u7684\u5de5\u5177<br>\u5b98\u65b9\u7db2\u7ad9\u70bahttp:\/\/www.mrtg.org<br><br>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..<br>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..<br><br>\u5b89\u88ddmrtg\u524d\u5148\u78ba\u5b9a\u6709\u4ee5\u4e0b\u529f\u80fd<br>perl&nbsp; (perl-5.0xx \u4ee5\u4e0a)<br>zlib&nbsp; (zlib-1.1.3-xx \u4ee5\u4e0a)<br>gd&nbsp; (gd-1.3.xx \u4ee5\u4e0a)<br>libpng<br>apache<br><br>\u5b89\u88dd<br>.\/configure &nbsp;<br>\u5efa\u8b70\u53c3\u6578\u4f7f\u7528\u4ee5\u4e0b\uff1a<br>&nbsp;&#8211;prefix=\/usr\/local\/mrtg &nbsp;<br>&nbsp;&#8211;with-gd=\/usr\/include &nbsp;<br>&nbsp;&#8211;with-gd-lib=\/usr\/lib &nbsp;<br>&nbsp;&#8211;with-gd-inc=\/usr\/include &nbsp;<br>&nbsp;&#8211;with-png=\/usr\/include &nbsp;<br>&nbsp;&#8211;with-zlib=\/usr\/include<br><br>make<br>make install<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7522\u751f\u5831\u8868<br>\u5047\u8a2d:<br>a,\u4ee5\u4e0b\u6307\u4ee4\u5728\/bin\u76ee\u9304\u4e0b<br>b,\u7522\u751fmrtg.cfg\u7684\u53c3\u6578\u6a94\u4e26\u5b58\u5728\u6839\u76ee\u9304\u4e0a<br>c,\u76ee\u6a19\u8a2d\u5099\u70bapublic@address<br>d,apache\u7684\u76ee\u9304\u5728\/var\/www\/html\/<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u65b0\u589e\u53c3\u6578\u6a94<br>\/bin\/cfgmaker &#8211;output=\/mrtg.cfg public@address<br>\u4e26\u7528vi\u7de8\u8f2f\u53c3\u6578\u6a94mrtg.cfg\u5167\u5bb9\uff0c\u5982\u4e0b<br>WorkDir:\/var\/www\/html\/mrtg\/<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2\u7522\u751f\u5831\u8868<br>\/bin\/mrtg \/mrtg.cfg<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3\u5efa\u7acb\u7d22\u5f15\u6a94<br>\/bin\/indexmaker &#8211;output=\/var\/www\/html\/mrtg\/index.html \/mrtg.cfg<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4\u4e0d\u65b7\u76e3\u63a7<br>\u5728crontab\u52a0\u5165\u4ee5\u4e0b\u5167\u5bb9<br>*\/5 * * * * root \/bin\/mrtg \/mrtg.cfg &gt; \/dev\/null 2&gt;&amp;1<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..<br>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..<br><br>\u5e38\u7528\u6307\u4ee4\u8aaa\u660e<br><br>cfgmaker &#8211;output=&lt; filepath&gt; &lt; name@device address&gt; \/\/\u7522\u751f\u53c3\u6578\u6a94,\u53ef\u7528\u53c3\u6578\u5982\u4e0b<br>\u3000&lt; name@device address&gt; \u4f9d\u64dadevice address\u9019\u500b\u8a2d\u5099\u7684name\u7522\u751f\u76f8\u95dc\u53c3\u6578<br>\u3000&lt; filepath&gt; \u5c07\u53c3\u6578\u6a94\u5b58\u5728filepath<br><br>mrtg &lt; cfg&gt;\/\/\u7522\u751f\u5831\u8868<br>\u3000&lt; cfg&gt; \/\/\u4f9d\u64dacfg\u53c3\u6578\u6a94\u7522\u751f\u5831\u8868<br>\u3000ps\uff1a\u57f7\u884c\u7b2c1\uff0c2\u6b21\u901a\u5e38\u6703\u6709\u8b66\u544a\u8a0a\u606f\uff0c\u7b2c\u4e09\u6b21\u5c31\u4e0d\u6703\u6709\u4e86\uff0c\u9808\u57f7\u884c\u5230\u7121\u8b66\u544a\u8a0a\u606f\u70ba\u6b62<br><br>indexmaker &#8211;output=&lt; filepath&gt; &lt; cfg&gt;\/\/\u7522\u751f\u7d22\u5f15\u7db2\u9801<br>\u3000&lt; filepath&gt; \u5c07\u7d22\u5f15\u7db2\u9801\u5b58\u5728filepath<br>\u3000&lt; cfg&gt; \/\/\u4f9d\u64dacfg\u6a94\u7522\u751f\u7d22\u5f15\u7db2\u9801<br><br>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..<br><br>\u53c3\u6578\u6a94\u8a2d\u5b9a<br><br>\u5168\u57df\u8a2d\u5b9a<br>WorkDir:dirpath&nbsp; \/\/\u8a2d\u5b9a\u5b58\u653e\u5831\u8868\u7684\u76ee\u9304<br>Refresh:sec \/\/\u8a2d\u5b9a\u5e7e\u79d2\u904a\u89bd\u5668\u66f4\u65b0\u4e00\u6b21<br>Language:big5 \/\/\u8a2d\u5b9a\u8a9e\u8a00\u70babig5<br>RunAsDaemon:Yes \/\/\u4ee5daemon\u7684\u65b9\u5f0f\u5728\u80cc\u666f\u57f7\u884c\u800c\u4e0d\u7528crontab\uff0c\u53ef\u7701\u8cc7\u6e90<br>interval:5 \/\/\u7528\u5728RunAsDaemon:Yes\uff0c\u5247\u6bcf5\u5206\u9418\u66f4\u65b0\u4e00\u6b21<br><br><br>\u5340\u57df\u8a2d\u5b9a<br>target[name]:option<br>\/\/target\u53c3\u6578\u6240\u6307\u7684name\uff0c\u6703\u7528\u5728\u7522\u751f\u7db2\u9801\u6216\u7d00\u9304\u6a94\u7684\u6a94\u6848\uff0c\u56e0\u6b64\u5728\u6240\u6307\u5b9a\u7684\u5de5\u504f\u76ee\u9304\u4e2d\uff0c\u4e0d\u53ef\u6709\u76f8\u540cname\u4ee5\u514d\u5f71\u97ff<br>\/\/option\u5982\u4e0b<br>&nbsp;port:public@address \/\/\u544a\u8a22mrtg\u900f\u904eport\u5075\u6e2cpublic@address<br>&nbsp;ex:target[127.0.0.1]:2:public@localhost<br>&nbsp;`program` \/\/\u544a\u8a34mrtg\u57f7\u884cprogram<br>&nbsp;ex:`\/usr\/local\/apache\/htdocs\/cpustatus`<br>&nbsp;<br>SetEnv[name]:var=&#8221;value&#8221; \/\/\u53ef\u91dd\u5c0d\u7522\u751f\u7684\u7db2\u9801\u9032\u884c\u74b0\u5883\u8cc7\u8a0a\u7684\u63d0\u4f9b,var\u6709EMAIL,HOST,URL,MRTG_INT_IP<br>YLegend[name]:scribe \/\/\u8a2d\u5b9ay\u8ef8\u6a19\u7c3d\u70bascribe<br>Legend1[name]:scribe \/\/\u8a2d\u5b9a\u7b2c1\u689d\u66f2\u7dda\u7684\u8aaa\u660e\u8cc7\u6599\u70bascribe,1\u53ef\u63db\u62102,3,4,I,O<br>LegendI:in&nbsp; \/\/\u8a2d\u5b9a\u8aaa\u660e\u6587\u5b57,\u9810\u8a2d\u986f\u793ain<br>LegendO:out&nbsp; \/\/\u8a2d\u5b9a\u8aaa\u660e\u6587\u5b57,\u9810\u8a2d\u986f\u793aout<br>ShortLegend[name]: % \/\/\u8a2d\u5b9a\u55ae\u4f4d\u70ba\uff05<br>Title[name]:title \/\/\u8a2d\u5b9a\u6a19\u984c\u70batitle<br>PageTop[name]:htmldata&nbsp; \/\/\u52a0\u5165htmldata\u5230html\u7db2\u9801\u4e2d<br><br>MaxBytes[_]: 1250000 \/\/\u5831\u8868\u6700\u5927\u6578\u503c<br>Option[_]:option \/\/\u53ef\u9078option\u5982\u4e0b,\u9810\u8a2d\u70babyte<br>&nbsp;&nbsp; bits \/\/\u5716\u7247\u4ee5bits\u70ba\u55ae\u4f4d<br>&nbsp;&nbsp; growright \/\/\u5716\u8868\u5f9e\u53f3\u908a\u958b\u59cb\u756b<br>&nbsp;&nbsp; avgpeak \/\/\u8a2d\u5b9a\u5e73\u5747\u503c\u7684\u8a08\u7b97\uff0c\u9810\u8a2d5\u5206\u9418<br>&nbsp;&nbsp; unknaszero \/\/\u6536\u96c6\u8cc7\u6599\u6642\u767c\u73fe\u503c\u70ba0\uff0c\u5247\u5831\u8868\u7d00\u93040\uff0c\u53ef\u907f\u514d\u8a2d\u5099\u65b7\u7dda\u6642\uff0c\u6301\u7e8c\u4ee5\u6700\u5f8c\u4e00\u500b\u503c\u4f86\u4ee3\u8868<br>&nbsp;&nbsp; withzeroes \/\/\u6536\u96c6\u8cc7\u6599\u6642\u767c\u73fe\u503c\u70ba0\uff0c\u5247\u52ff\u7565\uff0c\u82e5\u8a2d\u5099\u65b7\u7dda\u6642\uff0c\u6301\u7e8c\u4ee5\u6700\u5f8c\u4e00\u500b\u503c\u4f86\u4ee3\u8868<br>&nbsp;&nbsp; gauge \/\/\u61c9\u7528\u5728\u8cc7\u6599\u91cf\u7684\u986f\u793a\uff0c\u4e14\u5716\u8868\u7684\u4e0a\u9650\u56fa\u5b9a\uff0cex:\u78c1\u789f\u5bb9\u91cf\uff0ccpu\u8ca0\u8f09\uff0c\u6eab\u5ea6<br>&nbsp;&nbsp; absolute \/\/\u914d\u5408gauge<br>&nbsp;&nbsp; nopercent \/\/\u4e0d\u986f\u793a\u767e\u5206\u6bd4\u7684\u8cc7\u8a0a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">WithPeak[]: dwmy\u3000\/\/\u7528\u6700\u5927\u503c\u8a18\u9304,\u9810\u8a2d\u662f\u5e73\u5747\u503c<br>kilo[]: 1024 \/\/\u6539\u8b8a\u55ae\u4f4d\u63db\u7b97\u65b9\u5f0f\uff0c\u9810\u8a2d\u503c1000<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><br>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..<br><br><br>ps:\u82e5\u6709\u52d5\u614bip,\u5247\u9700\u5c07SetEnv[name]\u5167\u7684MRTG_INT_IP\u7684ip\u6539\u70ba\u7db2\u57df<br>\u5426\u5247\u6703\u611f\u61c9\u4e0d\u5230\u6b64\u52d5\u614bip\u7684\u754c\u9762<br>ex:<br>\u539f\u672cSetEnv[127.0.0.1_1]: MRTG_INT_IP=&#8221;116.59.118.34&#8243;<br>\u6539\u6210SetEnv[127.0.0.1_1]: MRTG_INT_IP=&#8221;domains&#8221;<br>domains\u53ef\u7528ddns<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">windows\u4e0b\u7684\u8a2d\u5b9a&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u5229\u7528cfgmaker\u6307\u4ee4\u7522\u751f\u7d44\u614b\u6a94mrtg.cfg<br>perl cfgmaker public@address &#8211;output mrtg.cfg<br>ps:<br>\u7d44\u614b\u6a94\u7522\u751f\u5f8c\u8981\u7de8\u8f2fmrtg.cfg<br>\u898f\u5247\u540clinux\u53c3\u6578\u6a94\u8a2d\u5b9a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2<br>\u6839\u64da\u7d44\u614b\u6a94\u5229\u7528mrtg\u6307\u4ee4\u5efa\u7acb\u6a94\u6848<br>perl mrtg mrtg.cfg<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3<br>\u8981\u6c42mrtg\u5b9a\u671f\u756b\u6d41\u91cf<br>start \/D &lt; mrtg directory &gt;bin wperl mrtg &#8211;logging=eventlog &lt; cfg &gt;<br>ex:<br>start \/D D:mrtg-2.16.3bin wperl mrtg &#8211;logging=eventlog mrtg.cfg<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MRTG(multi router traffic grap &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[17],"tags":[],"class_list":["post-613","post","type-post","status-publish","format-standard","hentry","category-systemtool"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":539,"url":"https:\/\/systw.net\/note\/archives\/539","url_meta":{"origin":613,"position":0},"title":"PHP\u5b89\u88dd","author":"raymond","date":"2008 \u5e74 8 \u6708 6 \u65e5","format":false,"excerpt":"php(http:\/\/www.php.net\/)..........................\u2026","rel":"","context":"\u5728\u300c\u958b\u767c\u300d\u4e2d","block_context":{"text":"\u958b\u767c","link":"https:\/\/systw.net\/note\/archives\/category\/develop"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":675,"url":"https:\/\/systw.net\/note\/archives\/675","url_meta":{"origin":613,"position":1},"title":"Tomcat","author":"raymond","date":"2013 \u5e74 1 \u6708 20 \u65e5","format":false,"excerpt":"\u5b89\u88ddopenJDK CentOS 5\u4ee5yum\u5b89\u88ddopenjdk#yum install java-1\u2026","rel":"","context":"\u5728\u300cLinux\u670d\u52d9\u300d\u4e2d","block_context":{"text":"Linux\u670d\u52d9","link":"https:\/\/systw.net\/note\/archives\/category\/system\/linuxservice"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":577,"url":"https:\/\/systw.net\/note\/archives\/577","url_meta":{"origin":613,"position":2},"title":"MySQL on linux","author":"raymond","date":"2012 \u5e74 11 \u6708 3 \u65e5","format":false,"excerpt":"\u6b77\u53f21994\u745e\u5178\uff0c\u5f9e\u5546\u696d(AB\u516c\u53f8)\u5230\u958b\u6e90\uff0c\u4e26\u65bc2008\u5e74\u88abSUN\u82b110\u5104\u7f8e\u91d1\u6536\u8cfc ........\u2026","rel":"","context":"\u5728\u300c\u8cc7\u6599\u5eab\u300d\u4e2d","block_context":{"text":"\u8cc7\u6599\u5eab","link":"https:\/\/systw.net\/note\/archives\/category\/develop\/database"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":380,"url":"https:\/\/systw.net\/note\/archives\/380","url_meta":{"origin":613,"position":3},"title":"Snort","author":"raymond","date":"2013 \u5e74 1 \u6708 7 \u65e5","format":false,"excerpt":"snort(http:\/\/www.snort.org\/)1,opensource\u5165\u4fb5\u5075\u6e2c\u7cfb\u7d71,\u4f5c\u8005\u70ba\u2026","rel":"","context":"\u5728\u300cblue team\u300d\u4e2d","block_context":{"text":"blue team","link":"https:\/\/systw.net\/note\/archives\/category\/securitytool\/blue-team"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":654,"url":"https:\/\/systw.net\/note\/archives\/654","url_meta":{"origin":613,"position":4},"title":"Linux\u76ee\u9304\u914d\u7f6e","author":"raymond","date":"2008 \u5e74 10 \u6708 26 \u65e5","format":false,"excerpt":"linux\u76ee\u9304\u914d\u7f6e\u4e3b\u8981\u70ba\u6839\u76ee\u9304,\/usr,\/var\u4f9dFHS\u6a19\u6e96\u8a2d\u8a08 FHS\u5b9a\u7fa9\u4ee5\u4e0b\u56db\u7a2e\u5f62\u614bshare\u2026","rel":"","context":"\u5728\u300cLinux\u7cfb\u7d71\u300d\u4e2d","block_context":{"text":"Linux\u7cfb\u7d71","link":"https:\/\/systw.net\/note\/archives\/category\/system\/linuxsystem"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":605,"url":"https:\/\/systw.net\/note\/archives\/605","url_meta":{"origin":613,"position":5},"title":"OpenNMS","author":"raymond","date":"2009 \u5e74 10 \u6708 20 \u65e5","format":false,"excerpt":"opennms(http:\/\/www.opennms.org)\u7db2\u8def\u7ba1\u7406\u7cfb\u7d71,\u53ef\u76e3\u63a7\u5404\u7bc0\u9ede,\u50cf\u662f\u4ea4\u63db\u5668\u2026","rel":"","context":"\u5728\u300c\u7cfb\u7d71\u7ba1\u7406\u5de5\u5177\u300d\u4e2d","block_context":{"text":"\u7cfb\u7d71\u7ba1\u7406\u5de5\u5177","link":"https:\/\/systw.net\/note\/archives\/category\/system\/systemtool"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/comments?post=613"}],"version-history":[{"count":0,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/613\/revisions"}],"wp:attachment":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/media?parent=613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/categories?post=613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/tags?post=613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}