Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Zabbix Monitoring of stand-alone MongoDB

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Recently, the company has launched several new mongodb projects (stand-alone MongoDB), which need to sit down and monitor. There was a monitoring template before, but it didn't work well. So I went to google again and got the following record.

Reference https://github.com/oscm/zabbix/tree/master/mongodb for stand-alone version

Experimental environment:

CentOS6.8 X86_64

Percona-server-mongodb-3.2.9

Steps:

1. Copy the script mongodb.sh to / etc/zabbix/scripts and modify the environment that suits you.

(our online mongodb does not set a password, and the relevant code is commented out in the script), and chmod adds execution permission.

#! / bin/bash

# # #

# AUTHOR: Neo

# WEBSITE: http://www.netkiller.cn

# Description £ozabbix mongodb monitor

# Note £oZabbix 3.2

# DateTime: 2016-11-23

# # #

# the mongodb of my online environment does not have a password configured, but only the IP that restricts access through iptables

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')

Status=$ (echo "db.serverStatus (). ${index}" | / usr/local/mongodb/bin/mongo admin--port ${PORT} | sed-n '3p')

# checkif the output contains "NumberLong"

If [["$status" = ~ "NumberLong"]; then

Echo $status | sed-n 's/NumberLong (/ / p' | sed-n 's /) / / p'

Else

Echo $status

Fi

2. Copy userparameter_mongodb.conf to / etc/zabbix/zabbix_agentd.d, as shown below:

UserParameter=mongodb.status [*], / etc/zabbix/scripts/mongodb.sh$1 $2 $3 $4 $5

3. Import the monitoring template in the web backend of zabbix, and associate the mongodb host with the template.

The attachment is a package of the three files mentioned above.

The configured monitoring is as shown below:

The monitoring template of the copy set version of MongoDB is in the experiment, no problem and then post it.

Attachment: http://down.51cto.com/data/2366564

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 220

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report