mirror of
https://github.com/aljazceru/zabbix.git
synced 2025-12-17 15:04:19 +01:00
MongoDB for Zabbix 3.2
This commit is contained in:
23
mongodb/mongodb.sh
Normal file
23
mongodb/mongodb.sh
Normal 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
|
||||
Reference in New Issue
Block a user