Snmp 如何使用Cacti为连接到路由器/交换机的设备创建(上传/下载)图表?

Snmp 如何使用Cacti为连接到路由器/交换机的设备创建(上传/下载)图表?,snmp,net-snmp,cacti,Snmp,Net Snmp,Cacti,我正在尝试为连接到光纤线路终端(OLT)的ONU(客户端)设备创建图形。可以创建OLT(上游)的图形,但我坚持为连接到OLT的每个设备创建图形。让它正常工作:DataInputMethod应该是script/command。获取OLT snmp数据并将其输出到文件的脚本[我每2分钟使用cron运行此脚本一次]数据保存到/tmp目录中的相应OLT文件中 稍后,我使用另一个脚本提取ONU(连接到每个OLT的客户端设备,用于提取下载和上载数据) 读取onu脚本为每个客户端设备创建图形。将此脚本添加到c

我正在尝试为连接到光纤线路终端(OLT)的ONU(客户端)设备创建图形。可以创建OLT(上游)的图形,但我坚持为连接到OLT的每个设备创建图形。

让它正常工作:DataInputMethod应该是script/command。获取OLT snmp数据并将其输出到文件的脚本[我每2分钟使用cron运行此脚本一次]数据保存到/tmp目录中的相应OLT文件中

稍后,我使用另一个脚本提取ONU(连接到每个OLT的客户端设备,用于提取下载和上载数据)

读取onu脚本为每个客户端设备创建图形。将此脚本添加到cacti datainputtype字段中

# read_onu_snmp.sh

#!/bin/sh
#
# Find a user's in/out traffic by username.
# Syntax:
# olt_snmp <olt> <ontid>

OLT=$1
ONTID=$2

UPLOAD=`/bin/grep ${ONTID} /tmp/${OLT}_upload_data | cut -d':' -f4 | sed 's/ *//g'`
DOWNLOAD=`/bin/grep ${ONTID} /tmp/${OLT}_download_data | cut -d':' -f4 | sed 's/ *//g'`

echo "in_traffic:${UPLOAD} out_traffic:${DOWNLOAD}"
#read_onu_snmp.sh
#!/垃圾箱/垃圾箱
#
#按用户名查找用户的输入/输出流量。
#语法:
#olt_snmp
OLT=1美元
ONTID=$2
UPLOAD=`/bin/grep${ONTID}/tmp/${OLT}上传数据| cut-d':'-f4 | sed's/*//g'`
下载=`/bin/grep${ONTID}/tmp/${OLT}下载数据| cut-d':'-f4 | sed's/*//g'`
echo“输入流量:${UPLOAD}输出流量:${DOWNLOAD}”
# read_onu_snmp.sh

#!/bin/sh
#
# Find a user's in/out traffic by username.
# Syntax:
# olt_snmp <olt> <ontid>

OLT=$1
ONTID=$2

UPLOAD=`/bin/grep ${ONTID} /tmp/${OLT}_upload_data | cut -d':' -f4 | sed 's/ *//g'`
DOWNLOAD=`/bin/grep ${ONTID} /tmp/${OLT}_download_data | cut -d':' -f4 | sed 's/ *//g'`

echo "in_traffic:${UPLOAD} out_traffic:${DOWNLOAD}"