msgbartop
MAC OS X, Linux, Windows and other IT Tips and Tricks
msgbarbottom

30 Oct 16 Monitoring Linux server with iPhone/iPad

Introduction:

Although Apple doesn’t have too many apps that support Linux admins, here is one that just came back on the market with a rebound on 26 Oct. 2016 with a new look, features and bug fixes: The iStat3 Server for Linux and iStat3 for iOS made by Bjango PTY Ltd. This app will display live the following characteristics of a Linux server.
– Uptime
– CPU usage
– System Load
– Disk space and disk activity
– Network traffic load
– Processes list(top)
– Sensors: Memory and CPU temperature

Read more about it on //bjango.com/ios/istat/

In order for the iOS app to get this information from the Linux servers, it needs a connection to its colleague the iStat3 server, which is an agent running in each targeted Linux server. The agent is a daemon which runs in the background and listens on a standard port 5109(configurable). Since there are so many different Linux distributions the agent needs to be compiled in each targeted Linux server. In order to facilitate this process I wrote this article.

Note: I only mention the steps for Debian 6/7/8 and Ubuntu 12.x/14.x/16.x

Steps:

Installing the needed packages:
apt-get update && apt-get install build-essential g++ autoconf libxml2-dev libssl-dev libsqlite3-dev fancontrol libsensors4:amd64 libsensors4-dev lm-sensors libssl1.0-dev
Download the software:
wget //download.bjango.com/istatserverlinux -O istatserver-linux_3.0.tar.gz
or if changed address or not available
wget //public.itmatrix.eu/istatserver-linux_3.0.tar.gz
Compiling and installing the software:
tar fvxz istatserver-linux_3.0.tar.gz
cd istatserver-3.01
./configure && make && make install

Configuring the istatserver:
Here you mostly need to modify the 5 digit server_code.
vim /usr/local/etc/istatserver/istatserver.conf

Extra preparations for Debian 6/7 or Ubuntu 12.x/14.x which are using the SysV init

Getting the start script from my repos:
wget //public.itmatrix.eu/istatserver -O /etc/init.d/istatserver
chmod 755 /etc/init.d/istatserver
update-rc.d istatserver defaults
service istatserver start ; sleep 1 ; ps aux | grep -v grep | grep istat

Result should be:
istat 17891 0.0 0.2 42108 2332 ? R 18:39 0:00 /usr/local/bin/istatserver -d

Extra preparations for Debian 8 or Ubuntu 16.x which are using the Systemd init

vim /etc/systemd/system/istatserver.service
istatserver.service file content:
[Unit]
Description=istatserver server daemon
Documentation=man:istatserver(8)
After=network.target
#
[Service]
Type=simple
EnvironmentFile=/etc/default/istatserver
ExecStart=/usr/local/bin/istatserver $OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=control-group
Restart=on-failure
RestartSec=30s
#
[Install]
WantedBy=multi-user.target

Make sure the environment file exists, even if it’s empty, otherwise the service will not want to start!!
touch /etc/default/istatserver
systemctl daemon-reload
systemctl enable istatserver.service
service istatserver start ; sleep 1 ; ps aux | grep -v grep | grep istat

Result should be:
istat 1507 43.0 0.0 118844 7120 ? Ssl 19:02 0:00 /usr/local/bin/istatserver

General Note:

Makes sure your firewall is allowing in the port 5109(or whatever the port you are using).
I’m using ufw, so for example the command would be:
ufw allow from any to any port 5109
Result:
Rule added
Rule added (v6)

UPGRADING from ISTATD to ISTATSERVER:

In case you had already the older version of this agent(istatd) running here are the steps to stop using it:
ps aux | grep istat
killall istatd ; sleep 2 ; killall istatd
update-rc.d -f istatd remove

Getting the iPad/iPhone APP:

Concerning the iOS app, you need to buy it on Apple store and its name is: iStat 3 from Bjango PTY Ltd.
This app allows to monitor multiple Linux servers with very pretty graphs.
If you have a Mac you can also buy the similar APP called iStat from Apple Store. It displays the exact same thing as with iPad and adds a few small extra features.
screen-shot-2016-10-31-at-19-41-18

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: