Coder Social home page Coder Social logo

czbx's Introduction

CZBX

CZBX is an interactive command line tool for Zabbix to get the "Problems" overview inside your terminal!

Supported platforms

At the moment it is only tested on Ubuntu 22.04 with Python 3.11 and Zabbix 6.4.

Installing

Either install using pip or similar:

python3 -m pip install .

Or just follow the usual virtual env way:

python3 -m venv env
./env/bin/pip install -r requirements.txt
./env/bin/python3 czbx.py

Getting started

Authentication

CZBX requires you to use a ZABBIX API token. Create one by following the Zabbix documentation

Specify your Zabbix instance url with ZABBIX_URL and your token with ZABBIX_TOKEN. For example put into your .bashrc:

export ZABBIX_URL="https://localhost"
export ZABBIX_TOKEN="XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

and source it: source ${HOME}/.bashrc to start using CZBX.

Executing SSH on a host

You can press s to execute ssh towards a highlighted host. The executed command can be customized with setting the environment variable $CZBX_SSH_CMD and it is executed as: $CZBX_SSH_CMD HOST.

Tag filtering

You can specify tags to filter on under: $USER_CONFDIR/czbx/tags.json $USER_CONFDIR depends on your platform, for now only Linux is tested, which uses: $HOME/.config

Tags are defined for now as described in Zabbix API problem.get. All tags are AND'ed together. An example would look like:

[
  { "tag": "Tag is like",      "operator": 0, "value": "something" },
  { "tag": "Tag equal to",     "operator": 1, "value": "something" },
  { "tag": "Tag not like",     "operator": 2, "value": "something" },
  { "tag": "Tag not equal to", "operator": 3, "value": "something" },
  { "tag": "Tag exists",       "operator": 4 },
  { "tag": "Tag not exists",   "operator": 5 }
]

Usage

Just start it with czbx or ./env/bin/python czbx.py. Make sure ZABBIX_URL and ZABBIX_TOKEN environment variables are set!

Zabbix data is refreshed every 30s. You can press r to refresh early.

Navigation and Keybindings

Normal navigation via h,j,k,l and arrow keys is supported. For a complete list of key bindings please see:

  • D: toggle debug output in the status line
  • l, right arrow key: Scroll problem view right
  • h, left arrow key: Scroll problem view left
  • j, down arrow key: Move one line down
  • k, up arrow key: Move one line up
  • 0: scroll problem view to the original position
  • CTRL-F: move one page down
  • CTRL-B: move one page up
  • CTRL-L: redraw screen
  • r: refresh Zabbix data (Default: refreshes every 30s)
  • s: execute ssh HOST or $CZBX_SSH_CMD HOST if set. Use HOST on currently highlighted problem
  • o: open Zabbix problem in webbrowser (Buggy at the moment)
  • c: copy Zabbix problem URL into clipboard and show the link in status line
  • t: tag problem (Currently useless)
  • T: tag all problems with provided substring (Currently useless)
  • CTRL-T: untag all provided with provided substring. (Currently useless)
  • a: prompt for acknowledgement message and ack the highlighted problem with it
  • A: toggle acknowledgement flag on the highlighted problem
  • V: print current version in status line
  • ?: Show keybindings in a popup
  • q: Quit CZBX

Known issues

  • Opening a problem in webbrowser might distort the terminal screen
  • Copying to clipboard sometimes fails on WSL
  • A lot more I'm not yet aware of :D

czbx's People

Contributors

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