Progamming HTML

Chuck Yerkes chuck+baylisa at snew.com
Wed Oct 15 13:17:32 PDT 2003


okay, new topic.  Trying to gather my own thoughts here.
No commercial venture in mind, just keep running into this
doing sysadmin type web front end to tools so users can do
the work I've had to do for them.

It's a bit of a ramble, so find a question you like and address it.

I've dealt with HTML interfaces for a while.  Reading and writing.

I've seen stuff where a fairly complex application (complex in many
many pages and lots of variables stored in a stateful back end)
was stifled because adding new pages or info required rewriting lots
of perl or PHP.

Web page content should not be bound so tightly to the programs
behind them.

I want a file that describes how to layout the page, perhaps points
to where to find the data (snmp, ldap, file, etc).
I want a program to read that file, render the HTML and perhaps
handle info coming back, but in a generalized way (eg. not a program
required per page).

I have written stuff with PHP and Perl CGI modules galore.
Looked at Perl's Mason a bit...


My thoughts run to templating.  (php and smarty and the like).
I've played a bit with XML for some of this, but perhaps missing
something obvious.

For my example, I'll use a current thing I've tossed up quickly:
Monitoring machines with SNMP and presenting that data on web pages
for other admins to quickly see (means that NOC people can glance
at my page to see if mail is flowing, how much is queued etc and
not call me).

Show mailstats.  The SNMP stuff was easy for me (fixed net-snmp and went).

I'd like data that can be self descriptive.
Some structure in a config file that says:
outbound queue has these properties:
   SNMP variable is "MTA-MIB::mtaGroupStoredMessages.1.12"
   the name to present is "outbound queue"
   it's stored an RRD table as "outboundbq"
   When they user puts a mouseover this, (or when user puts data
         in a form) run $THIS blob of javascript (perhaps to validate
         that it's all numbers or whatnot).

Seems easy to store and handle with XML.

Now wrenches.  It's snmp name is not really .12.
It's whatever MTA-MIB::mtaGroupStoredMessages.1.* has the value of "outbound".
(and the .12 will be .11 on a different machine with a different sendmail.cf).
Perhaps store in XML the value "outbound" for the program to seek?

That's doable - 1 later of abstraction.  But I have to define the
syntax for that abstraction and implement it in whatever language(s)
I want to use it.

So read it in, process it and store in in a structure (either
a language structure or an XML DOM metastructure)

That is one point of dealing with one piece of data.



Now to PRESENTATION.

THIS is where I'm struggling...

I'd like to have a general, reusable program point to a file that
describes the page:

<HEADER STUFF>
Perhaps Frame FOO (of these properties) (include frame FOO file)
[and we're still in easy templating]
<BODY and properties>

HOST=(machineA, machine1, machineI)
[and read config in for for machines to find the name they present
 ("outbound mail") vs who they are ("tcpdec05.berk.example.com")
 and their SNMP info (port=1161, version=2, pass="blah", user="admin").]

now: show me a table where the headers are the familiar:
"Mailer", "msgs from", "bytes from", "msgsto", "bytes to"

and the data is filled in from an array of 
COL1=snmp://$HOST/MTA-MIB::mtaGroupName.1.*  (which is 1-9 in this case).
COL2=snmp://$HOST/MTA-MIB::mtaGroupReceivedMessages.1.*

and so forth.
</BODY>

That "*" might also be a list (1,4,5,8,9) or ("lastName", "firstName", "location")

This gets parse and emits the mailq information for each host>

While I can make up and write something to parse the above,
I'm a system admin and inherently lazy.  More, I pride myself
on not reinventing wheels.

What is a way of saying the below with more common tools?

%table%{
 col1.property=Header+BOLD)
 Rows1(header=1, columns=["Mailer", "msgs from" , "bytes from" ....)
 col1.content=snmp://$HOST/MTA-MIB::mtaGroupName.1.[1-*]
}




While I'm using the presentation of "mailstats" via snmp example,
it would also apply to whipping up pages to display LDAP information.
Or displaying LDAP information with FORMS to allow people to change them.

In the FORMS case, I'd want to know, via a data structure if the
presented data is changed.

new thoughts:
The table can be presented as XML so I have:
%table TABLE="XML://mailstats" border=1 properties="XML://cytable"%

which I parse and then read the table who's property is "mailstats"
(define in a config file in XML and which is rendered/filled in
at this time).


I'm out of electrons.

Is this of interest to anyone?

chuck



More information about the Baylisa mailing list