MRTG for M$



贊助商連結


頁 : 1 2 3 4 5 [6] 7 8 9

repsol
2001-09-01, 02:16 AM
最初由 shyong
請問應該如何開啟 Linux 中的 SNMP ?
下列是我執行 MRTG 後的錯誤訊息 ~~~~

root@power bin ./mrtg mrtg.cfg
SNMP Error:
Received SNMP response with error code
error status: noSuchName
index 1 (OID: 1.3.6.1.2.1.2.2.1.10.161)
SNMPv1_Session (remote host: "163.13.136.128" [163.13.136.128].161)
community: "public"
request ID: 489446806
PDU bufsize: 8000 bytes
timeout: 2s
retries: 5
backoff: 1)
at /home/mrtg-2.9.17/bin/../lib/mrtg2/SNMP_util.pm line 450
SNMPGET Problem for ifInOctets.161 ifOutOctets.161 sysUptime sysName on public@1
63.13.136.128: at ./mrtg line 1485
WARNING: Expected a number but got ''
WARNING: Expected a number but got ''


你這個訊息應該是mrtg沒辦法跟snmp溝通..沒有辦法正常的傳回值..
用以下指令作各檢查..看看snmpd有沒有啟動
ps -ax|grep snmpd
如果有..會顯示Pid號碼...啟動者..daemon路徑
一般snmpd會裝在/usr/local/sbin/snmpd...如果沒有...就直接run下企..

如果沒裝..請到這邊抓source...回企compile
http://ucd-snmp.ucdavis.edu/
我不清楚你用的那種的linux(redhat ? slackware?)
不過都可以用啦..
ucd-snmp是很standard的東東
至於cron如何排入root的contab
su成root之後執行 crontab -e
就可以編輯屬於root的cron job....
至於crontab裡的設定格式...
你可以試試man crontab...
裡面會有相當詳細的設定格式...
minute 0-59
hour 0-23
day of month 1-31
month 1-12 (or names, see below)
month
然後是你要執行的命令
設定起來會像是這樣得一行
minute hour day of month month month 要執行的命令
試試看...
Good Luck !!!

贊助商連結


repsol
2001-09-01, 02:26 AM
最初由 casperyang


由於已經將三個設備都建成不同路徑,也就是分三個網頁去看
所以有A.cfg , B.cfg C.cfg三個檔
現在要把三個放在一個網頁是不是在A.cfg把其他兩個路徑如repsol兄所說的加上去即可ㄋㄟ?
這樣只要進A的網頁就可以看見三台設備的流量了
不知道是不是這樣做阿?
repsonl


hmm...我的建議是將a.cfg b.cfg c.cfg...合併成一個d.cfg
只要target[xxxxxx]....xxxxx的部分不要相同
like this.....這三個 device ..是同一個d.cfg...完成之後..再用indexmaker
作出一個新的 index.html....就可以有一張同時有三個介面的index.html流量圖

Target[your_nic_1_ip]: your_nic_1_OID:your_community_1@your_nic_1_ip:
MaxBytes[your_nic_1_ip]: 1250000
Title[your_nic_1_ip]: Traffic Analysis for 1
PageTop[localhost_1]: <H1>your_nic_1_ip</H1>

Target[your_nic_2_ip]: your_nic_2_OID:your_community_2@your_nic_2_ip:
MaxBytes[your_nic_2_ip]: 1250000
Title[your_nic_2_ip]: Traffic Analysis for 2
PageTop[localhost_2]: <H1>your_nic_2_ip</H1>

Target[your_nic_3_ip]: your_nic_3_OID:your_community_3@your_nic_3_ip:
MaxBytes[your_nic_3_ip]: 1250000
Title[your_nic_3_ip]: Traffic Analysis for 3
PageTop[localhost_3]: <H1>your_nic_3_ip</H1>


試看看...Good Luck

