MongoDB for Zabbix 3.2

This commit is contained in:
netkiller
2016-11-23 18:05:49 +08:00
parent 9589604593
commit ef4e670716
3 changed files with 1380 additions and 0 deletions

23
mongodb/mongodb.sh Normal file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
##################################################
# AUTHOR: Neo <netkiller@msn.com>
# WEBSITE: http://www.netkiller.cn
# Description<6F><6E>zabbix mongodb monitor
# Note<74><65>Zabbix 3.2
# DateTime: 2016-11-23
##################################################
HOST=localhost
PORT=27017
USER=monitor
PASS=chen
index=$(echo $@ | tr " " ".")
status=$(echo "db.serverStatus().${index}" |mongo -u ${USER} -p ${PASS} admin --port ${PORT}|sed -n '3p')
#check if the output contains "NumberLong"
if [[ "$status" =~ "NumberLong" ]];then
echo $status|sed -n 's/NumberLong(//p'|sed -n 's/)//p'
else
echo $status
fi