Zabbix は多様な機能を提供していますが、常に機能追加の余地があります。 拡張機能は、Zabbix のソースコードを変更することなく、監視機能を変更および強化するための便利な方法です。
Zabbix の機能は、組み込みの拡張機能オプション(トラッパーアイテム、ユーザーパラメータなど)を使用するか、カスタム拡張機能(ロード可能なモジュール、プラグインなど)を使用または作成することで拡張できます。
このセクションでは、Zabbix を拡張するためのすべてのオプションの概要と参照を提供します。
トラッパーアイテムは、クエリを実行する代わりに受信データを受け入れるアイテムです。 トラッパーアイテムは、長時間実行されるユーザースクリプトの定期的な可用性データやパフォーマンスデータなど、特定のデータをZabbixサーバーまたはプロキシに送信するのに役立ちます。 Zabbixサーバーまたはプロキシへのデータの送信は、Zabbix センダーユーティリティまたはZabbix センダープロトコルを使用して行うことができます。 Zabbixサーバーへのデータの送信は、history.push
APIメソッドを使用しても可能です。
外部チェックは、実行ファイル(シェルスクリプトやバイナリなど)を実行してチェックを実行するためのアイテムです。
外部チェックはZabbixサーバーまたはプロキシ(ホストがプロキシで監視されている場合)によって実行され、監視対象ホスト上でエージェントを実行する必要はありません。
ユーザーパラメータ は、ユーザー定義のコマンド(ユーザー定義キーに関連付けられている)です。実行すると、Zabbix エージェントが稼働しているホストから必要なデータを取得できます。 ユーザーパラメータは、Zabbix で事前定義されていないエージェントまたはエージェント 2 のアイテムを設定するのに役立ちます。
system.run[]
Zabbix エージェントアイテムsystem.run[]
Zabbix エージェントアイテム は、Zabbix エージェントが稼働しているホスト上で実行可能なユーザー定義コマンド(定義済みキー system.run[]
に関連付けられている、例: system.run[myscript.sh]
)のアイテムです。
注: system.run[]
アイテムはデフォルトで無効になっています。使用する場合は、有効化(allowed)し、Zabbix エージェントまたはエージェント 2 の設定ファイル(AllowKey
設定パラメータ)で定義する必要があります。
外部チェック、ユーザーパラメータ、system.run[]
Zabbixエージェントアイテムなどのアイテム内のユーザー定義コマンドは、Zabbixコンポーネントの実行に使用されているOSユーザーから実行されます。 これらのコマンドを実行するには、そのユーザーに適切な権限が必要です。
HTTP エージェント アイテムは、HTTP/HTTPS 経由でデータリクエストを実行するためのアイテムです。 HTTP エージェントアイテムは、HTTP エンドポイントにリクエストを送信して Elasticsearch や OpenWeatherMap などのサービスからデータを取得したり、Zabbix API のステータスや Apache または Nginx Web サーバーのステータスを確認したりするのに役立ちます。 HTTP エージェントアイテム(トラッピングが有効)は、トラッパーアイテム としても機能します。
スクリプトアイテム は、HTTP/HTTPS経由でデータを取得するユーザー定義のJavaScriptコードを実行するためのアイテムです。 スクリプトアイテムは、HTTPエージェントアイテムが提供する機能が不十分な場合に役立ちます。 例えば、複数のステップや複雑なロジックを必要とする厳しいデータ収集シナリオでは、スクリプトアイテムを設定してHTTP呼び出しを行い、受信したデータを処理し、変換された値を2番目のHTTP呼び出しに渡すことができます。
HTTP エージェントアイテムとスクリプトアイテムは Zabbix サーバーとプロキシでサポートされており、監視対象ホスト上でエージェントを実行する必要はありません。
Loadable modules, written in C, are a versatile and performance-minded option for extending the functionality of Zabbix components (server, proxy, agent) on UNIX platforms. A loadable module is basically a shared library used by Zabbix daemon and loaded on startup. The library should contain certain functions, so that a Zabbix process may detect that the file is indeed a module it can load and work with.
Loadable modules have a number of benefits, including the ability to add new metrics or implement any other logic (for example, Zabbix history data export), great performance, and the option to develop, use and share the functionality they provide. It contributes to trouble-free maintenance and helps to deliver new functionality easier and independently of the Zabbix core code base.
Loadable modules are especially useful in a complex monitoring setup. When monitoring embedded systems, having a large number of monitored parameters or heavy scripts with complex logic or long startup time, extensions such as user parameters, system.run[]
Zabbix agent items, and external checks will have an impact on performance. Loadable modules offer a way of extending Zabbix functionality without sacrificing performance.
プラグイン は、ロード可能なモジュール(C言語で記述)の代替手段を提供します。 ただし、プラグインはZabbixエージェント2のみを拡張する手法です。
プラグインは、構造を定義し、1つまたは複数のプラグインインターフェース(Exporter、Collector、Configurator、Runner、Watcher)を実装するGoパッケージです。 Zabbix エージェント 2 では、2 種類のプラグインがサポートされています。
組み込みプラグイン のリストをご覧ください。
独自のプラグインを作成するための手順とチュートリアルについては、開発者センター をご覧ください。
A webhook is a Zabbix media type that provides an option to extend Zabbix alerting capabilities to external software such as helpdesk systems, chats, or messengers. Similarly to script items, webhooks are useful for making HTTP calls using custom JavaScript code, for example, to push notifications to different platforms such as Microsoft Teams, Discord, and Jira. It is also possible to return some data (for example, about created helpdesk tickets) that is then displayed in Zabbix.
Existing webhooks are available in the Zabbix Git repository. For custom webhook development, see Webhook development guidelines.
アラートスクリプト は、Zabbix の メディアタイプ の一種で、Zabbix アラートを処理するための代替手段(スクリプト)を作成するオプションを提供します。 アラートスクリプトは、Zabbix でアラートを送信するための既存のメディアタイプでは満足できない場合に便利です。
カスタムテーマを使用することで、Zabbix フロントエンドの外観を変更できます。独自のテーマの作成と適用方法については、 手順 をご覧ください。
フロントエンドモジュール は、サードパーティ製モジュールを追加したり、独自モジュールを開発したりすることで、Zabbix のフロントエンド機能を拡張するオプションを提供します。 フロントエンドモジュールを使用すると、新しいメニュー項目、それぞれのビュー、アクションなどを追加できます。
A global script is a user-defined set of commands that can be executed on a monitoring target (by shell (/bin/sh) interpreter), depending on the configured scope and user permissions. Global scripts can be configured for the following actions:
Global scripts are useful in many cases. For example, if configured for action operations or manual host actions, you can use global scripts to automatically or manually execute remote commands such as restarting an application (web server, middleware, CRM, etc.) or freeing disk space (removing older files, cleaning /tmp
, etc). Or, another example, if configured for manual event actions, you can use global scripts to manage problem tickets in external systems.
Global scripts can be executed by Zabbix server, proxy or agent.
ユーザー定義コマンドは、Zabbix コンポーネントの実行で使用される OS ユーザーから実行されます。 これらのコマンドを実行するには、このユーザーに適切な権限が必要です。
Zabbix API は、Zabbix フロントエンドの一部である HTTP ベースの API です。 Zabbix API を使用すると、以下の操作を行うことができます。
Zabbix API は、名目上は個別の API にグループ化された複数のメソッドで構成されています。 各メソッドは特定のタスクを実行します。 利用可能なメソッドと、Zabbix API が提供する機能の概要については、 Zabbix API メソッドリファレンス を参照してください。