Search code examples
logstashzabbixlogstash-configuration

Is logstash zabbix output just for sending events?


I want to send values like CPU etc to zabbix using the zabbix output plugin, but i can't seem to get it working. After some googling I start to wonder if the plugin is actually for sending event and not values? My logstash config is:

input{
   rabbitmq{
#all needed rabbit values
   add_field => { "host_name" => "Zabbix server"
                  "key" => "CPU idle time"
                  "zabbix_value" =>"5"
   }
  }
}
output{
  zabbix{
      zabbix_host => "host_name"
      zabbix_key =>"key"
      zabbix_value => "zabbix_value"
  }
}

My error is zabbix server at localhost rejected all items sent.

We can't use zabbix agents since we are not allowed to open any ports and we want the values to be send from monitored machine to rabbitmq and then be picked up by logstash and the be pushed to zabbix server. Is it possible?

Thank you in advance


Solution

  • Logstash zabbix plugin uses Zabbix Sender protocol, which connects to port 10051 of Zabbix server. If your monitoring target can't connect to the port due to your security policy, it's not possible to use zabbix plugin.

    If the port is accessible, it's possible to send data to Zabbix server by the following steps.

    1. Create Zabbix trapper item for an existing zabbix host on zabbix admin site.
    2. Specify the key of the trapper item in logstash config as below:

    output { zabbix{ zabbix_host => "zabbixhost1" zabbix_key => "trapperkey" zabbix_value => "somevalue" zabbix_server_host => "Zabbix server IP" zabbix_server_port => "10051" } } You don't need to install zabbix agent on the monitoring target as long as you have a zabbix host named "zabbixhost1" with a trapper key named "trapperkey" on your Zabbix server.