{"id":19575,"date":"2017-05-27T06:10:00","date_gmt":"2017-05-26T22:10:00","guid":{"rendered":"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/05\/27\/%e5%9c%a8-centos-7-x-%e4%b8%8b%e5%ae%89%e8%a3%9d-mrtg\/"},"modified":"2021-03-18T17:25:03","modified_gmt":"2021-03-18T09:25:03","slug":"%e5%9c%a8-centos-7-x-%e4%b8%8b%e5%ae%89%e8%a3%9d-mrtg","status":"publish","type":"post","link":"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/05\/27\/%e5%9c%a8-centos-7-x-%e4%b8%8b%e5%ae%89%e8%a3%9d-mrtg\/","title":{"rendered":"\u5728 CentOS 7.x \u4e0b\u5b89\u88dd mrtg"},"content":{"rendered":"<p><a id=\"res_3790823\" href=\"https:\/\/2blog.ilc.edu.tw\/wp-content\/uploads\/sites\/985\/25793\/25793-3790823.png\"><img decoding=\"async\" src=\"https:\/\/2blog.ilc.edu.tw\/wp-content\/uploads\/sites\/985\/25793\/previews-med\/25793-3790823.png\" border=\"0\" alt=\"\" \/><\/a><br \/>\u53c3\u8003\u7db2\u9801\uff1a<br \/><a href=\"https:\/\/www.server-world.info\/en\/note?os=CentOS_7&amp;p=mrtg&amp;f=1\" target=\"_blank\" rel=\"noopener noreferrer\">CentOS 7 : MRTG : Install : Server World<\/a><\/p>\n<p><span style=\"color: #0000ff\">mrtg Server : 192.168.1.10<\/span><br \/>1. \u5b89\u88dd mrtg<br \/># <span style=\"color: #ff0000\">yum install net-snmp net-snmp-utils mrtg<\/span><\/p>\n<p>2. \u8a2d\u5b9a snmp<br \/># <span style=\"color: #ff0000\">echo &#8216;rocommunity public&#8217; &gt; \/etc\/snmp\/snmpd.conf<\/span><br \/># <span style=\"color: #ff0000\">systemctl enable snmpd.service<\/span><br \/># <span style=\"color: #ff0000\">systemctl start snmpd.service<\/span>[@more@]<br \/>3. \u9632\u706b\u7246\u8a2d\u5b9a<br \/>#<span style=\"color: #ff0000\"> firewall-cmd &#8211;add-rich-rule=&#8221;rule family=&#8221;ipv4&#8243; source address=&#8221;192.168.1.0\/24&#8243; service name=&#8221;snmpd&#8221; accept&#8221; &#8211;permanent<\/span><br \/>\u6216<br \/># <span style=\"color: #ff0000\">iptables -A INPUT\u00a0 -p udp -s 192.168.1.0\/24 -m state &#8211;state NEW &#8211;dport 161 -j ACCEPT<\/span><\/p>\n<p>4. \u6e2c\u8a66<br \/># <span style=\"color: #ff0000\">\/bin\/snmpwalk -v2c -c public 127.0.0.1<\/span><\/p>\n<p>5. \u5efa\u7acb mrtg <span style=\"color: #0000ff\">\/etc\/mrtg\/mrtg.cfg<\/span> \u8a2d\u5b9a\u6a94<br \/># <span style=\"color: #ff0000\">\/bin\/cfgmaker &#8211;snmp-options=:::::2 &#8211;ifref=descr &#8211;ifdesc=descr 192.168.1.10 &gt; \/etc\/mrtg\/mrtg.cfg<\/span> <\/p>\n<p>6. \u4fee\u6539 mrtg \u8a2d\u5b9a\u6a94 <span style=\"color: #0000ff\">\/etc\/mrtg\/mrtg.cfg<\/span> <br \/># <span style=\"color: #ff0000\">cp \/etc\/mrtg\/mrtg.cfg \/etc\/mrtg\/mrtg.cfg.$(date +%F)<\/span><br \/># <span style=\"color: #ff0000\">vim \/etc\/mrtg\/mrtg.cfg<\/span><br \/><span style=\"color: #0000ff\">### Global Config Options<\/span><\/p>\n<p><span style=\"color: #0000ff\">#\u00a0 for UNIX<\/span><br \/><span style=\"color: #0000ff\"># WorkDir: \/home\/http\/mrtg<\/span><br \/><span style=\"color: #0000ff\">WorkDir: \/var\/www\/mrtg<\/span><\/p>\n<p><span style=\"color: #0000ff\">### Global Defaults<\/span><\/p>\n<p><span style=\"color: #0000ff\">#\u00a0 to get bits instead of bytes and graphs growing to the right<\/span><br \/><span style=\"color: #0000ff\">Options[_]: growright, bits<\/span><\/p>\n<p>7. \u57f7\u884c\u4e09\u6b21\uff0c\u4e0d\u7528\u7406\u6703\u8b66\u544a\uff0c\u56e0\u70ba\u4e00\u525b\u958b\u59cb\u6c92\u6709\u8cc7\u6599\uff0c\u6240\u4ee5\u6703\u51fa\u73fe\uff0c\u518d\u57f7\u884c\u4e00\u6b21\u5c31\u6703\u6c92\u6709<br \/># <span style=\"color: #ff0000\">for (( i=1 ; i &lt;= 3 ; i++ )); do env LANG=C mrtg \/etc\/mrtg\/mrtg.cfg; done<\/span><br \/><span style=\"color: #0000ff\">2017-03-11 11:57:18, Rateup WARNING: \/usr\/bin\/rateup could not read the primary log file for 192.168.1.10_eth0<\/span><br \/><span style=\"color: #0000ff\">2017-03-11 11:57:18, Rateup WARNING: \/usr\/bin\/rateup The backup log file for 192.168.1.10_eth0 was invalid as well<\/span><br \/><span style=\"color: #0000ff\">2017-03-11 11:57:18, Rateup WARNING: \/usr\/bin\/rateup Can&#8217;t rename 192.168.1.10_eth0.log to 192.168.1.10_eth0.old updating log file<\/span><\/p>\n<p>8. \u7522\u751f index \u6a94<br \/># <span style=\"color: #ff0000\">\/bin\/indexmaker &#8211;columns=1 \/etc\/mrtg\/mrtg.cfg &gt; \/var\/www\/mrtg\/index.html<\/span> <\/p>\n<p>9. \u5efa\u7acb mrtg cron<br \/># <span style=\"color: #ff0000\">vim \/etc\/cron.d\/mrtg<\/span><br \/><span style=\"color: #0000ff\">*\/5 * * * * root LANG=C LC_ALL=C \/usr\/bin\/mrtg \/etc\/mrtg\/mrtg.cfg &#8211;lock-file \/var\/lock\/mrtg\/mrtg_l &#8211;confcache-file \/var\/lib\/mrtg\/mrtg.ok<\/span> <\/p>\n<p>10. \u4fee\u6539 <span style=\"color: #0000ff\">\/etc\/httpd\/conf.d\/mrtg.conf<\/span><br \/># <span style=\"color: #ff0000\">vim \/etc\/httpd\/conf.d\/mrtg.conf<\/span><br \/><span style=\"color: #0000ff\">Alias \/mrtg \/var\/www\/mrtg<\/span><\/p>\n<p><span style=\"color: #0000ff\">&lt;Location \/mrtg&gt;<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 Require local<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 Require ip 192.168.1.0\/24<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 # Require ip 10.1.2.3<\/span><br \/><span style=\"color: #0000ff\">\u00a0\u00a0\u00a0 # Require host example.org<\/span><br \/><span style=\"color: #0000ff\">&lt;\/Location&gt;<\/span><\/p>\n<p>11. \u91cd\u65b0\u555f\u52d5 Web Server<br \/># <span style=\"color: #ff0000\">systemctl restart httpd.service<\/span><\/p>\n<p>12. \u89c0\u770b\u6210\u679c <span style=\"color: #ff0000\">http:\/\/Server&#8217;IP\/mrtg<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53c3\u8003\u7db2\u9801\uff1aCentOS 7 : MRTG : Install : Server World mrtg Serv &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/2blog.ilc.edu.tw\/25793\/2017\/05\/27\/%e5%9c%a8-centos-7-x-%e4%b8%8b%e5%ae%89%e8%a3%9d-mrtg\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008\u5728 CentOS 7.x \u4e0b\u5b89\u88dd mrtg\u3009<\/span><\/a><\/p>\n","protected":false},"author":55,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117],"tags":[],"class_list":["post-19575","post","type-post","status-publish","format-standard","hentry","category-c-78462"],"meta_key":{"_pingme":["1"],"_encloseme":["1"],"lt_post_id":["688386"]},"_links":{"self":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19575"}],"collection":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/comments?post=19575"}],"version-history":[{"count":1,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19575\/revisions"}],"predecessor-version":[{"id":21083,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/19575\/revisions\/21083"}],"wp:attachment":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/media?parent=19575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/categories?post=19575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/tags?post=19575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}