shyong
2001-09-01, 04:08 PM
請問當我於 linux 底下輸入 run ps -ax|grep snmpd
出現下列訊息

697 ? S 0:00 /usr/sbin/snmpd -s -l /dev/null -P /var/run/snmpd -a
831 pts/0 S 0:00 grep snmpd

這樣是否表示 snmpd 有在 run , 為何當我執行 ./mrtg mrtg.cfg
出現下列訊息 ,


SNMP Error:
Received SNMP response with error code
error status: noSuchName
index 1 (OID: 1.3.6.1.2.1.2.2.1.10.161)
SNMPv1_Session (remote host: "163.23.136.246" [163.23.136.246].161
community: "public"
request ID: 1375085084
PDU bufsize: 8000 bytes
timeout: 2s
retries: 5
backoff: 1)
SNMPGET Problem for ifInOctets.161 ifOutOctets.161 sysUptime sysName ifDescr.161
on [email protected]
SNMPGET: Failed to reach target: "161:[email protected]". I tried multiple t
imes!


我所安裝的 ucd-snmp 為

ucd-snmp-4.2.1-2.rh62.src.rpm (http://prdownloads.sourceforge.net/net-snmp/ucd-snmp-4.2.1-2.rh62.src.rpm)


(1)請問 your_nic_1_OID 是要填入什麼 ? 另外 your_community_1 又要填入什麼 ?

repsol
2001-09-01, 05:31 PM
最初由 shyong
請問當我於 linux 底下輸入 run ps -ax|grep snmpd
出現下列訊息

697 ? S 0:00 /usr/sbin/snmpd -s -l /dev/null -P /var/run/snmpd -a
831 pts/0 S 0:00 grep snmpd

這樣是否表示 snmpd 有在 run , 為何當我執行 ./mrtg mrtg.cfg
出現下列訊息 ,


SNMP Error:
Received SNMP response with error code
error status: noSuchName
index 1 (OID: 1.3.6.1.2.1.2.2.1.10.161)
SNMPv1_Session (remote host: "163.23.136.246" [163.23.136.246].161
community: "public"
request ID: 1375085084
PDU bufsize: 8000 bytes
timeout: 2s
retries: 5
backoff: 1)
SNMPGET Problem for ifInOctets.161 ifOutOctets.161 sysUptime sysName ifDescr.161
on [email protected]
SNMPGET: Failed to reach target: "161:[email protected]". I tried multiple t
imes!


我所安裝的 ucd-snmp 為

ucd-snmp-4.2.1-2.rh62.src.rpm (http://prdownloads.sourceforge.net/net-snmp/ucd-snmp-4.2.1-2.rh62.src.rpm)


(1)請問 your_nic_1_OID 是要填入什麼 ? 另外 your_community_1 又要填入什麼 ?



方便的話..可否將你的mrtg.cfg貼上來讓我看一下...
很難猜想到你的狀況是如何....
your_nic_1_OID--->這個會因snmp和你的所要監控的device會互相對應 ...不太一定
可以說是一種樹狀的大結構,OID: 1.3.6.1.2.1.2.2.1.10.161一層一層的資料架構...
your_community_1--->講簡單一點,這個就是要和snmp溝通的連結string...你所貼上來的東西裡的public就是你的snmp community...這個設定是由snmpd來設的...

再請問一點..你的cfg檔是用cfgmaker作出來的嗎??
如果有這種Received SNMP response with error code...問題..
應該會在cfgmaker的時候就會出現錯誤...mrtg.cfg會無法正常的作出來
不應該會出現在mrtg mrtg.cfg...

如果你無法正確得知你的NIC(網路卡)的OID(我知道我自己的網路卡OID值,在這個前提之下,我才可以自己手動編輯一個mrtg.cfg檔)...最好就是用cfgmaker這個tool企自動抓你nic所屬的oid值

再試試...
Good Luck !!!

ee844548
2001-09-01, 07:27 PM
看了這模多資料
我有一點小疑問
就是我適用adsl計時制
所以我家的atu-r為zyxel 642
我家的atur沒有ip耶
哪有辦法監控他的流量嗎

shyong
2001-09-01, 11:00 PM
我剛剛將 SNMPD 刪除 ,然後重新在安裝 ... 結果更慘 ,連圖片都出不來

檢查 SNMP 應該是有啟動 , 如下圖

另外 , 我在進行 "設定mrtg的組態檔" 時就出現錯誤了 !

repsol
2001-09-02, 12:54 AM
最初由 ee844548
看了這模多資料
我有一點小疑問
就是我適用adsl計時制
所以我家的atu-r為zyxel 642
我家的atur沒有ip耶
哪有辦法監控他的流量嗎


我的ATU-R是跟你一樣的..我試過...結果不行..
那我就只好反過來監控自己網卡的流量......
這個是我作的..大家參考看看..
http://home.kimo.com.tw/chmodkimo/traffic.htm

repsol
2001-09-02, 01:10 AM
最初由 shyong
我剛剛將 SNMPD 刪除 ,然後重新在安裝 ... 結果更慘 ,連圖片都出不來

檢查 SNMP 應該是有啟動 , 如下圖

另外 , 我在進行 "設定mrtg的組態檔" 時就出現錯誤了 !



Hmm...你的問題應該不在你的mrtg...應該就是snmpd出了問題
請問你的redhat是哪一版的.????
先檢查看看你的iptable或是ipchain的rules..
看看161 port(snmpd啟動時會打開161 port UDP)有沒有被ACCEPT
用你的webmin企看看ipchains或是iptable的設定
再試試..

Good Luck !!

ee844548
2001-09-02, 12:06 PM
真的不行嗎
因為我現在有抓到atu-r
只是產生的htm檔無法產生圖
因為zyxel預設ip是192.168.1.1
我電腦ip現在設192.168.1.3 gateway設192.168.1.1
所以可以連到zyxel
執行perl cfgmaker [email protected] "WorkDir:
c:\InetPub\wwwroot\MRTG" --output mrtg.cfg
也有抓到一大推資料
不過底下的mrtg.cfg我沒有編輯過
再執行perl indexmaker -t "MY Traffic show" mrtg.cfg > c:\InetPub\wwwroot\MRTG\index.html
也產生一個檔
我再用127.0.0.1去瀏覽127.0.0.1/mrtg/index.html
也可以瀏覽但是就是沒有產生圖片
是我mrtg.cfg沒有編輯所以沒有圖
還是有其他問題底下是我的mrtg.cfg
麻煩各位高手指導一下
還是真的本來zyxel第二批就是無法使用snmp
我的zyxel可以telnet進去
我寫得很詳細

# Created by # cfgmaker [email protected] --global 'WorkDir: c:\InetPub\wwwroot\mrtg' --output mrtg.cfg ### Global Config Options # for UNIX # WorkDir: /home/http/mrtg # or for NT # WorkDir: c:\mrtgdata ### Global Defaults # to get bits instead of bytes and graphs growing to the right # Options[_]: growright, bits ###################################################################### # System: ChangeMe # Description: Prestige 642R # Contact: # Location: ###################################################################### ### Interface 1 >> Descr: 'enet0' | Name: '' | Ip: '192.168.1.1' | Eth: '' ### Target[192.168.1.1_1]: 1:[email protected]: SetEnv[192.168.1.1_1]: MRTG_INT_IP="192.168.1.1" MRTG_INT_DESCR="enet0" MaxBytes[192.168.1.1_1]: 12500000 Title[192.168.1.1_1]: Traffic Analysis for 1 -- ChangeMe PageTop[192.168.1.1_1]:
Traffic Analysis for 1 -- ChangeMe
System: ChangeMe in
Maintainer:
Description: enet0
ifType: ethernetCsmacd (6)
ifName:
Max Speed: 12.5 MBytes/s
Ip: 192.168.1.1 ()
### Interface 2 >> Descr: 'mpoa00' | Name: '' | Ip: '0.0.0.0' | Eth: '' ### Target[192.168.1.1_2]: 2:[email protected]: SetEnv[192.168.1.1_2]: MRTG_INT_IP="0.0.0.0" MRTG_INT_DESCR="mpoa00" MaxBytes[192.168.1.1_2]: 64000 Title[192.168.1.1_2]: Traffic Analysis for 2 -- ChangeMe PageTop[192.168.1.1_2]:

repsol
2001-09-02, 01:29 PM
最初由 ee844548
真的不行嗎
因為我現在有抓到atu-r
只是產生的htm檔無法產生圖
因為zyxel預設ip是192.168.1.1
我電腦ip現在設192.168.1.3 gateway設192.168.1.1
所以可以連到zyxel
執行perl cfgmaker [email protected] "WorkDir:
c:\InetPub\wwwroot\MRTG" --output mrtg.cfg
也有抓到一大推資料
不過底下的mrtg.cfg我沒有編輯過
再執行perl indexmaker -t "MY Traffic show" mrtg.cfg > c:\InetPub\wwwroot\MRTG\index.html
也產生一個檔
我再用127.0.0.1去瀏覽127.0.0.1/mrtg/index.html
也可以瀏覽但是就是沒有產生圖片
是我mrtg.cfg沒有編輯所以沒有圖
還是有其他問題底下是我的mrtg.cfg
麻煩各位高手指導一下
還是真的本來zyxel第二批就是無法使用snmp
我的zyxel可以telnet進去
我寫得很詳細

# Created by # cfgmaker [email protected] --global 'WorkDir: c:\InetPub\wwwroot\mrtg' --output mrtg.cfg ### Global Config Options # for UNIX # WorkDir: /home/http/mrtg # or for NT # WorkDir: c:\mrtgdata ### Global Defaults # to get bits instead of bytes and graphs growing to the right # Options[_]: growright, bits ###################################################################### # System: ChangeMe # Description: Prestige 642R # Contact: # Location: ###################################################################### ### Interface 1 >> Descr: 'enet0' | Name: '' | Ip: '192.168.1.1' | Eth: '' ### Target[192.168.1.1_1]: 1:[email protected]: SetEnv[192.168.1.1_1]: MRTG_INT_IP="192.168.1.1" MRTG_INT_DESCR="enet0" MaxBytes[192.168.1.1_1]: 12500000 Title[192.168.1.1_1]: Traffic Analysis for 1 -- ChangeMe PageTop[192.168.1.1_1]:
Traffic Analysis for 1 -- ChangeMe
System: ChangeMe in
Maintainer:
Description: enet0
ifType: ethernetCsmacd (6)
ifName:
Max Speed: 12.5 MBytes/s
Ip: 192.168.1.1 ()
### Interface 2 >> Descr: 'mpoa00' | Name: '' | Ip: '0.0.0.0' | Eth: '' ### Target[192.168.1.1_2]: 2:[email protected]: SetEnv[192.168.1.1_2]: MRTG_INT_IP="0.0.0.0" MRTG_INT_DESCR="mpoa00" MaxBytes[192.168.1.1_2]: 64000 Title[192.168.1.1_2]: Traffic Analysis for 2 -- ChangeMe PageTop[192.168.1.1_2]:



喔...原來你的是第二批的(我的是第五批的)...cfgmaker的時候都沒有任何錯誤的話...
哪就表示就快要成功了...會沒有流量圖片出來...是因為你來沒有 perl mrtg mrtg.cfg
大概手動run個2,3次...
然後...
在你的mrtg.cfg加上這兩行
RunAsDaemon: yes
Interval:5
然後..找到你的wperl
start /Dyour\path\mrtg\ ypur\path\perl\wperl mrtg your\path\mrtg\cfg\mrtg.cfg