Coder Social home page Coder Social logo

auto-add-services's Introduction

About me

I am developer as hobby. For me automate boring stuff is a pleasure, no more operational work :)

"Live as if you were to die tomorrow. Learn as if you were to live forever" Mahatma Gandhi.

Donate

if you like the project and it help you, you could give me some reward for that.

Donate via PayPal Top Donation Lastest Donation
- -

auto-add-services

Zabbix Script - Sync IT Service with Trigger contain a TAG_NAME.

Creating IT Services in Zabbix could be exausting in an envirroment with many Hosts and Triggers.
This Script allow you to manage the creation of IT Services automatically based on Triggers TAG NAME.
The services are created hierarchically in 3 levels.
The first level correspond to Host Group that has Hosts with Triggers contain a certain TAG NAME . The second level correspond to Hosts that has Triggers with a certain TAG NAME. Finally, the third level is services that correspond to Triggerrs. The Hierarchy is like that:

  • HOST_GROUP_NAME |GroupID=#ID|
    • HOST_NAME |HostID=#ID|
      • TRIGGER_NAME

Hierarchy_sample

How It Works

The script scan all HOST_GROUP defined in config file then scan all host that has certain trigger with certain TAG_NAME.
These triggers that have a TAG_NAME will be added to calculate the SLA. So the TAG_NAME has to be add in trigger, example:

Trigger_Sample
The above trigger was configurated to has "SLA" TAG_NAME, also is needed to configure in auto-add-services the variable TAG_NAME as "SLA"
After execute the script the IT Services will be like that:

Hierarchy_sample

Requirements

  • python2 or python3
  • zabbix-api

Installation

yum install rpm-python-4.11.3-35.el7.x86_64
yum install python2-pip-8.1.2-8.el7.noarch
pip install zabbix-api
git clone https://github.com/dboc/auto-add-services.git ./somedirectory

Config

The config file has two collumns separated with ";" and its mandatory.
The first column is the name of group host.
The second is the algorithm used to calc SLA, possible values are:
0 - do not calculate;
1 - problem, if at least one child has a problem;
2 - problem, if all children have problems.

Example of config file:

GROUP_NAME_A;1
GROUP_NAME_B;1
GROUP_NAME_C;2
GROUP_NAME_D;2

Usage example

The config file has to be in the same directory of script with the name "config".

Modify the follow variables in auto-add-services.py to fit your needs.

# Parameters
SERVER = "http://127.0.0.1" # Your Zabbix IP
USERNAME = "your_username"
PASSWORD = "your_pass"
TAG_NAME = "SLA"

After that you could execute the script

./somedirectory/auto-add-services.py

Release History

  • 0.1
    • Initial code

Contributing

  1. Fork it (https://github.com/dboc/auto-add-services/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

auto-add-services's People

Contributors

everaldoscabral 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.