What's new

Asus Merlin Router with Zabbix Agent

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Markfree

Regular Contributor
Have anyone tried using Zabbix Agent on Asus WRT Merlin router?

I created a script and a template to facilitate monitoring of our Asus Router with Zabbix Agent.


You can try doing yourself though. It's really easy.

If we search for Zabbix with Opkg, there are some packages available.
Code:
# opkg find zabbix*
zabbix-agentd - 6.2.3-3a - Zabbix agentd
zabbix-get - 6.2.3-3a - Zabbix get
zabbix-proxy - 6.2.3-3a - Zabbix proxy
zabbix-sender - 6.2.3-3a - Zabbix sender
zabbix-server - 6.2.3-3a - Zabbix server

So, installing Zabbix Agent is easy.
Code:
# opkg install zabbix-agentd
Installing zabbix-agentd (6.2.3-3a) to root...
Downloading https://bin.entware.net/aarch64-k3.10/zabbix-agentd_6.2.3-3a_aarch64-3.10.ipk
Configuring zabbix-agentd.

So far so good. Now we can even test some items.
Code:
# zabbix_agentd -t system.hostname
system.hostname                               [s|<correct_hostname>]

By default, Zabbix Agent opens port 10050 for passive checks. But, first, we need to start it.
Code:
zabbix_agentd -c /opt/etc/zabbix_agentd.conf

Actually, when we try to run with no root, it tells us we should have a zabbix user.
Code:
# zabbix_agentd -f -c /opt/etc/zabbix_agentd.conf
zabbix_agentd [12022]: user zabbix does not exist
zabbix_agentd [12022]: cannot run as root!

But, If we allow Zabbix Agent to run as root, that would be all.
Try the steps suggested bellow.

If you don't want to start it as root and don't need to run custom items, then you should create a "zabbix" user.

You can create a user "zabbix" simply using USB Application WEB interface and it seems to work fine.

Alternatively, the way I do it, edit the configuration files to add a user, as implemented by Merlin firmware. Create the following files with the respective content and reboot your router after that.
/jffs/configs/passwd.add
Code:
zabbix:x:10050:10050:zabbix:/dev/null:/dev/null
/jffs/configs/shadow.add
Code:
zabbix:*:0:0:99999:7:0:0:
/jffs/configs/group.add
Code:
zabbix:x:10050:
/jffs/configs/gshadow.add
Code:
zabbix:*:10050:

After creating the user, start the agent on background.
Code:
zabbix_agentd -c /opt/etc/zabbix_agentd.conf

Now the Zabbix Server is able to check some items.

Did it work for you? How was it?

Cheers
 
Last edited:
Zabbix agents can perform passive and active checks to actively monitor local resources and applications.

I believe Zabbix Agent supports more information than SNMP but, due to a limited router OS, it might not support every possible check.
You can find more information within Zabbix documentation.

With a Zabbix Server you can collect host data with an zabbix agent and SNMP as well. So, I find it very flexible.
 
Last edited:
@Markfree, this looks great!

But I'm at a loss (and slightly ashamed to admit) of how it would be installed 'easily'?

Are you (hopefully) working on an installer? I would love to try it then if you are!
 
Nice job @Markfree

@L&LD (and others). This is an agent - you will need to install a Zabbix server to collect and display the information. As far as I know there is no server available for Windows machines. Unix/Linux only.
If you do have a Raspberry Pi on your network and want to install the Zabbix server, this site gives a good tutorial:


I just might do this the next few days ;-)
 
@L&LD I haven't thought about a Zabbix agent installation script, but I might just do that next time I reset my router.

Indeed, @JGrana!
I also find the official Zabbix documentation very informative.

For a server installation I like to use the Zabbix Download and Install instructions as they are always up to date.
 
Thank you for the additional information. I'm not sure when I'll have the time, but I'll see if I can get Linux to work on Windows 10 and give this a whirl.
 
@L&LD I haven't thought about a Zabbix agent installation script, but I might just do that next time I reset my router.

Indeed, @JGrana!
I also find the official Zabbix documentation very informative.

