Skip to content

UNIX Agent

Introduction

The Observium Unix Agent is a collection of scripts which return statistical data for a Linux host. The Agent allows us to poll more complex statistics and information from Linux and some Unix hosts.

SNMP Requirement

Please note that SNMP is still required on any devices with the agent, the agent simply provides additional data which can't be accessed via SNMP.

All Agent data is pulled in one TCP connection during the unix-agent module. The module populates an $agent_data array which can be used by other modules. For example:

  $agent_data = 
      ['app'] => 
          ['apache'] => 
              ... DATA ...
          ['bind'] =>
              ... DATA ...
      ['other'] =>
        ... DATA ...

Installation

Configure socket

The agent can be called either by systemd or by xinetd. If your distribution uses systemd, we recommend using that, else you can install and use xinetd.

Copy the service and socket files into position. Be sure not to omit the @.

cp /opt/observium/scripts/systemd/observium_agent.service /etc/systemd/system/observium_agent\@.service
cp /opt/observium/scripts/systemd/observium_agent.socket /etc/systemd/system/observium_agent.socket

Enable and start the observium_agent socket:

systemctl daemon-reload
systemctl enable observium_agent.socket
systemctl start observium_agent.socket

Limit access by IP addreses, append to section [Socket] in file /etc/systemd/system/observium_agent.socket:

IPAddressDeny=any
IPAddressAllow=127.0.0.1
IPAddressAllow=192.168.50.30

The preferred method of running the Unix agent is with an iptables firewall only allowing access from the monitoring server(s). Make sure this package is installed.

sudo apt-get install xinetd

Observium provides an example xinetd configuration file. Copy this from Observium to the server that will be running the agent.

scp /opt/observium/scripts/observium_agent_xinetd user@your_server:/etc/xinetd.d/observium_agent_xinetd

Edit observium_agent_xinetd so the Observium server is allowed to connect. You can do this by substituting 127.0.0.1, or place your IP after it, separated by a space. Make sure to restart xinetd afterwards so the configuration file is read.

sudo service xinetd restart

Install Agent Scripts

Copy the observium_agent script from Observium to the server that will be running the agent.

scp /opt/observium/scripts/observium_agent user@your_server:/usr/bin/observium_agent

Create a /usr/lib/observium_agent directory:

sudo mkdir -p /usr/lib/observium_agent

Next, create /usr/lib/observium_agent/scripts-available and /usr/lib/observium_agent/scripts-enabled directories.

Copy all agent scripts into the scripts-available directory, and place a symbolic link into scripts-enabled for the ones you want to enable:

scp /opt/observium/scripts/agent-local/* user@your_server:/usr/lib/observium_agent/scripts-available

sudo ln -s /usr/lib/observium_agent/scripts-available/os /usr/lib/observium_agent/scripts-enabled
sudo ln -s /usr/lib/observium_agent/scripts-available/dmi /usr/lib/observium_agent/scripts-enabled
sudo ln -s /usr/lib/observium_agent/scripts-available/apache /usr/lib/observium_agent/scripts-enabled

If you prefer to use a simpler layout and don't need the ability to enable/disable specific scripts using symbolic links, you can alternatively simply create a /usr/lib/observium_agent/local directory and put the agent scripts you want to run in the local directory directly:

sudo mkdir -p /usr/lib/observium_agent/local

scp /opt/observium/scripts/agent-local/os user@your_server:/usr/lib/observium_agent/local

Enabling Observium's Unix Agent module

Next, enable the unix-agent module (on your device's settings tab, modules section) or globally for all *nix devices in the config.php configuration file:

$config['poller_modules']['unix-agent']                   = 1;

Testing

To verify the agent is running, try to telnet from your Observium server to the monitored server on port 36602. If you see a blast of output, then the agent is working and is available to Observium.

telnet your_server 36602

To verify a specific script is working, you can run it from the command line on the monitored host. Make sure the script is executable (+x), otherwise the agent won't run it.

chmod +x /usr/bin/observium_agent
/usr/bin/observium_agent

Modules

The scripts/agent-local directory of your Observium installation includes various modules which can be placed into /usr/lib/observium_agent/local to add additional functions to the agent. The files you want to be executed have to be marked as executable with chmod +x.

As this infrastructure is currently in development, it is recommended that these are downloaded to the server via SVN and symlinked into place, allowing updating of the scripts either manually or via cron.

Please refer to the Applications page for a list of supported apps.