ひとたびビルトされロードされると,これらはネットワーク上にあなたの UPS あるいは UPS らの状態を与えるだろう。
通常,multimon.cgi だけがユーザによって直接呼び出される。しかしながら,upsstats.cgi および upsfstats.cgi を直接呼び出す事は,可能である。upsimage.cgi だけは,バーチャートを生成するために uspstats.cgi によって使われるので,決して直接呼び出してはならない。
次に,hosts ファイル "/etc/apcupds/hosts.conf" を編集し,末尾にモニタしたいホストの名前およびそれらのラベル文字列を付け加えなさい。私のサイトでは,配布ソースからの無修正の multicon.conf を使っており,以下の3行を含むように hosts.conf を修正した。
MONITOR matou "Server" MONITOR polymatou "Backup server" MONITOR deuter "Disk server"matou, polymatou, および deuter は,現在 apcupsd が動いている3台のマシンのネットワーク名である。
multimon.cgi をテストするため,cgi をビルドしたディレクトリから直接 root としてでなくこれを実行できる。そうするためには,シェルプロンプトで
./multimon.cgi
と入力する。すべてが正しくセットアップされたなら,hosts.conf ファイルに追加したマシンのたくさんの値を含む HTML をプリントするだろう。そして,それは以下のように見えるだろう(注,ここで複写されているのは出力のほんの一部である)
Content-type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD><TITLE>Multimon: UPS Status Page</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF">
<TABLE BGCOLOR="#50A0A0" ALIGN=CENTER>
<TR><TD>
<TABLE CELLPADDING=5>
<TR>
<TH COLSPAN=10 BGCOLOR="#60B0B0">
<FONT SIZE="+2">APCUPSD UPS Network Monitor</FONT>
<BR>Sun Jan 16 12:07:27 CET 2000</TH>
</TR>
<TR BGCOLOR="#60B0B0">
<TH COLSPAN=1>System</TH>
<TH COLSPAN=1>Model</TH>
<TH COLSPAN=1>Status</TH>
...
もし似たような出力が得られないときは,WEB サーバがアクセスできるかどうかを確認するため,/etc/apcupsd ディレクトリのパーミッションや /etc/apcupsd/hosts.conf のそれをチェックしなさい。多くのサイト,たとえば私のも,では,Apache サーバは root としてでなく動作しているので,/etc/apcupsd/hosts.conf や /etc/apcupsd/multiomon.conf は世界から届くかどうか確認することに注意を払わなくてはならない。貴方のブラウザから multimon を呼び出すために,以下を入力しなさい。
http://<your-site>/cgi-bin/multimon.cgi
以下に示すようなスクリーンショットに似た何かが得られるはずである。これらのプログラムの動作例を見るには, http://www.sibbald.com/cgi-bin/multimon.cgi へ来なさい。

カラムヘッダや値と同様に,モニタされるマシンもすべて設定可能である(/etc/apcupsd/hosts.conf や /etc/apcupsd/multimon.conf を見なさい)。
multimon.cgi ディスプレイにおいて System 名をクリックする事によって,指定されたシステムのための upsstats.cgi を呼び出せ,それはモニタされている値のうちの3つをバーチャートにする。たとえば,
multimon と同様,/etc/apcupsd/hosts.conf ファイル中でローカルホストを構成したなら,以下のようにして CGI ディレクトリで Unix シェルからそれを実行できる。
./upsstats.cgi
As with multimon, quite a few lines of html should then be displayed.If you would like to see all of the STATUS variables available over the network, click on the Data field of the desired system, and your browser will display something like the following:
APC : 001,048,1109 DATE : Thu Dec 02 17:27:21 CET 1999 HOSTNAME : matou.sibbald.com RELEASE : 3.7.0-beta-1 CABLE : Custom Cable Smart MODEL : SMART-UPS 1000 UPSMODE : Stand Alone UPSNAME : UPS_IDEN LINEV : 223.6 Volts MAXLINEV : 224.9 Volts MINLINEV : 222.3 Volts LINEFREQ : 50.0 Hz OUTPUTV : 223.6 Volts LOADPCT : 6.2 Percent Load Capacity BATTV : 27.9 Volts BCHARGE : 100.0 Percent MBATTCHG : 5 Percent TIMELEFT : 167.0 Minutes MINTIMEL : 3 Minutes SENSE : High DWAKE : 060 Seconds DSHUTD : 020 Seconds LOTRANS : 196.0 Volts HITRANS : 253.0 Volts RETPCT : 050.0 Percent STATFLAG : 0x08 Status Flag STATUS : ONLINE ITEMP : 35.1 C Internal ALARMDEL : Low Battery LASTXFER : U command or Self Test SELFTEST : NO STESTI : 336 DLOWBATT : 02 Minutes DIPSW : 0x00 Dip Switch REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : 01/11/99 SERIALNO : GS9903001147 BATTDATE : 01/11/99 NOMOUTV : 230.0 NOMBATTV : 24.0 HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : 0 BADBATTS : N/A FIRMWARE : 60.11.I APCMODEL : IWI END APC : Thu Dec 02 17:27:25 CET 1999You should get pretty much the same output mixed in with html if you execute upsfstats.cgi directly from a Unix shell in the cgi subdirectory as explained above for upsstats.cgi and multimon.cgi.
To see a working example of the above programs, visit http://www.sibbald.com/cgi-bin/multimon.cgi.
cc client.c ../apcnetlib.c -o client
Then execute it:./client <host>
Where host is the name of the host or the IP address of the host running the Network Information Server. The default is the local host.If no error messages are printed, it has most likely established contact with your server. Anything that you type as standard input will be passed to the server, and anything the server sends back will be printed to standard output. There are currently two commands recognized by the server: events and status. Hence the following commands:
./client
status
events
xyz
^D
We have enhanced the bar graph program and hope that our changes can be useful to the original author in his project.