Fork me on GitHub

About

As an avid OpenBSD user, I use OpenBSD for virtually everything...including a great deal of mass web/email hosting. I use the symon/symux packages by Willem Dijkstra to monitor system performance, but the graphs produced by syweb don't provide a nice up-to-the-second overview of things (plus I loathe putting a shell in my chroot'ed apache). Sometimes it's nice to have a brief overview of things, and existing projects such as phpSysInfo don't work well on OpenBSD / within a chroot'd apache... and that motivated me to write phpsymon.

phpsymon is a simple PHP script that listens on the address and port (default 127.0.0.1 and 2100, respectively) that symon streams its output to. Once the stats are grabbed, it parses the output into an easy-to-read overview of things.

News

1 March 2011
I'm currently in the process of switching over to Git for version control. Additionally, I'll be adding some new features and hopefully make configuration a bit easier. Expect some work shortly.
4 September 2010
More questions from users regarding connection difficulty. Please be sure to read the F.A.Q.'s below, as all questions I receive regarding this are answered there.
1 December 2009
Version 2.0 released. Includes cleaner interface that's better for viewing multiple hosts.
12 July 2009
Version 1.9 released. Includes support for the newer versions of symon/symux which slightly changed the format of some of the reported data (again).
28 May 2009
Verion 1.8 released. Includes support for newer versions of symon/symux, which slightly changed the format of some of the reported data.
September 2005
phpSymon was featured in a September 2005 article on undeadly.org! Click here to view.

Configuration

The following are all of the variables used in config/config.php to control phpsymon's function.

SymuxAddress
This is the address you want to read symon stats FROM. (Default is "127.0.0.1".)

NOTE: This host needs to be running symux and have it configured correctly for each host you want to read stats from.
SymuxPort
This is the port at the address you want to read symon stats from. (Default is "2100".)
SymonHost
Multiple hosts running symon can stream their stats to a given address/port where symux is running. This is the host you want to display stats for. (Default is "127.0.0.1".)
MaxTries
If many hosts are streaming their symon stats to the address/port you are connecting to, this option specifies how many datums to read before giving up. So, if n hosts stream their symon stats to the same address/port, this should be n. (Default is 1.)
WARNING: If the host you are wanting to view only updates its symon stats every m seconds, then you could wait up to m * n seconds! Be careful with this!
AutoRefresh
How often (in seconds) you want the screen to auto-refresh. 0 = never. (Default is 0.)

In addition to the above, phpSymon can be configured in the following ways...

Disk Mount Point Names
If you monitor df data through symon, you may want to run the build_df_aliases.sh script in the config directory, and store the output into config/df_mounts.php. When df data is displayed, it will then show mount points.
What about the GUI, is that configurable?
See the FAQ entry about that.

Screenshots

Obligatory. Click each to embiggen.

Demo

This demo is temporarily disabled.

Frequently Asked Questions

Click each to show/hide the answer.

What about the Look-n-Feel, is that configurable?
phpsymon uses a CSS style sheet in the main directory that can be modified to change the fonts/color/etc.

Additionally, the templates for each "block" of symon data are stored in the templates/ sub directory, and modifying the HTML there is rather straight-forward.

The main structure of the display (which "blocks" are displayed where) can very easily be changed by modifying the index.php page. Near the bottom is an HTML table that's used to control the location of all of the blocks.
Why does phpsymon sometimes take 5+ seconds to render the stats?
By default, symon only collects system stats every 5 seconds, so (in turn) symux only streams this output every 5 seconds. Thus, if you try to view phpsymon in-between updates, you could wait up to 5 seconds before the stats are available.
I can't seem to view any stats, it just errors out. My Apache error_log file reports the following error...
If the error is:
         [error] PHP Warning:  socket_connect(): unable to connect [61]: Connection refused in /path/to/symon/symon.php on line 43 
Then that means you aren't running symux on the host you are reading stats from. If you have symon streaming stats to a host, call it picard, then picard also needs to be running symux, and the symux config file on picard must be set to accept symon stats from each host. (See the next FAQ for more info on how to setup symon/symon for multiple hosts.)
I've tried the above, but I still can't connect/view-stats!
A few people have reported this, but in all cases I'm aware of, it's because of incorrect setup between the clients running symon and the host they stream their stats to.

Your setup should be like the following. Say we have two hosts, named data and worf, with IP addresses 192.168.1.10 and 192.168.1.11, respectively. We want to view symon stats from these two hosts, so we install symon on both of them and stream their stats to another host (it could be either data or worf), named picard, with IP address 192.168.1.1. Since picard is receiving the data, it needs symux installed and running.

