#!/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/bin
RETVAL=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
else
echo "/etc/rc.d/init.d/functions does not exist"
exit 0
fi
start() {
if [ -f $LOCKFILE ]
then
echo "$PROG is already running!"
else
echo -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 || failure
echo
return $RETVAL
fi
}
stop() {
echo -n "Stopping $PROG: "
killproc $EXEC
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -r $LOCKFILE && success || failure
echo
}
restart ()
{
stop
sleep 1
start
}
case "$1" in
start)
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
else
echo "/etc/rc.d/init.d/functions does not exist"
exit 0
fi
start ( ) {
if [ -f $LOCKFILE ]
then
echo "$PROG is already running!"
else
echo -n "Starting $PROG : "
nohup $EXEC $OPTIONS > /monitor/n9e/n9e.log 2 >&1 &
RETVAL = $?
[ $RETVAL -eq 0 ] && touch $LOCKFILE && success || failure
echo
return $RETVAL
fi
}
stop ( ) {
echo -n "Stopping $PROG : "
killproc $EXEC
RETVAL = $?
[ $RETVAL -eq 0 ] && rm -r $LOCKFILE && success || failure
echo
}
restart ( )
{
stop
sleep 1
start
}
case "$1 " in
start)
start
; ;
stop)
stop
; ;
status)
status $PROG
; ;
restart)
restart
; ;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit $RETVAL
[ [ 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