phpSymon

A PHP script to read output from symon and produce an up-to-date overview of system stats.
[About]      [Download & Installation]      [Configuration Options]      [Screenshot]      [Demo]      [FAQ]

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...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.

phpsymon is FREE software, distributed under the BSD license.

Download & Installation

phpsymon v2.0 can be downloaded here: phpsymon.tar.gz.

To install, simply unzip in the web-directory you want to view the stats in.

      # cd /var/www/htdocs
      # tar xzf /path/to/download/phpsymon.tar.gz
   
This will create a new directory phpsymon that you can point your browser at to view everything. This directory includes the following files. Modify the file config/config.php if you want phpsymon to connect to a host other than 127.0.0.1 and port 2100. After that, point your browser to the configtest.php script, to see if everything works.

Configuration Options

Options configurable on phpsymon are:

Screenshot

The following are 2 screenshots of phpsymon. The first is a snapshot from of my firefox window showing only what fits in the window. The second shows the entire phpsymon display.
Click each for full-size version.

Basic Screenshot

Screenshot of Entire Window

Demo

You can view a live example of phpsymon here. This demo may not stay up permanently for the public.

Frequently Asked Questions

...now with answers!

  1. What about the Look-n-Feel, is that configurable?

    Yes, it can be done by modifying the CSS style sheet and the HTML within the index.php or template/* files.
    ;)

    Editting the templates or even the main layout in index.php is fairly easy.
  2. 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.
  3. I can't seem to view any stats, it just errors out. My Apache error_log file reports the following:
             [error] PHP Warning:  socket_connect(): unable to connect [61]: Connection refused in /path/to/symon/symon.php on line 43
          
    What gives?

    You must also be 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.)
  4. OK, I've tried the above, and it isn't working!

    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:
             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 can see stats for each host you want, yet phpsymon still isn't showing the hosts email me.
  5. Why doesn't phpsymon report system uptime? (by far the most frequently asked question)

    Because 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.)



phpsymon is Copyright © 2005 - 2008 Ryan Flannery.