Now, in this setup, you would run symon on hosts data and worf with something like the following in their /etc/symon.conf file:
         monitor { cpu(0), mem, pf, mbuf, ...  } stream to 192.168.1.1 2100 
And something like the following in /etc/symux.conf on host picard:
         # where to listen for incoming data
         mux 192.168.1.1 2100

         # accept symon stats from host "data"
         source 192.168.1.10 {
            accept { cpu(0),  mem, pf, mbuf, ... }

            datadir "/var/www/symon/rrds/data"
         }

         # accept symon stats from host "worf"
         source 192.168.1.11 {
            accept { cpu(0), mem, pf, mbuf, ... }

            datadir "/var/www/symon/rrds/worf"
         } 
Now, in the phpsymon file config/config.php, you should have the following variables set as you see them:
         $config['SymuxAddress'] = "192.168.1.1";
         $config['SymuxPort']    = "2100";
         $config['SymonHost']    = "192.168.1.10"; 
The first two variables instruct phpsymon to read stats from host picard on the appropriate port. The third variable, tells phpsymon which host to display information from.

If you think your setup is correct, but are still having problems, you can try telnet'ing to the IP/port where all of the clients are streaming their symon stats, from the machine where phpsymon is running. If your setup is correct, you should see something like the following (color added for emphasis):
ryan@godel# telnet 192.168.1.1 2100
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
192.168.1.10;io:cd1:1126931708:0:0:0:0:0;io:cd0:1126931708:0:0:0:0:0;io:wd0:11269
31708:3674918:11894382:0:91278661120:190547191296;proc:httpd:1126931708:21:11222
:3835:218:119:0.00:162471936:0;if:sis1:1126931708:8991240:10262738:598651475:771
310954:17067:3:0:0:1663440:0;if:sis0:1126931708:11632076:10175231:4117005601:164
8118281:50513:1:0:0:0:0;if:lo0:1126931708:1436865:1436865:1033785094:1033785094:
0:0:0:0:0:0;mbuf::1126931708:297:204:0:0:61:0:32:0:196:250:618496:77:0:0:12;pf::
1126931708:8191271922:5661534388:0:352:11354245:227308:10172162:18269:0:0:1:4:56
7:44138834:1403370:1402803:4519156:0:9:0:1:0;mem::1126931708:137121792:209858560
:180875264:96780288:1073995776;cpu:0:1126931708:0.30:0.00:0.60:0.00:99.10;
192.168.1.11;io:wd0:1126925734:5163711:127683:0:327717384704:3833036800;proc:mys
qld:1126925734:1:338126:968281:15584:13219:0.00:77176832:47833088;if:gem0:112692
5734:1707592:5024602:996008551:1940494606:19361:5:0:0:1279589:0;if:lo0:112692573
4:1593:1593:327877:327877:0:0:0:0:0:0;mbuf::1126925734:173:128:0:0:38:0:7:0:128:
208:532480:57:0:0:0;mem::1126925734:56451072:162463744:1020313600:0:314818560;cp
u:0:1126925734:0.60:0.00:1.40:0.00:98.00;
^]
telnet> 
Each line of output corresponds to symon stats from a host, and the first word of each is line is the IP of the host. So...
  • If you never see stats for the host you want, chances are symux isn't configured to accept stats from that host, or there's a firewall issue between the two hosts in question.
  • If you can't even connect to that IP/port via telnet, then either symux isn't running on that machine, or there is a firewall issue.
If you can see stats for each host you want, yet phpsymon still isn't showing the hosts email me.
Why doesn't phpsymon report system uptime?
This is by far the most frequently asked question.

Simply put, symon doesn't collect that information. Also, there is no easy way for PHP to grab this when Apache is running chroot'ed. If you really want to know your uptime that badly, consider running Apache un-chroot'ed. (Oddly, people have done just that.)

Download & Installation

The current version of phpSymon can be downloaded here: phpsymon-2.0.tgz.

Installation
Download the and unzip in the web-directory where you want to vew the stats in.
         $ tar xzf /path/to/downloaded/phpsymon.tgz
         $ cd phpsymon
         $ vi config/config.php
         edit the relevant configuration options. 
Uninstallation
Simply remove the phpsymon directory created when you unzip the tgz.

Roadmap (Future Work)

Long term goals (i.e. not for a while!):