My monitoring app has its own CLI. Does yours?

Like I’ve mentioned previously, here and here, I’m a huge fan of Zabbix. It’s a truly open source monitoring system that is easy to extend and customize. One of the most novel of those extensions is Zabcon. Zabcon is a command-line interpreter for the Zabbix API. It provides the user a way to execute simple, ad-hoc commands on the Zabbix Server and get the results back. It’s a great, great thing.

Zabcon, written in Ruby, abstracts out all of the API calls, responses, formatting, etc. and lets your scripts just be about getting your data out. Things make more sense inside your scripts. Your time is saved, and your data is easier to retrieve.

get host help show=[host,ip]
Host result set
+————————————————–+—————–+
| host | ip |
+————————————————–+—————–+
| rox-it-cisco1800-prod-01.5amsolutions.com | 192.168.140.1 |
| sfo-abrc-virt-prod-01.5amsolutions.com | 192.168.180.60 |
| sfo-sci-pytable-dev-01.5amsolutions.com | 0.0.0.0 |
| iad-it-sw-prod-01.5amsolutions.com | 192.168.170.3 |
| iad-it-sw-prod-02.5amsolutions.com | 192.168.170.4 |
| iad-it-django-dev-01.5amsolutions.com | 192.168.170.10 |
| iad-it-virt-prod-03.5amsolutions.com | 192.168.170.44 |
| iad-it-virt-prod-02.5amsolutions.com | 192.168.170.42 |

| sfo-it-virt-prod-01.5amsolutions.com | 192.168.180.40 |
| sfo-it-amu-prod-01.5amsolutions.com | 192.168.184.86 |
| sfo-fhh-webapp-ci-01.5amsolutions.com | 192.168.182.141 |
| sfo-glassbox-ivygbm-qa-01.5amsolutions.com | 192.168.183.130 |
| sfo-fhh-crcra-ci-01.5amsolutions.com | 192.168.182.166 |
| sfo-it-ldapdnsweb-stage-01.5amsolutions.com | 192.168.183.101 |
| sfo-it-ithudson-prod-01.5amsolutions.com | 192.168.180.35 |
+————————————————–+—————–+
100 rows total

And you have a listing of all servers listed in Zabbix and their IP address.

Full commands can be found here. A summary of actions that can be executed on Zabbix are:

command description
get user Retrieves user information from the server
add user
delete user
get host Retrieves host information from the server
add host
get item Retrieves item information from the server
add item
raw api Forms an API call from passed method and its parameters
raw json Sends a raw JSON string to Zabbix API without any syntax check. Variable $auth can be used to supply authentication token

As I continue to explore Zabbix, Zabcon will often be used to illustrate how things happen inside the server. It’s an incredible tool, and well worth your time. It’s an invaluable tool, effectively giving Zabbix its own prompt.

About these ads

Something to Add?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s