Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Package Request] Zabbix Agent #1514

Open
Inglebard opened this issue Feb 27, 2015 · 24 comments · May be fixed by #6417
Open

[Package Request] Zabbix Agent #1514

Inglebard opened this issue Feb 27, 2015 · 24 comments · May be fixed by #6417
Labels
request request for new package

Comments

@Inglebard
Copy link

Hi,
It would be intrerresting to have a Zabbix Agent Package.

I can see pull request about it, where is it ?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@Inglebard Inglebard changed the title Zabbix Agent [request] Zabbix Agent Feb 27, 2015
@Dr-Bean
Copy link
Contributor

Dr-Bean commented Feb 27, 2015

The PR was closed by the creator, so there's no package on the SynoCommunity repository. I believe there's a separate repo with the Zabbix package, not sure of the details though.

@Inglebard
Copy link
Author

I don't understand why his work has not been add to SynoCommunity repository when the PR was opened. His Zabbix agent was working well, really usefull and easy to use.

@RustyPixel
Copy link
Contributor

@Inglebard Stop stressing yourself 😄 see from #716 (comment) i'm still playing around with zabbix and a few others including SOGo Groupware (in house). I'm over at synology main forum if you need help with anything

@cytec cytec added the request request for new package label Apr 9, 2015
@hgomez
Copy link

hgomez commented Nov 16, 2015

Any update on Zabbix in SynoCommunity ?

At least Zabbix Agent would be great for those of us who need to monitor DSM 4.x / 5.x from enterprise Zabbix.

@Pimmetje
Copy link

I have a DS1815+ i can start the zabbix agent downloaded from zabbix.com as this one is x64. I created a user zabbix. But somehow it does not run. I chmod the log file 777 but no logging nothing. Anyone knows how to do it properly?

@Inglebard
Copy link
Author

Any update on Zabbix agent for synology ?

@Inglebard
Copy link
Author

I put source code of zabbix agent here : https://github.com/Inglebard (@RustyPixel 1 Jun 2014)
But it's seems to not working properly for DSM 6.

@tedserreyn
Copy link

anyone get it working for DSM6?

@ymartin59
Copy link
Contributor

@DONCIEUX-CAMILLLE May you please help submitting a PR proposal for agent-only package?

@mreid-tt mreid-tt changed the title [request] Zabbix Agent [Package Request] Zabbix Agent Nov 25, 2023
@Inglebard
Copy link
Author

Hello,
still interested after 10 years.
I am building manually zabbix-agent since this post.

@hgy59
Copy link
Contributor

hgy59 commented Jan 23, 2025

Hello, still interested after 10 years. I am building manually zabbix-agent since this post.

@Inglebard I just have restarted to work on zabbix locally, it is a beast...
Successfully built v7.2.2 now with agent and server with mysql db backend (mariadb can't be used due to cross compiling).
Support for net-snmp is not possible,

Shall we build an agent-only package?

I can create a PR, but I don't use zabbix and I'm lacking time for the service configuration (and we need an installation wizard to configure mysql/mariadb), Can you help to get this done?

@Inglebard
Copy link
Author

I think a package with zabbix-agent only and another package with zabbix-server would be great.

I will be happy to help however my knowledge to build synology package/spksrc/make and other compiling stuff is not good.

@viper93458
Copy link

I would love a current agent package for Syno! :)

@hgy59
Copy link
Contributor

hgy59 commented Jan 24, 2025

@Inglebard, @viper93458 here are my first questions regarding the configuration

Successfully built the zabbix-agent, but I am lacking the knowledge on how to configure it.

