Since Jeyzer 3.2
The Zabbix publisher permits to send monitoring events to a Zabbix server.
Technically, the Jeyzer Monitor will call periodically the Zabbix sender to publish the monitoring events through a Zabbix input file.
The Zabbix integration can be done at installation time through the Jeyzer Ecosystem Installer or manually afterwards using environment variables (which permits a greater flexibility and control).
Important : there must be at least one monitoring event to trigger the sending because Zabbix does not process empty input content.
Prerequisites
For Zabbix, you must :
- Install the Zabbix_sender executable on the client side.
Make it executable and accessible from the Jeyzer Monitor. - Setup a Zabbix trapper on the server
Define a new key (= type of events) to monitor. - Setup your own way to process the incoming events in Zabbix : alerts triggering, display, parsing..
Please refer to the Zabbix documentation for more details.
Configuration
Jeyzer monitoring profile
Edit the Jeyzer Monitoring configuration in your master profile, often referred as <profile name>_monitor.xml
.
Add this line to your Jeyzer Monitoring configuration in the publisher section :
<!-- Event distribution -->
<publishers>
<!-- Send updates to Zabbix -->
<zabbix zabbix_config_file="${JEYZER_BASE_MASTER_PROFILES_DIR}/${JEYZER_TARGET_PROFILE}/monitor/publishers/zabbix/zabbix.xml"/>
You may replace the JEYZER_BASE_MASTER_PROFILES_DIR with the one defined for your company repository.
Copy the the profiles/external/master/template/monitor/publishers/zabbix/zabbix.xml
file in the monitor/publishers/zabbix
directory of your master profile.
This file references 2 other files :
- The Zabbix input file template : zabbix_data.vm
- The zabbix connectivity setup : zabbix_setup.xml
Those files are located by default in the Jeyzer standard configuration, under ${JEYZER_ANALYZER_CONFIG_DIR}/monitor/publishers/zabbix
.
You may override it to refer to your own configuration.
In such case, copy the above file(s) in your desired location to tune it afterwards.
Note that you can define several Zabbix publishers.
Connectivity
Events are published within a Zabbix “host” scope (tenant), which represents the server to monitor in Zabbix.
Ths Zabbix “host” must be set with the JEYZER_TARGET_NAME
environment variable.
The Zabbix publisher configuration is defined in the zabbix_setup.xml
file.
By default, the Jeyzer installer can configure the Zabbix connectivity.
You may also define it at later stage – as described hereafter – either by adding the 4 Zabbix connectivity parameters or the path to the Zabbix agent configuration file.
Edit the zabbix_setup.xml
.
Zabbix connectivity : activate the configuration block that contains the ZABBIX_HOST
variables.
Comment out the other block (which is set by the installer).
Those 4 environment variables must be set :
ZABBIX_SENDER_PATH
: the zabbix_sender executable pathZABBIX_HOST
: the Zabbix server hostZABBIX_PORT
: the Zabbix server portZABBIX_SOURCE_IP
: the Zabbix client IP address
Zabbix agent : activate the configuration block that contains the ZABBIX_AGENT_CONF_PATH
environment variables.
Comment out the other block (which is set by the installer).
Those 3 environment variables must be set :
: the zabbix_sender executable pathZABBIX_SENDER_PATH
ZABBIX_AGENT_CONF_PATH
: the Zabbix agent configuration file pathZABBIX_SOURCE_IP
: the Zabbix client IP address
To activate the publisher, set the JEYZER_MONITOR_ZABBIX_ENABLED
to true.
To validate the communication with Zabbix, check the Jeyzer log file (located in the ${JEYZER_OUTPUT_DIR}/log/jeyzer_monitor-${JEYZER_TARGET_PROFILE}.log)
: it contains explicit info traces, including the final Zabbix sender command line and communication results.
Note that you can override the default Zabbix sender parameters in the zabbix_setup.xml
file.
Zabbix input file
The Jeyzer Monitor will call the Zabbix sender to publish the monitoring events through an input file which contains key value pairs.
This input file is defined as per the Zabbix standards.
The input file is generated based on a Velocity template that you can customize.
See the above monitoring profile configuration to get the default input file location and how to override it.
By default it contains :
foreach( $event in $events_list ) "$application_id" "user.action" "{\"HOSTNAME\": \"$host_name\", \"TENANT_ID\": \"$application_id\", \"ACTION\": \"#nameExtraInfo( $event )-$event.ExtId\", \"OPERATION\": \"#operation( $event )\", \"CONTENTION_TYPE\": \"#contention_type( $event )\", \"START_DATE\": \"$event.StartDate\", \"END_DATE\": \"$event.EndDate\", \"DURATION\": \"$event.Duration\"}"
The application_id variable is the Zabbix
host context (or tenant) and corresponds also to the JEYZER_TARGET_NAME
.
The “user.action” is an arbitrary key name which must be referenced in the Zabbix server. You may change it.
The “${\”HOSTNAME\”… is the value, JSON formatted for direct integration in Grafana.
It refers here several event fields. You may customize it.
Input files can be archived for debugging purposes in the JEYZER_RECORD_DIRECTORY/monitor/zabbix-inputs.
This is controlled in the zabbix_setup.xml
file :
<input_file storage_directory="${JEYZER_RECORD_DIRECTORY}/monitor/zabbix-inputs" keep="24h">