Tag Archives: perl

Zabbix stopped sending out alerts, HALP!

Zabbix was this reliable friend, always sending you an email, SMS or both when something went down. It sometimes sent you a lot of emails, but you never got angry at Zabbix about that – it was just eager to help you, make sure you did not miss the weekly disaster. But then… last week… Zabbix did not send you an SMS. It did not send you an email. It did not telepathically inform you. But things were DOWN. Server was not RESPONDING.

A fat cat at a table with paws up

Zabbix knew about this. As you review the data, sitting in a dark room, the graphs clearly show the downtime. But there was-no-alert. How is that possible? Wait, what, this is impossible. You can see on the glowing screen that the main action, a crucial piece in getting those alerts, is disabled. That just cannot be, as nobody, NOBODY would ever disable that. How, oh how. Why, oh why.

Zabbix frontend row, showing a disabled action

Continue reading Zabbix stopped sending out alerts, HALP!

Zabbix API example: creating a graph with LLD-generated items

We talked about the second most-voted feature request for Zabbix, an ability to create a graph containing an item for all LLD-created entities like network interfaces or filesystems. There was a teaser on using the Zabbix API to implement something like that. Now is the time to check out a simple example that shows such a functionality using a Perl module for the Zabbix API, Zabbix::Tiny.

Don’t despair if you have never used Zabbix::Tiny or even Perl before – everybody starts that way, and questions are always welcome. You might also want to review the posts that introduced Zabbix::Tiny:

Our script will do these things:

  • connect to the Zabbix API and obtain the host ID
  • query items by the specified key pattern that belong to the specified host (using the host ID obtained earlier)
  • create a custom graph

Our goal is to automatically create graphs with LLD-generated items like these:
Zabbix graph configuration, showing 4 free diskspace items
Continue reading Zabbix API example: creating a graph with LLD-generated items

Using the Zabbix::Tiny to change an item interval based on a trigger.

A relatively common Zabbix feature request is to change the interval of a Zabbix item (how often the item is updated) based on the value of the item.  This post will illustrate how to use a trigger to execute a Perl script to meet this goal.

In this example, the item will be a net.tcp.service[] item to check a web server for an http response. The goal is to have this service checked every 5 minutes (300 seconds) under normal conditions, but if the response indicates that the service is down, change the interval to 60 seconds, which will allow the trigger to get cleared faster.  Additionally, once the service is back up, the interval should return to 5 minutes. Continue reading Using the Zabbix::Tiny to change an item interval based on a trigger.

Perl and Zabbix API – Getting Started

Zabbix’s API has the advantage of being both extremely flexible and extremely powerful.  Scripts that leverage the API can address many of the perceived ‘short-comings’, or commonly requested features of Zabbix.  I wrote the Zabbix::Tiny module as a small interface to the API to abstract some of the boiler plate that I was repeating in each script I was writing without it.  Rather than delve directly into the module and it’s uses, I wanted to first cover a few of the dependencies I rely on for (nearly) every script that I write using the Zabbix API. Any articles that I write in the future will consider these points as implied.

"Perl comes off the wall" with a short history of Perl and a portrait of Larry Wall
Perl comes off the wall. Image from eWeek

Continue reading Perl and Zabbix API – Getting Started