Coder Social home page Coder Social logo

cardinalit / go-zabbix-supervisord Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 26 KB

Easy way to find and track supervisor processes by Zabbix

License: GNU General Public License v3.0

Go 100.00%
zabbix supervisor zabbix-agent supervisord supervisorctl supervisor-process zabbix-supervisor-discovery zabbix-discovery zabbix-lld zabbix-userparameter

go-zabbix-supervisord's Introduction

go-zabbix-supervisord

Easy way to find and track supervisor processes by Zabbix.

Requirements

  • Zabbix server >= 4.4.3
  • Zabbix agent >= 4.4.3
  • go >= 1.13.4
  • supervisord >= 3.3.4
  • superuser rights on the host

Usage

~# go-zabbix-supervisord -h
Usage of go-zabbix-supervisord:
  -sock string
    	The full path to the socket
    	 (default "/tmp/supervisor.sock")

~# go-zabbix-supervisord [-sock=/var/run/supervisor.sock] discovery
{
    "data":[
        {"{#PROCESS.NAME}":"001","{#PROCESS.GROUP}":"XXX","{#PROCESS.PID}":52390},
        {"{#PROCESS.NAME}":"321","{#PROCESS.GROUP}":"XX1","{#PROCESS.PID}":52398},
        {"{#PROCESS.NAME}":"123","{#PROCESS.GROUP}":"XX2","{#PROCESS.PID}":52411},
    ]
}

~# go-zabbix-supervisord [-sock=/var/run/supervisor.sock] state.name XX2:123
RUNNING

Installation

  1. Before you should check go version on your host. Just type command:

    ~# go version
    go version go1.13.5 linux/amd64

    NOTE: If golang doesnt installed on the host, you can go to official golang
    site and install it.

  2. You need to check two environment variables that they are set correctly.

    ~# echo $GOROOT; echo $GOBIN
    /usr/local/go
    /usr/local/go/bin
  3. supervisord must be running. Type command:

    ~# service supervisor status
    โ— supervisor.service - Supervisor process control system for UNIX
       Loaded: loaded (/lib/systemd/system/supervisor.service; enabled; vendor preset: enabled)
       Active: active (running) since Wed 2019-12-04 14:05:31 MSK; 5 days ago
       ...
  4. Now you can install go-zabbix-supervisord.

    ~# go get -u github.com/cardinalit/go-zabbix-supervisord

    After installing the dependencies, the executable will be installed in $GOBIN path.
    The executable will be called go-zabbix-supervisord. You can check it:

    ~# go-zabbix-supervisord help [-h | --help]
    Usage of go-zabbix-supervisord:
      -sock string
        	The full path to the socket
        	 (default "/tmp/supervisor.sock")
  5. You should create (or copy from my repository) sudoers.d exception file for
    zabbix user, containing the following text:

    zabbix ALL=(ALL) NOPASSWD:/usr/local/go/bin/go-zabbix-supervisord
    Defaults:zabbix !requiretty
    

    For copy, just type:

    ~# cp ~/go/src/github.com/cardinalit/go-zabbix-supervisord/zabbix \
       /etc/sudoers.d/
  6. Import zbx_export_template.xml to you Zabbix server.

  7. Create (or copy from my repository) file userparameter_supervisord.conf
    to Zabbix agent path on the host. For copy, just type:

    ~# cp ~/go/src/github.com/cardinalit/go-zabbix-supervisord/userparameter_supervisord.conf \
       /etc/zabbix/zabbix_agentd.d/
  8. Restart your Zabbix agent on the host.

go-zabbix-supervisord's People

Contributors

cardinalit avatar

Stargazers

 avatar  avatar

Watchers

 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.