hermanekt / zabbix-fail2ban-discovery-

51 stars 27 forks source link

Unsupported item key in Zabbix 5.0 #18

Open Tehniels2000 opened 3 years ago

Tehniels2000 commented 3 years ago

I'm getting the error Unsupported item key in Zabbix 5.0. I have the following configuration:

root@server:~# dpkg -l | grep fail2ban ii fail2ban 0.11.1-1 all ban hosts that cause multiple authentication errors

root@server:~# fail2ban-client status Status |- Number of jail: 9 `- Jail list: apache-badbots, apache-botsearch, apache-fakegooglebot, apache-modsecurity, apache-nohome, apache-noscript, apache-overflows, apache-shellshock, sshd

root@server:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.2 LTS Release: 20.04 Codename: focal

root@server:~# dpkg -l | grep zabbix ii zabbix-agent 1:5.0.8-1+focal amd64 Zabbix network monitoring solution - agent ii zabbix-release 1:5.0-1+focal all Zabbix official repository configuration

I downloaded the Version 5.0 template from the zabbix share. I followed all of the installation steps.

hermanekt commented 3 years ago

Hi,

please use template for Ubuntu from this GIT repository. This is problem with os differences. https://github.com/hermanekt/zabbix-fail2ban-discovery-

Tom

Tehniels2000 commented 3 years ago

I tried all of the templates in the repository that you listed. But i can't seem to get it working.

HiTm4n commented 3 years ago

Hello ! Same here, I have Zabbix 5.4 and no template works for me.

HiTm4n commented 3 years ago

More info would be great I imagine, so : Its a debian 10.10 server Zabbix is in last stable version of 5.4 Agent are in : zabbix_agentd (daemon) (Zabbix) 5.4.4 Revision 1765c4f1bc 30 August 2021, compilation time: Jul 22 2021 12:17:45

Copyright (C) 2021 Zabbix SIA License GPLv2+: GNU GPL version 2 or later http://gnu.org/licenses/gpl.html. This is free software: you are free to change and redistribute it according to the license. There is NO WARRANTY, to the extent permitted by law.

This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/).

Compiled with OpenSSL 1.1.1d 10 Sep 2019 Running with OpenSSL 1.1.1d 10 Sep 2019

altmas5 commented 3 years ago

and no template works for me.

Can you add an error message from the items, autodiscovery or template import? I am not sure on where are you facing the issue

pappabetalar commented 2 years ago

I am using Template-Fail2ban50-UBUNTU20.xml, zabbix_agentd (daemon) (Zabbix) 4.0.17 with Ubuntu 20.04.4 LTS and Zabbix 5.4.12. I also get 1 2

hermanekt commented 2 years ago

Unsupported item key = zabbix agent dont have correct configuration. Do you copy correct *.conf file and restart zabbix agent?

hermanekt commented 11 months ago

Hi,

i dont see any update on #18 but you are using test item on item prototype. Please check first howto on: https://github.com/hermanekt/zabbix-fail2ban-discovery-#3-test-zabbix-agent-setting

(on test machine, today i updated 60 template but not for ubuntu, you need to change process key for process status but discover works fine:)

Tom

On 29. 11. 2023, at 15:07, Imre Bertalan @.***> wrote:

I know I'm one year late to the isssue, but I wish to raise my hand. I'm encountering the exact same issue as the others before me. The only difference is that I'm on Ubuntu 22.04. First I had to rewrite the yaml files keys for the process numbers from: key: 'proc.num[f2b/server]' to key: 'proc.num[python3,,,fail2ban-server]', at line 54 and 66. Now I'm trying to fix the discovery of jails. I'm also using your template @hermanekt https://github.com/hermanekt but seems, the key fail2ban.discovery is simply unknown. Please see attached screenshot.

Do you happen to know the issue and a sollution or should I keep trying?

Kepernyokep.2023-11-29.150415.png (view on web) https://github.com/hermanekt/zabbix-fail2ban-discovery-/assets/7765625/38332f72-207b-488e-aa83-4aff31927c39 β€” Reply to this email directly, view it on GitHub https://github.com/hermanekt/zabbix-fail2ban-discovery-/issues/18#issuecomment-1831963031, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACR6QCHWE4NR3QLGOIAFDXDYG46R5AVCNFSM43X4B5NKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBTGE4TMMZQGMYQ. You are receiving this because you were mentioned.

bertalanimre commented 11 months ago

The command from https://github.com/hermanekt/zabbix-fail2ban-discovery-#3-test-zabbix-agent-setting namely sudo -u zabbix zabbix_agent -c /etc/zabbix/zabbix_agent.conf -t fail2ban.discovery is invalid on Ubuntu 22.04. The following works only at least for me: sudo -u zabbix zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf -t fail2ban.discovery and the output is:

root@web-1:~# sudo -u zabbix zabbix_agentd -c /etc/zabbix/zabbix_agent.conf -t fail2ban.discovery
fail2ban.discovery                            [m|ZBX_NOTSUPPORTED] [Unsupported item key.]

Notice that there is a D at the end of the agent binarys name and in the config files name.

hermanekt commented 11 months ago

Are you reading howto? You skip step 1. Your zabbix agent dont have configuration... Please read howto carefully!

bertalanimre commented 11 months ago

Are you reading howto? You skip step 1. Your zabbix agent dont have configuration... Please read howto carefully!

I humbly appologise, I have skipped a line and now it works like a charm. 😡 However, the install guide does need update because all the routes and filenames are not relevant on Ubuntu 22.04 for me and I've not modified the system in depts enought to be so much different than a standard install. Here are the modifications for my system:

1; Set configuration file

Zabbix Agent

wget https://raw.githubusercontent.com/hermanekt/zabbix-fail2ban-discovery-/master/fail2ban.conf -O /etc/zabbix/zabbix_agentd.conf.d/fail2ban.conf

2; Grant access to Fail2Ban

systemctl restart zabbix-agent

3; Test Zabbix Agent setting

Zabbix Agent

root@server:~# sudo -u zabbix zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf -t fail2ban.discovery
fail2ban.discovery                            [t|{"data":[{"{#JAIL}":"nginx-404"}, {"{#JAIL}":"nginx-499"}, {"{#JAIL}":"sshd"}]}]

root@server:~# sudo -u zabbix zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf -t fail2ban.status['sshd']
fail2ban.status[sshd]                         [t|0]

I again say sorry for my mistake and I hope my details will have positive effect on your work. πŸ‘ If not in the readme, then maybe somebody comes by Google and finds this.