Zabbix Agent with PSK Encryption and RAID Check

Thanks to @stephdl we have a new nethserver-zabbix-agent module. It can be installed standalone and is required by the new server package.

New features:

  • PSK Encryption
  • RAID check

Please test it. We appreciate your feedback!

Zabbix repo install:

yum -y install https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

Agent installation:

yum -y install https://mrmarkuz.dynu.net/mirror/devtest/nethserver-zabbix-agent-0.0.1-1.ns7.noarch.rpm

Server installation:

yum -y install https://mrmarkuz.dynu.net/mirror/devtest/nethserver-zabbix-0.0.1-9.ns7.noarch.rpm

For more infos check out the wiki.

3 Likes

Just like to inform you. I tried to install the agent with the command from the wiki:

But, as you see…

1 Like

For testing you need to install the agent the following way because it’s not in my repo yet.

yum -y install https://mrmarkuz.dynu.net/mirror/devtest/nethserver-zabbix-agent-0.0.1-1.ns7.noarch.rpm

2 Likes

Thank you Markus for you work. Its up and running :slightly_smiling_face: :clap:

2 Likes

In few day i’ll install mine too.

1 Like

thank mrmarkus to bring us a nice software like this…just a way to thank you, help the development.

1 Like

Got a problem on one of my server after a reboot:

I just rebooted it, nothing else :thinking: The server is in the same Subnet…

does the firewall of the computer hosting agent to allow the dialog on port 10050?

1 Like

agent log please :smiley:

It worked before the reboot…

[root@zabbix zabbix]# cat /var/log/zabbix/zabbix_server.log | grep srv1.mydomain.lan
  1834:20210316:165431.668 cannot send list of active checks to "192.168.xx.xxx": host [srv1.mydomain.lan] not found
  1829:20210316:165656.089 enabling Zabbix agent checks on host "srv1.mydomain.lan": host became available
  1818:20210316:172738.656 item "srv1.mydomain.lan:vfs.dev.read.await[sda]" became not supported: Cannot evaluate expression: "Cannot evaluate function "last()": not enough data.".
  1820:20210316:172739.658 item "srv1.mydomain.lan:vfs.dev.write.await[sda]" became not supported: Cannot evaluate expression: "Cannot evaluate function "last()": not enough data.".
  1822:20210316:173738.223 item "srv1.mydomain.lan:vfs.dev.read.await[sda]" became supported
  1817:20210316:173739.223 item "srv1.mydomain.lan:vfs.dev.write.await[sda]" became supported
  1861:20210318:170903.928 Zabbix agent item "vfs.fs.size[/,used]" on host "srv1.mydomain.lan" failed: first network error, wait for 15 seconds
  1869:20210318:170923.614 Zabbix agent item "vfs.fs.size[/,total]" on host "srv1.mydomain.lan" failed: another network error, wait for 15 seconds
  1869:20210318:170938.815 Zabbix agent item "vfs.fs.size[/,pused]" on host "srv1.mydomain.lan" failed: another network error, wait for 15 seconds
  1869:20210318:170954.083 temporarily disabling Zabbix agent checks on host "srv1.mydomain.lan": host unavailable

You gave me the server log, please go to the agent host and look what is wrong in the agent log

Sorry, this is from the Nethserver zabbix-client:

zabbix_agentd [3571]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory
zabbix_agentd [3584]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory
zabbix_agentd [3598]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory
zabbix_agentd [3623]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory
zabbix_agentd [3644]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory
zabbix_agentd [3659]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory
zabbix_agentd [3674]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory
zabbix_agentd [3728]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory
zabbix_agentd [3742]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory
zabbix_agentd [3757]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory
zabbix_agentd [3774]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory
zabbix_agentd [3787]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory
zabbix_agentd [3802]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory
zabbix_agentd [3835]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory
zabbix_agentd [3850]: cannot create PID file [/var/run/zabbix/zabbix_agentd.pid]: [2] No such file or directory
ll /var/run/zabbix/
ll /var/run/zabbix/zabbix_agentd.pid

try

systemctl restart zabbix-agent

or

signal-event nethserver-zabbix-agent-update

show
config show zabbix-agent

