Linux Tech Hacks

Your Linux tech hacks and Tips

Installing Zabbix Agent on Solaris 11

Installing Zabbix Agent on Solaris 11


 Solaris is an operating system that is showing its age. Despite version 11 support will last untill November 2034, Oracle is not showing interest in releasing a new version. Due to this reason Solaris developers and systen administradors are migrating to Linux (check this post writen by Brendan Greeg, the author of many ZFS algorithms). 

 So why  am I sharing this knowledge once Solaris is almost a retired operating system? Well, as I said before, its support will still last untill the end of 2034 and yes, you may suddenly come across a server running Solaris and have no idea how to deal with. Netflix is an example of a company that runs a solaris-based operating system on its servers (of course, there are more than just Solaris running there. You may find different types of Linux distribution, FreeBSD and Windows on Netflix servers).

Image taken from Netflix Blog

 The reason I decided to write this post is because I faced this situation where I should install Zabbix Agent on Solaris 11 and the Zabbix installation guide is not exactly well documented. So here I go; the firts thing to do is to download Zabbix Agent according to the version of your operating system.


 Two things you have to notice about Solaris version:
  1. There is no Zabbix Agent 2 for Solaris. Sabbix Agent 2 is a new version writen in Go language (with some code writen in C language reused from Zabbix Agent) to be more flexible by using plugins. This version was not developed for Solaris.
  2. There are two different types os pakages to download. One is a tar.gz file containing Zabbix binaries. The other one is a P5P pakage.

 So wich one to use? I would like to analise the tar.gz file first because this one is a little more complicated. As you can see on the image bellow this is not a gzip file; actually it is just a tar file, so I had only to use tar -xvf and not with the z option to decompress it.

By decompressing the tar.gz file, you will get three binaries; the zabbix_agentd, the zabbix_get and the zabbix_sender.

decompressing Zabbix agent
This is a image from my home computer because I forgot to print this situation

 OK, now we have he binaries BUT where do I put it? This is a simple question BUT, where are the configuration files? At first we thought the .tar.gz was goig to be easier to work with. That's why we decided to download the .p5p file and use the pakage manager to install it.

 To install a p5p pakage you have to put it in Solaris list by typing pkg list -f -g and selecting the pakage through its path. By the, keep its name listed on the NAME (PUBLISHER) field because you will need it.

After putting it in Solaris list, now you are able to install it by typing pkg install -f the path of the pakage AND the name listed on the NAME (PUBLISHER) field. If you don't indicate the pakage name, the pakage manager will return a error message.

 Now we have our next problem: where are the binaries installed? This is the simplest question. The haredest one is where are the configuration files? I had to use the find command to find them all then I discovered that Zabbix Agent is installed under /opt/zabbix-agent (which is something that makes sense if we follow the FHS rules) and the configuration files are under /etc/opt/zabbix-agent.


 The next step is to make the commands available for the command line terminal. Like in the Linux distributions, the Solaris PATH variable doesn't get the /opt directory set on it.

PATH variable on Solaris

PATH variable on Linux

 The easiest way to make Zabbix commands available for the shell is to symbolic link them to a bin directory. Don't worry, I know I made the mistake of linking the zabbix_agent command the wrong path. I fixed it later linking it to /usr/sbin.


 First problem solve and after editing the /etc/opt/zabbix-agent/zabbix_agentd.conf now we have to solve the next problem: The Zabbix init scrip. Zabbix for Solaris doesn't come with a init script as you can see on the picture bellow.


 If it doesn't get a init script, how do i start os stop Zabbix process? The answer for this question is the zabbix_agentd command. To start the Zabbix agent process you have to run zabbix_agentd -c /etc/zabbix-agent/zabbix_agentd.conf command (yes, this is the syntax to start zabbix agent...)

Starting Zabbix agent on Solaris
Starting Zabbix agent on Solaris

 Then, I worked on a init script like this. But here was a problem on my script. Now that I know how to start Zabbix Agent on Solaris, how do stop it if I need to? That was a really interesting point because the zabbix_agentd doesn't support this feature. So, how do I do this?

My Solaris Zabbix Agent init script

 Due to a mistake we made we needed to stop Zabbix Agent and we did it the hard and worng way: Killing its prorcess. If you know a little about Unix, you know that the correct form to stop each service is using the stop option of its individually init script AND NEVER killig it using the kill command. The problem is we had no option but killing it; so we did it.

 I tried many times to start Zabbix agent using my init script and it accumulated my processes which I had to kill them all. After that, I could start Zabbix Agent again.


 My script is not totally wrong according to this help on the Zabbix forum, except for the fact that I forgot the stop option:


 BUT there is a mistake I made. After that I remember one thing: systemd. You may wonder what systemd has to do with Solaris and answer is simples, systemd is an init system that was inspired by MacOSX launchd and Solaris SMF. SMF (Service Management Facility) started in Solaris 10 as its default service management as a replacement with systemv used on this article (like systemd, SFM supported sysvinit scripts).

 So what I really had to do is to generate do SMF manifest fallowing the syntax bellow taken from the Zabbix support you can find here:

svcbundle -o zabbix-agentd.xml -s service-name=application/zabbix-agentd -s model=daemon -s start-method="/usr/local/sbin/zabbix_agentd"


 Then we have to Import the manifest running:

svccfg import misc/solaris/11/zabbix-agentd.xml


 To start/stop/restart Zabbix Agent, now we only need to run:

svcadm enable/disable/restart zabbix-agentd


 So, I could only donwload the tar file, decompress it, copy the files to /bin, create the zabbix user and zabbix group and then generate the SMF manifest. I hope this becomes useful for you if this situation 

Install Zabbix Agent on solaris 10

support zabbix 
server init script for Solaris

Zabbix Agent in Solaris

launchd info

Solaris smf manifest


Siga-nos