For a server installation I like to use the Zabbix Download and Install instructions as they are always up to date.
I did install the agent on my AX88U. Used your instructions in the first post. I did edit the Zabbix conf file to allow Root - everyone is root on the router :)
Installing went very smooth - Entware did most of the work!

I downloaded your new template and then installed the Zabbix server on a Raspberry Pi.

That install was much longer but the instructions on the Zabbix site are excellent.

I was able to login to the Zabbix server via web. Stopped there and am ready to add a few hosts and templates.
I am presently trying out a VPN (using vpnmanager) and decided to focus on that for a few days...then back to Zabbix.
Thanks for the recommendation and new template for Asus Routers!
 
Following @L&LD suggestion, I created a script to facilitate Zabbix Agent installation and configuration.
It's very crude for now but it might do the job.
Any feedback is welcome.
 
Thank you for the additional information. I'm not sure when I'll have the time, but I'll see if I can get Linux to work on Windows 10 and give this a whirl.

They have an appliance for HYPERV

Morris
 
Been thinking of using Zabbix for some time and now found they also have a virtual virtualbox appliance for a quick start at the server end (use ovf download). Will use that initially then move it over to a linux host in due course. Thanks for the heads up re there being software appliances available and how to installed it within Merlin. :)
 
Last edited:
Hi,

I need your help.
I have also a AX88U. I installed mini snmp for Zabbix but missing information.
I decided to install Zabbix Agent (entware) but I have a problem.

When I start service I have: Starting zabbix_agentd... failed
Zabbix_agentd.conf is ok



I dont' know where is the problem?
 
If you "grep" your Zabbix Agent configuration file, I figure it might give you something like this.
Code:
# grep -v -e "^#" -e "^$" /opt/etc/zabbix_agentd.conf
LogType=system
Server=[YOUR_OWN_ZABBIX_SERVER]
StartAgents=1
Include=/opt/etc/zabbix_agentd.conf.d/

Please, show us how is your configuration file.

Also, try starting Zabbix Agent like bellow and posting the result.
Code:
zabbix_agentd -c /opt/etc/zabbix_agentd.conf
 
Hi,

thanks for your help.
the screenshot



zabbix agentd

 
As the error message states, you have not created a "zabbix" user.
You could try two things:

1. Create a "zabbix" user.
Follow the instructions at the beginning of this topic.
Alternatively, the way I do it, edit the configuration files to add a user, as implemented by Merlin firmware. Create the following files with the respective content.

2. Or, you could allow root access for the agent.
For this, open your configuration file.
Code:
vi /opt/etc/zabbix_agentd.conf
Add "AllowRoot" parameter.
Code:
AllowRoot=1

And try starting the agent again.
Code:
/opt/etc/init.d/S07zabbix_agentd start

If you wanna try, my installation script does that automatically. But make sure you removed previous installation of Zabbix Agent and its configuration.
Check it at GitHub.
 

Many thanks Markfree.​

zabbix agent works
i have create à user but but not working, but with AllowRoot it’s ok
Sorry. I forgot to mention you need to reboot your router after creating those user files. I added this information to the first post.
I'm glad it worked for you.
 
I've updated Zabbix template for Asus Merlin and it now includes monitoring of Conmon and NTPMerlin scripts.
It is just a simple monitoring of the same data shown at WebUI, but now stored at Zabbix database.

It is available at Github.

Any feedback is welcome.
Thanks.
 
Last edited:
Just a quick note of thanks to @Markfree for building this bundle. I just installed it on my RT-AC86U main router and both of my RT-AC68U AiMesh nodes and they are pumping data nearly flawlessly under the Linux OS template. Much better to get actual data than the ping-only I set them up with initially in Zabbix (server version 6.4).

One thing though: When I go to import the template (https://github.com/diasdmhub/Asus_Merlin_Zabbix_Template), I get these errors. Perhaps these templates are now included in the main Linux template in 6.4; I cannot find from where to install them individually. There is a very good chance I'm missing something since I'm a Zabbix noob.

1679170781318.png


Thank you again for your efforts!

Cheers,

Bill Anderson
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top