I have setup a zabbix-server with docker compose on a linux server in my local network (using https://github.com/matsubo/zabbix-docker-compose/blob/master/docker-compose_v3_ubuntu_mysql_latest.yaml)

I have configured the zabbix-agent on a diskstation with the following parameters in the config file (beside DSM specific settings for PidFile and LogFile):

  • Server={ip of zabbix-server}
  • ServerActive={ip of zabbix-server}
    All other settings are kept on the defaults

The agent is running and listening on the default port 10050

In zabbix on the zabbix-server I added the agent with "Monitoring - Hosts - Create host"
I configured the interface with the ip-address of the zabbix-agent and port 10050.
In the hosts list I can successfully perform the ping, traceroute and "Detect Operating System" scripts
Detect Operating System shows:

Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.10 - 4.11
Network Distance: 2 hops

But the zabbix-server does not get any data from the zabbix-agent: Avalability shows "status unknown"
What is missing?

Further details:
zabbix-agent runs 10 listeners
list of zabbix processes:

 pgrep -a zabbix
3034 /volume1/@appstore/zabbix-agent/sbin/zabbix_agentd -c /volume1/@appdata/zabbix-agent/zabbix_agentd.conf
3043 /volume1/@appstore/zabbix-agent/sbin/zabbix_agentd: collector [idle 1 sec]
3044 /volume1/@appstore/zabbix-agent/sbin/zabbix_agentd: listener #1 [waiting for connection]
3045 /volume1/@appstore/zabbix-agent/sbin/zabbix_agentd: listener #2 [waiting for connection]
3046 /volume1/@appstore/zabbix-agent/sbin/zabbix_agentd: listener #3 [waiting for connection]
3047 /volume1/@appstore/zabbix-agent/sbin/zabbix_agentd: listener #4 [waiting for connection]
3048 /volume1/@appstore/zabbix-agent/sbin/zabbix_agentd: listener #5 [waiting for connection]
3049 /volume1/@appstore/zabbix-agent/sbin/zabbix_agentd: listener #6 [waiting for connection]
3050 /volume1/@appstore/zabbix-agent/sbin/zabbix_agentd: listener #7 [waiting for connection]
3051 /volume1/@appstore/zabbix-agent/sbin/zabbix_agentd: listener #8 [waiting for connection]
3052 /volume1/@appstore/zabbix-agent/sbin/zabbix_agentd: listener #9 [waiting for connection]
3053 /volume1/@appstore/zabbix-agent/sbin/zabbix_agentd: listener #10 [waiting for connection]
3054 /volume1/@appstore/zabbix-agent/sbin/zabbix_agentd: active checks #1 [idle 1 sec]

zabbix-agent logfile has lot of entries like

3054:20250124:165042.618 no active checks on server [{zabbix-server-ip}:10051]: host [{zabbix-agent-hostname}] not found

is this issue related to the agent or the server?

@Inglebard
Copy link
Author

Inglebard commented Jan 24, 2025

That means [{zabbix-agent-hostname}] is not declared in zabbix server or do not have the same name.

In the zabbix agent configuration file there is a line call "Hostname", It must match to the name of the created host in zabbix server.

@hgy59
Copy link
Contributor

hgy59 commented Jan 24, 2025

That means [{zabbix-agent-hostname}] is not declared in zabbix server or do not have the same name.

In the zabbix agent configuration file there is a line call "Hostname", It match to the name of the created host in zabbix server.

@Inglebard thanks for the feedback. I have now adjusted this and the active checks errors are gone.
But I still can't see monitoring data on the zabbix-server.

With zabbix_agentd -p I get a lot of data output
and zabbix_get -s {zabbix-agent-ip} -k system.hostname shows the correct hostname on zabbix-agent.

So I guess my tests have an issue with my zabbix-server that is not able to show data from the zabbix-agent on my diskstation.

To create an installation wizard, we could present the following values to the user:

  • Server
    • list of ips (with optional sub net like /24) and/or domain-names
    • required (we use the default value of StartAgents=10)
  • ServerActive
    • optional: list of ips and/or domain-names with optional port
    • enables or disables active checks (empty: disable active checks)
  • Hostname
    • optional: empty or comma separated list of (case sensitive) domain-names
    • required for active checks

I guess we need at least the Server to be configured
AFAIK this will run the agent without active checks and zabbix-servers must activly poll for data.

Does it make sense to support active checks too?

@hgy59 hgy59 linked a pull request Jan 24, 2025 that will close this issue
6 tasks
@Inglebard
Copy link
Author

Inglebard commented Jan 24, 2025

Zabbix agent has 2 mode active and passive.
The passive mode require "ListenPort" to be set in agent configuration file.

@hgy59
Copy link
Contributor

hgy59 commented Jan 24, 2025

Zabbix agent has 2 mode active and passive. The passive mode require "ListenPort" to be set in agent configuration file.

Yes, I know,
Just pushed my current work (see #6417)
It currently supports the active mode only and asks for Server in the installation wizard.
The listening port is the default 10050.

You can download and manually install the package created by the github build.
Any feedback is welcome.

Still open question:

  • shall the package support active and passive checks?
  • does it make sense to configure a single agent for active and passive mode or shall we restrict the installation to active OR passive checks?

@hgy59
Copy link
Contributor

hgy59 commented Jan 25, 2025

@Inglebard I tried to build a zabbix-server package (at least to test the zabbix-agent)
but I didn't success to initialize the mysql db.

There are 3 scripts to create the db:

cd database/mysql 
mysql -uzabbix -p<password> zabbix < schema.sql
# stop here if you are creating database for Zabbix proxy
mysql -uzabbix -p<password> zabbix < images.sql 
mysql -uzabbix -p<password> --default-character-set=utf8mb4 zabbix < data.sql

The first (schema.sql) took more than 1 hour on a VirtualDSM on DS-218+
The second runs like a charm
But the third (data.sql) always failed (at line 3091 of 166226)

So I gave up and will try to create a zabbix-proxy.

@viper93458
Copy link

Sorry to be dense, but how do I find the SPK in the specific commit to download for manual install/testing?

@Inglebard
Copy link
Author

@viper93458 I think you need to build it manually for now

git clone https://github.com/hgy59/spksrc
cd spksrc
git checkout add_zabbix
docker run -it -v $(pwd)/spksrc:/spksrc synocommunity/spksrc /bin/bash

Inside docker :
apt update && apt install moreutils
ls
make setup
spk/zabbix-agent/
ls
make arch-x64-7.2

I don't know why but you may need to edit spksrc.supported.mk

@hgy59
I build the zabbix-agent and installed it on a DS218+.

During the installation, only the server ip/port is required.
As you write earlier and to explain why:
"ServerActive" should be able to be change because zabbix server port can not be the default port.
"Hostname" should be able to be change because by default it is the same as Synology hostname. People may want to have a different name to organize on Zabbix server side
"Listen" should be able to change in case of port conflict when accessing from outside and if NAT/PAT is not possible.

I am also worried about zabbix root access. If I remember well, when zabbix-agent is launched, it check if there is a zabbix user account, if not it uses root.
Is it possible to create zabbix system user ?
If yes, it may be interesting to add in the UI the possibility to enable "AllowRoot" parameter.

About your question about zabbix-server, maybe it require too much RAM to import data.

@hgy59
Copy link
Contributor

hgy59 commented Jan 27, 2025

@Inglebard you can download packages created by github build action and manually install it in DSM package center.

in #6417 naviatate to Checks - select Build - and go to Artifacts
select the package for your architcture and DSM Version (6.2.4 or 7.1)
Extract the spk file from the downloaded zip archive for manual installation.
link to artifact for DSM-218+ and DSM 7 (x64-7.1) https://github.com/SynoCommunity/spksrc/actions/runs/12955762285/artifacts/2482668949

The zabbix-agent runs as user sc-zabbix-agent.
There is no root user allowed (at least on DSM >= 7) so the option "AllowRoot" can't be used and the option "User" is obsolete.

Until we have the final wizard, you can manually edit the configuration in the file

/var/packages/zabbix-agent/var/zabbix_agentd.conf

You have to restart the agent after changing options in the config file
Either user stop and start in DSM Package Center or
on the command line (as root) call

synopkg restart zabbix-agent

Remarks to "Listen Port":
The port is hardcoded to 10050 (all the community packages have fixed ports documented here https://github.com/SynoCommunity/spksrc/wiki/SynoCommunity-Used-Ports).
It is not possible to configure the port number at installation time.

@viper93458
Copy link

@hgy59 thank you kindly. The Artifacts link was the step I was missing when I was looking. Thanks!

@hgy59
Copy link
Contributor

hgy59 commented Jan 27, 2025

ServerActive and Hostname configuration are now implemented in the installation wizard.
Both are optional, but if ServerActive is configured, empty Hostname is not allowed.

Please be aware that this is for the first installation only. When updading the package no wizard is shown and the options can't be changed.
To test, you need to uninstall first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request request for new package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants