#!/bin/bash
#Create by:zhangyongze
#为什么不问问神奇的海螺呢丶
# chkconfig: 2345 55 25
# description: categraf
#export ORACLE_HOME=/usr/lib/oracle/12.2/client64
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/binRETVAL=0
#程序名
PROG="categraf"
#程序执行文件
EXEC="/monitor/categraf-v0.3.45-linux-amd64-with-cgo-plugin/categraf"
#锁文件
LOCKFILE="/var/lock/subsys/$PROG"
#参数
OPTIONS="-configs /monitor/categraf-v0.3.45-linux-amd64-with-cgo-plugin/conf"# Source function library.
if [ -f /etc/rc.d/init.d/functions ]; then. /etc/rc.d/init.d/functions
elseecho "/etc/rc.d/init.d/functions does not exist"exit 0
fistart() {if [ -f $LOCKFILE ]thenecho "$PROG is already running!"elseecho -n "Starting $PROG: "nohup $EXEC $OPTIONS >/monitor/categraf-v0.3.45-linux-amd64-with-cgo-plugin/crunlog.log 2>&1 &RETVAL=$?[ $RETVAL -eq 0 ] && touch $LOCKFILE && success || failureechoreturn $RETVALfi
}stop() {echo -n "Stopping $PROG: "killproc $EXECRETVAL=$?[ $RETVAL -eq 0 ] && rm -r $LOCKFILE && success || failureecho
}restart ()
{stopsleep 1start
}case "$1" instart)start;;stop)stop;;status)status $PROG;;restart)restart;;*)echo "Usage: $0 {start|stop|restart|status}"exit 1
esac
exit $RETVAL
#!/bin/bash
RETVAL=0
PROG="n9e"
EXEC="/monitor/n9e/n9e"
LOCKFILE="/var/lock/subsys/$PROG"
OPTIONS="-configs /monitor/n9e/etc"
if [ -f /etc/rc.d/init.d/functions ]; then. /etc/rc.d/init.d/functions
elseecho "/etc/rc.d/init.d/functions does not exist"exit 0
fistart() {if [ -f $LOCKFILE ]thenecho "$PROG is already running!"elseecho -n "Starting $PROG: "nohup $EXEC $OPTIONS >/monitor/n9e/n9e.log 2>&1 &RETVAL=$?[ $RETVAL -eq 0 ] && touch $LOCKFILE && success || failureechoreturn $RETVALfi
}stop() {echo -n "Stopping $PROG: "killproc $EXECRETVAL=$?[ $RETVAL -eq 0 ] && rm -r $LOCKFILE && success || failureecho
}restart ()
{stopsleep 1start
}case "$1" instart)start;;stop)stop;;status)status $PROG;;restart)restart;;*)echo "Usage: $0 {start|stop|restart|status}"exit 1
esac
exit $RETVAL```bash[[instances]]
agents = [ "udp://xxx.xxx.xx.xxx:161"]
labels = { region="办公", lable="[办公]深信服(备)AC_MGT" }
version = 2
community = "xxxxx"
agent_host_tag = "ip"
timeout = "5s"
retries = 1
interval_times = 4[[instances.field]]
oid = "SNMPv2-MIB::sysUpTime.0"
name = "uptime"[[instances.field]]
oid = "SNMPv2-MIB::sysName.0"
name = "source"
is_tag = true[[instances.table]]
oid = "IF-MIB::ifTable"
name = "interface"
index_as_tag = true
inherit_tags = ["source"][[instances.table.field]]
oid = "IF-MIB::ifDescr"
name = "ifDescr"
is_tag = true