Skip to main content

Examples from the new version of Zabbix-CLI - v.1.6.0

Just before Christmas we launched a new version of the Zabbix-CLI client we have developed at The University of Oslo.

Zabbix-CLI 1.6.0 implements some new options for configuring the client and some new commands to handle maintenance periods in Zabbix via Zabbix-CLI.

To read about all the possibilities available to configure this client, you can use the Zabbix-CLI manual found at Github: https://github.com/usit-gd/zabbix-cli/blob/master/docs/manual.rst#configuration

The new commands for managing maintenance periods are not a full implementation of the maintenance functionality that Zabbix has. A full implementation would have complicated these commands too much and not everyone needs all the options available. To define advanced maintenance definitions you still have to use the Zabbix web interface.

A maintenance job for a machine or group of machines is configured in Zabbix by defining a maintenance definition containing one or more maintenance periods.

Our implementation of this functionality in Zabbix-CLI creates a maintenance definition with a maintenance period which equals the active period of the maintenance definition itself. This simplifies a lot the handling of maintenance jobs via Zabbix-CLI.

For standard definitions you can use these commands via Zabbix-CLI:

create_maintenance_definition

Use the command "help create_maintenance_definition" in zabbix-CLI for details:

[zabbix-cli rafael@zabbix-ID]$ create_maintenance_definition
--------------------------------------------------------
# Maintenance name [zabbixCLI-83B3A7A9A]:
# Maintenance description []: Testing maintenance
# Host/Hostgroup []: zabbix.uio.no
# Time period [1 hour]: 3hours
--------------------------------------------------------

[Done]: Maintenance definition with name [zabbixCLI-83B3A7A9A] created

[zabbix-cli rafael@zabbix-ID]$ create_maintenance_definition
--------------------------------------------------------
# Maintenance name [zabbixCLI-3DA86F2F8]:
# Maintenance description []: Testing maintenance
# Host/Hostgroup []: zabbix.uio.no
# Time period [1 hour]: 2017-01-10T12:00 to 2017-01-11T17:00
--------------------------------------------------------

[Done]: Maintenance definition with name [zabbixCLI-3DA86F2F8] created

show_maintenance_definitions

Use the command "help show_maintenance_definitions" in Zabbix-CLI for details.

[zabbix-cli rafael@zabbix-ID]$ show_maintenance_definitions
--------------------------------------------------------
# MaintenanceID [*]:
# Hostgroups [*]:
# Hosts [*]: zabbix.uio.no
--------------------------------------------------------
+----+---------------------+-------------+--------+----------------------+---------------+------------+----------------------+
| ID | Name                |     Type    | State  |          To          | Hostnames     | Hostgroups | Description          |
+----+---------------------+-------------+--------+----------------------+---------------+------------+----------------------+
| 60 | zabbixCLI-83B3A7A9A | With DC (0) | Active | 2017-01-03T11:48:00Z | zabbix.uio.no |            | Testing maintenenace |
+----+---------------------+-------------+--------+----------------------+---------------+------------+----------------------+
| 61 | zabbixCLI-3DA86F2F8 | With DC (0) | Active | 2017-01-11T16:00:00Z | zabbix.uio.no |            | Testing maintenance  |
+----+---------------------+-------------+--------+----------------------+---------------+------------+----------------------+

show_maintenance_periods

Use the command "help show_maintenance_periods" in Zabbix-CLI for details.

[zabbix-cli rafael@zabbix-ID]$ show_maintenance_periods
--------------------------------------------------------
# MaintenanceID [*]: 60,61
--------------------------------------------------------
+-------+---------------------+-------+------+---------+-------+-------+----------------------+------------+----------------+--------------+---------------+------------+
| DefID | DefName             | PerID | Days | Dayweek | Every | Month |      Start_date      | Start_time |     Period     |   PerType    | Hostnames     | Hostgroups |
+-------+---------------------+-------+------+---------+-------+-------+----------------------+------------+----------------+--------------+---------------+------------+
|    60 | zabbixCLI-83B3A7A9A |   68  |  0   |    0    |   1   |   0   | 2017-01-03T08:48:00Z |  0:00:00   |    3:00:00     | One time (0) | zabbix.uio.no |            |
+-------+---------------------+-------+------+---------+-------+-------+----------------------+------------+----------------+--------------+---------------+------------+
|    61 | zabbixCLI-3DA86F2F8 |   69  |  0   |    0    |   1   |   0   | 2017-01-10T11:00:00Z |  0:00:00   | 1 day, 5:00:00 | One time (0) | zabbix.uio.no |            |
+-------+---------------------+-------+------+---------+-------+-------+----------------------+------------+----------------+--------------+---------------+------------+

remove_maintenance_definition

Use the command "help remove_maintenance_definition" in Zabbix-CLI for details.

[zabbix-cli rafael@zabbix-ID]$ remove_maintenance_definition
--------------------------------------------------------
# maintenanceID: 60,61
--------------------------------------------------------

[Done]: Maintenance definitions with IDs: [60,61] removed

Command-line

One can also execute these commands directly via the command-line without starting a Zabbix-CLI shell.

[rafael@host ~]$ zabbix-cli -C "create_maintenance_definition '' 'Testing maintenance' 'zabbix.uio.no' '3 hours'"

[Done]: Maintenance definition with name [zabbixCLI-413E1C518] created

[rafael@bbking ~]$ zabbix-cli -C "show_maintenance_definitions '' '' 'zabbix.uio.no'"
+----+---------------------+-------------+--------+----------------------+---------------+------------+---------------------+
| ID | Name                |     Type    | State  |          To          | Hostnames     | Hostgroups | Description         |
+----+---------------------+-------------+--------+----------------------+---------------+------------+---------------------+
| 62 | zabbixCLI-413E1C518 | With DC (0) | Active | 2017-01-03T12:05:00Z | zabbix.uio.no |            | Testing maintenance |
+----+---------------------+-------------+--------+----------------------+---------------+------------+---------------------+

[rafael@bbking ~]$ zabbix-cli -C "remove_maintenance_definition 62"

[Done]: Maintenance definitions with IDs: [62] removed

 

Comments

Jacobe (not verified)

Sun, 18/02/2018 - 09:16

I also face this type of problems during coding and I try to solve it through different books. Some seniors also help me to find the solution.More ever I join http://www.aubestsessays.com/ and from a forum, I get the solution as well.

Charlotte David (not verified)

Wed, 21/02/2018 - 06:16

All you lean toward for an immense on the spotting group is a capable remote switch and possibly few access factors devices if the motel is substantial. Anon the spot switch empower at least ninety 9 associations inside a similar time. you may want to have an association with an awesome band to stream into on your switch. http://www.assignmentdoer.com/

Add new comment

The comment language code.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.