Part 94: Using zabbix-cli v3.x for Zabbix administration

What's up, home? part 94 cover image

Those who follow me on LinkedIn might have noticed already that this morning I mentioned about the recently revamped zabbix-cli. The tool has been rewritten from ground up and now it's really cool thing to use! Here are some examples how I can use it for monitoring my home.

Now it looks cool

It has colours, tables, advanced auto-completion, all kinds of goodies! Below is a short snippet from --help option.

zabbix-cli

List and acknowledge alerts through shell

Here's some of the active alerts. Observe how I really have not gotten any better with my facial cream usage since March 2022, I'm hopeless.

Some active alerts

Now, what if I want to acknowledge my facial cream alert? See how the auto-completion already helps me just after few characters.

Acknowledge trigger

Let's continue that until the end.

Acknowledging trigger

Creating a new host

Let's try if we can create new hosts with this tool.

Create host

Great, it worked! But we are not there yet, as without templates Zabbix has no clue how to monitor this new host. No worries, that is easily done via zabbix-cli, too.

Link template to host

Finally, let's remove this dummy demo host.

Remove host

Exporting and importing Zabbix configuration

Now, if you would need to export and import your Zabbix configuration, there's of course many ways of doing that. But zabbix-cli makes it super easy. Just type export_configuration and you're done.

export_configuration

If you don't want to export everything but just only for example your hosts or templates, that's very much doable.

Export help

There would be so much more,  but...

... makes no sense for me to go through each and every option of the new zabbix-cli in this way. You get the idea -- it gives you the flexibility of command line and APIs but is easier to work with than pure API scripting.

For additional machine processing, you can also change the output from human-readable tables to JSON. You can pass your authentication to Zabbix via several different methods. You can skip the zabbix-cli shell part and give commands as one-liners or in batch mode with the set of commands read from a separate text file. there's a lot this small tool can give you. 

Comments

thanks for this awesome tool!

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
Buy me a coffee

Like these posts? Support the project and Buy me a coffee