GithubHelp home page GithubHelp logo

teaminternet / python-zabbix-mongodb Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 2.0 18 KB

A Zabbix Trapper for MongoDB Metrics written in Python

License: Apache License 2.0

Python 97.13% Shell 2.87%
zabbix trapper mongodb zabbix-sender metrics

python-zabbix-mongodb's Introduction

python-zabbix-mongodb

This application ships mongodb metrics through zabbix sender. The motivation for this tool was to use most of the preinstalled linux distribution features and don't install much packages to reduce server load by zabbix check. As a template we used these scripts. Thanks to sturi.

This script works as a Zabbix Trapper and collect all MongoDB metrics with one call.

These scripts were tested with the following linux distributions, packages and versions:

  • Ubuntu 16.04 LTS
  • CentOS 7
  • MongoDB 3.2.4
  • Python 2.7
  • Zabbix 3.2 (it works also with zabbix-agent 3.0 and 2.2, the server version is important)

Requirements

  • zabbix-sender
  • python-pymongo
  • zabbix-agent

Installation

Requirements

It is recommended to use the current stable zabbix version. That is why we recommend to use the current zabbix-agent if you start from stack

RedHat/CentOS

yum -y install http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

Ubuntu/Debian

wget http://repo.zabbix.com/zabbix/3.2/debian/pool/main/z/zabbix-release/zabbix-release_3.2-1+wheezy_all.deb
dpkg -i zabbix-release_3.2-1+wheezy_all.deb
apt-get update

After you can install the requirements

RedHat/CentOS

yum -y install zabbix-agent

Debian/Ubuntu

apt-get install zabbix-agent

If you have already installed the previous packages you can start from here

RedHat/CentOS

yum -y install zabbix-sender python-pymongo

Debian/Ubuntu

apt-get install zabbix-sender python-pymongo

Installation of the check itself

Please note that the instructions are different, if you are using zabbix agent 2.2. The structure of configuration is different.

cd /tmp
git clone [email protected]:teaminternet/python-zabbix-mongodb.git
cd python-zabbix-mongodb
mkdir -p /etc/zabbix/scripts
cp -av scripts/* /etc/zabbix/scripts
cp -av zabbix_agentd.d/* /etc/zabbix/zabbix_agentd.d

If you don't use User Authentication in mongodb it is recommended to remove the following line:

db.authenticate(USER,PASSWORD)

This will improve the performance additionally.

Please make sure that you use the following setting in your zabbix_agend.conf

Include=/etc/zabbix/zabbix_agentd.d

Now restart your zabbix agent

systemctl zabbix-agent restart

Importing the Templates

You need to start with the template Template_App_MongoDB_Base.xml. This Template is the basement for the others. The Template Template_App_MongoDB_Config.xml is used for MongoDB Config Server. For MongoS and MongoD Server please use the Template Template_App_MongoDB_ReplicaSet.xml

Additional informations

All main metrics which should be sent to Zabbix are stored in file zbx_vars.txt. You can add or remove if you need. You should always check available metrics by using the following command in the MongoDB client

rs.status()

All Replication informations are handled by the script itself.

TODO

  • Check db.runCommand({"collstats": "oplog.rs"}) for broken oplog

Contribute

Please feel free to open pull requests. Any ideas for improvements are welcome.

License

Apache 2.0

python-zabbix-mongodb's People

Contributors

mariow avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.