[root@srv1 run]# systemctl restart zabbix-agent
Job for zabbix-agent.service failed. See "systemctl status zabbix-agent.service" and "journalctl -xe" for details.



[root@srv1 run]# journalctl -xe
-- The result is failed.
Mar 19 08:07:40 srv1.mydomain.lan systemd[1]: Unit zabbix-agent.service entered failed state.
Mar 19 08:07:40 srv1.mydomain.lan systemd[1]: zabbix-agent.service failed.
Mar 19 08:07:40 srv1.mydomain.lan polkitd[731]: Unregistered Authentication Agent for unix-process:4647:129169 (system bus name :1.49, object path /org/freedesktop/PolicyKit1/Authenticati
Mar 19 08:07:42 srv1.mydomain.lan rspamd[1954]: <7h4oer>; lua; bayes_expiry.lua:440: finished expiry step 13: 996 items checked, 198 significant (41 made persistent), 0 insignificant (0 t
Mar 19 08:07:50 srv1.mydomain.lan systemd[1]: zabbix-agent.service holdoff time over, scheduling restart.
Mar 19 08:07:50 srv1.mydomain.lan systemd[1]: Stopped Zabbix Agent.
-- Subject: Unit zabbix-agent.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit zabbix-agent.service has finished shutting down.
Mar 19 08:07:50 srv1.mydomain.lan systemd[1]: Starting Zabbix Agent...
-- Subject: Unit zabbix-agent.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit zabbix-agent.service has begun starting up.
Mar 19 08:07:50 srv1.mydomain.lan systemd[1]: Can't open PID file /run/zabbix/zabbix_agentd.pid (yet?) after start: No such file or directory
Mar 19 08:07:50 srv1.mydomain.lan systemd[1]: Daemon never wrote its PID file. Failing.
Mar 19 08:07:50 srv1.mydomain.lan systemd[1]: Failed to start Zabbix Agent.
-- Subject: Unit zabbix-agent.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit zabbix-agent.service has failed.
--
-- The result is failed.
[root@srv1 run]# config show zabbix-agent
zabbix-agent=service
    PskID=
    ServerZabbix=zabbix.mydomain.lan
    TCPPort=10050
    access=red,green
    status=enabled

OK I created the folder manually, the pid-file was created automatically. It looks good now:

cd /var/run
mkdir zabbix
chown zabbix:zabbix zabbix/

systemctl restart zabbix-agent

Thank you for your help!

1 Like

this is an upstream bug, normally a systemd service takes care to create its run environment

[root@ns7loc8 ~]# systemctl cat zabbix-agent
# /usr/lib/systemd/system/zabbix-agent.service
[Unit]
Description=Zabbix Agent
After=syslog.target
After=network.target

[Service]
Environment="CONFFILE=/etc/zabbix/zabbix_agentd.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-agent
Type=forking
Restart=on-failure
PIDFile=/run/zabbix/zabbix_agentd.pid
KillMode=control-group
ExecStart=/usr/sbin/zabbix_agentd -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
User=zabbix
Group=zabbix

[Install]
WantedBy=multi-user.target
[root@ns7loc8 ~]# systemctl cat zabbix-server
# /usr/lib/systemd/system/zabbix-server.service
[Unit]
Description=Zabbix Server
After=syslog.target
After=network.target
After=mysql.service
After=mysqld.service
After=mariadb.service
After=postgresql.service
After=pgbouncer.service
After=postgresql-9.4.service
After=postgresql-9.5.service
After=postgresql-9.6.service
After=postgresql-10.service
After=postgresql-11.service
After=postgresql-12.service

[Service]
Environment="CONFFILE=/etc/zabbix/zabbix_server.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-server
Type=forking
Restart=on-failure
PIDFile=/run/zabbix/zabbix_server.pid
KillMode=control-group
ExecStart=/usr/sbin/zabbix_server -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
TimeoutSec=0

maybe we could patch by

[Service]
RuntimeDirectory=zabbix
RuntimeDirectoryMode=0755

cc @mrmarkuz

1 Like

Same problem again, there is no zabbix folder under /var/run. But only on one of my Server…

Can you explain what you did, we should reproduce. I installed the agent on 6 vm, no issue

Please also output the agent log