四、自定义模块
1.首先建立一个能获取数据的脚本
- vim tcpconn.sh
- #!/bin/bash
- #
- # $1:homename or IP
- # $2:snmp community
- SNMPNETSTAT=/usr/bin/snmpnetstat
- ESTABLSHIED=`$SNMPNETSTAT -v 2c -c $2 -Can -Cp tcp $1 | grep -i 'established' wc -l`
- echo -n "established:$ESTABLSHIED"
然后给他加个执行权限
chmod +x ./tcpconn.sh
cp tcpconn.sh /web/vhosts/cacti/scripts/
然后进入cacti页面
2.点击data input methods,点add

然后点击create

继续添加下面新出现的input fields

添加output fields

