OpenBSD Journal

phpSymon

Contributed by jolan on from the OAP dept.

Ryan Flannery wrote in to say:
I wanted something like phpSysInfo to get a quick snapshot of various server stats when all I had was a web-browser. I use the symon package by Willem Dijkstra to monitor various OpenBSD stats on our web/email servers, but I don't have symux update the graphs (displayed via syweb) on a continuous basis for obvious reasons.

Unwilling to break apache's chroot for something as trivial as phpSysInfo, I decided to write a PHP script that taps into the stats symon streams to my server. It displays a quick overview of any stats available.

Webpage with downloads for phpSymon here, and demo here.

(Comments are closed)


  1. By Rich () on

    This is a really nice addition.

    I use symon too, but the one (and only) thing I really dislike about it is that the report generator requires a shell in order to work. Putting a shell in the apache chroot is hardly ideal from a security standpoint. Using your natty script, I may not have to any more :-)

    Rich.

  2. By m () on

    I have problem with symon. When I run it it doesn't listen on any port even that in conf file I have stream to 127.0.0.1 2100. So your script does not work for me :( OpenBSD 3.7.

    1. By m () on

      I looked more deeply into the problem and I found in apache error log: [Thu Sep 1 16:26:52 2005] [error] PHP Warning: socket_connect() [function.socket-connect]: unable to connect [61]: Connection refused in /htdocs/symon/symon.php on line 43 So it looks like permission problem. But I do not know why. My firewall passes all local traffic. Is there necessary to have something special in php.ini?

      1. By m () on

        Sorry my fault, it is necessary to have symux running as well.

  3. By Anonymous Coward () on

    Looks very nice, it's just missed the uptime, but have to try it.

  4. By Anonymous Coward () on

    I am quite impressed with this script. The latency rendering the page bothers me, however. According to the FAQ, it is because symon only collects stats every five seconds. Would it be feasible to have symon output to a text file every five seconds and then have your script read the information from that text file so as to reduce the rendering latency? (I am not very familiar with symon so if this is not possible with symon, pardon me and forget I said anything!)

  5. By Anonymous Coward () on

    I tried this script and all seems to work well except I have identified some discrepencies between values for my network interfaces using a) netstat, b) symon, and c) phpsysmon.


    # netstat -I fxp0 -b
    Name Mtu Network Address Ibytes Obytes
    fxp0 1500 <Link> 00:a0:c9:57:14:69 31192649 7187155


    # getsymonitem.pl 127.0.0.1 2100 127.0.0.1 "if(fxp0)" "bytes_in"
    31194237


    phpsysmon gives me "29.7 M"

    1. By Anonymous Coward () on

      # getsymonitem.pl 127.0.0.1 2100 127.0.0.1 "if(fxp0)" "bytes_in"
      31194237

      Seems pretty reasonable to me.
      Lets do some quick math
      31194237 bytes/1024 = 30463 KBytes/1024= 29.74 MBytes = 29.7, which is what was reported to three sig-figs.

      Granted, you could argue KiB vs. KB, and I'd agree with you, but the fact of the matter in most cases it's still 1024 and not 1000.

      1. By Anonymous Coward () on

        and on the other hand, I don't have a very good explination for Netstat Vs. Symon, someone else may. (Packets sent before symon started? DHCP? I may be way off base here.)

        1. By Anonymous Coward () on

          Network traffic between the times netstat and symon reported? It's less then 2KB difference...

  6. By Anonymous Coward () on

    I can't get more than one host to work with this script.

    In defaults.php there are two pertinent lines:

    $maxtries=2;
    $hostlist="192.168.2.210, 192.168.2.214";

    The first host is always the one that succeeds. Interechanging "210" and "214" proves this.

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]