Giter Site home page Giter Site logo

zabbify's Introduction

zabbify

a script to automatically integrate (crontab) scripts with Zabbix

Picture the tipical scenario when you have an infrastructure with many servers, with many scripts running with crontab and doing all sort of tasks at all time.

You probably keep an eye on them with thousands of cryptic emails that you tend to ignore until something bad happens.

I wrote this little script to help integrate these kind of scripts with Zabbix, so that you can remove these emails and clean up your mailbox.

Examples

[email protected]

00 05 * * * /usr/bin/mysqldump --databases zabbix --single-transaction | /bin/gzip > /opt/backups/mysql/zabbix/zabbix.sql.gz 2> /dev/null

You can integrate this script with Zabbix by changing the above line to

00 05 * * * zabbify "/usr/bin/mysqldump --databases zabbix --single-transaction | /bin/gzip > /opt/backups/mysql/zabbix/zabbix.sql.gz 2> /dev/null"

THAT'S ALL!!!

zabbify will

  • create an item exit_value[mysqldump] on Zabbix and send the exit status of the script
  • create an item output[mysqldump] on Zabbix and send the output of the script
  • create a trigger {servername:exit_value[mysqldump].last(0)}#0 to go off when the script exits with a non 0 status

IMPORTANT: Zabbix Server needs a couple of minutes from when the items are created to when you can use them to send data to. Please run it a few times and then wait if you do not see them being populated.

INSTALLATION

  • Create a config file in /etc/zabbify.conf like the one provided as example
  • Install zabbify in a convenient location (/usr/bin) and give appropriate permissions (chmod 555 /usr/bin/zabbify)
  • The script depends on the zabbix_api and zbxsend libraries. Please install them in the PYTHONPATH
  • zbxsend will not work with Python3. The version I have included adds some minor fixes. Will send the patch to the author soon.

TEST

  • Run zabbify with test scripts to see if it works. Good examples are:
zabbify /bin/true
zabbify /bin/false
zabbify echo test
zabbify --itemname true /bin/false
zabbify "cat somefile | grep something"
  • If you have problems, change the error level in /etc/zabbify.conf to DEBUG and rerun

More information (soon) in the wiki page

Please test it and report problems and suggestion to me

zabbify's People

Contributors

ademariag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

spscream dearlove

zabbify's Issues

Zabbify test not working

I followed the instructions but couldn't get it to work. At least I am not sure I am getting a result I can consider good. This is what I am getting.

zabbify "cat /root/Downloads/zabbify-master/Zabbify/test.txt | grep me"
Traceback (most recent call last):
File "/usr/bin/zabbify", line 322, in
main()
File "/usr/bin/zabbify", line 302, in main
if aliasname is None:
NameError: global name 'aliasname' is not defined

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.