Score:0

is it possible to use zabbix log[] key with zabbix_agent2

nf flag

I have zabbix server 5.4.4 on my linux ubuntu 20.04
Also on my client machine i have installed zabbix_agent2 for 5.4.4 ( there is no zabbix_agent 1 running nor installed )
And zabbix_sender 5.4.4

Im trying to make a new item with log[] key

Using this article: https://www.zabbix.com/documentation/current/manual/config/items/itemtypes/log_items

I changed the configuration file and added server active ip and hostname of the host.

i made a new item with key logrt[/var/log/syslog,error]
Type: Zabbix agent (active)
typeof information: log

i go to the host and latest data but i did not see any.

also i changed the key to logrt[/var/log/syslog] so it can feed any new lines in the log file to the zabbix server, but still i did not get any info

i try

# zabbix_agent2 -t log[/var/log/syslog]

but this is the response

log[/var/log/syslog]                          [m|ZBX_NOTSUPPORTED] [The "log" key is not supported in test or single passive check mode]

And now i am stuck. Can someone help me how to make it work?

us flag
Is your log item valid?
Philip Scot avatar
nf flag
What do you mean by that ? it is normal linux syslog file (/var/log/syslog) you can use `cat`, `tail -f` and other tools to open and read it
us flag
you created the log item in zabbix. If you dig that item up in the host configuration, in the zabbix GUI, does it show as valid? If not, it gives a reason when you hover above the 'invalid' icon.
Score:1
it flag

looking closely at:

https://www.zabbix.com/documentation/5.0/en/manual/config/items/itemtypes/zabbix_agent/zabbix_agent2

https://www.zabbix.com/documentation/current/en/manual/config/items/plugins#plugins-supplied-out-of-the-box

the zabbix_agent2 supports:

  • log
  • log.count
  • logrt
  • logrt.count

however when you try to test it with agent binary:

# echo blabla > /tmp/lala
# /usr/sbin/zabbix_agent2 -t 'vfs.file.contents[/tmp/lala]'
vfs.file.contents[/tmp/lala]                  [s|blabla]

# /usr/sbin/zabbix_agent2 -t 'log[/tmp/lala,error]'
log[/tmp/lala,error]                          [m|ZBX_NOTSUPPORTED] [The "log" key is not supported in test or single passive check mode]

It is as the message states: "log" key is not supported in test or single passive check mode

so since developers for Zabbix did not implement -t or -test switch for items related to log checking - you simply cannot check it on command line, however if you configure the log monitoring and user zabbix is able to access given file - it will work as expected.

If you really need that check option - feel free to submit feature request to zabbix via their public JIRA.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.