Operating System - HP-UX
1834137 Members
2281 Online
110064 Solutions
New Discussion

Re: Scripting question - inside my apache webpage

 
SOLVED
Go to solution
Rita C Workman
Honored Contributor

Scripting question - inside my apache webpage

...got a friends performance webpage running so sweetly (just love it Patrick ..)

anyway, thought...hmmm....I'd like to throw in a click & see for system uptime. Well it works fine - for the server running the apache services, but when I try to get it to run for a different server...nope, I just get the uptime info for the server running apache, no matter what other server I select.
Obviously running remsh for uptime for any server works perfect......just not within this webpage.
Hey Patrick if you listening....it's a quick 10 for you -or- anybody else who can tell me how to run a remote uptime command on a webpage.

Thanks,
Rita


What am I missing ....
11 REPLIES 11
harry d brown jr
Honored Contributor

Re: Scripting question - inside my apache webpage

a perl cgi ?


live free or die
harry d brown jr
Live Free or Die
Rita C Workman
Honored Contributor

Re: Scripting question - inside my apache webpage

Would be great...and don't tell Clay, but I haven't gotten around to learning perl...

Rita

And with juggling too many projects again...Don't think I'm gonna see a book on perl anytime soon...
harry d brown jr
Honored Contributor

Re: Scripting question - inside my apache webpage


BAD Rita, VERY BAD Rita!!! Go sit in the corner!!!

Here go CHEAT (again VERY BAD): http://www.freebsddiary.org/uptime.php

live free or die
harry d brown jr
Live Free or Die
harry d brown jr
Honored Contributor

Re: Scripting question - inside my apache webpage

and how to use "forms" http://www.cclabs.missouri.edu/things/instruction/perl/perlcourse.html#contents

live free or die
harry d brown jr
Live Free or Die
Rita C Workman
Honored Contributor

Re: Scripting question - inside my apache webpage

Boohoo....sob...sob...sob...

OK Harry, I'll try and find time to pick up Perl, any chance you'll come here and help me migrate 4 servers, get those new RP84xx boxes fired up and ready; get that 2-3 ton UPS installed; get the old one out; move all the equipment around in the computer room (and you know that means re-cabling); move out the Novell stuff to the new smaller computer room; surplus all the old stuff out of here........And I'm just getting warmed up cause there's about 5 more smaller boxes that need fired up and things migrated....

What d'ya say Harry....I could use the rest !

Rita
harry d brown jr
Honored Contributor

Re: Scripting question - inside my apache webpage


Some of those samples show how to use Shell crap programming :-))

I'd love to help you, but I'm trying to get my new lab built (proxy, pix, network switch, vpn, servers, ..., electronic lock on door) and the old one rebuilt (additional 50KvA UPS, a few more tons of air, cabling, icky shuffling of the servers from one room to another, ...)


live free or die
harry d brown jr
Live Free or Die
Patrick Wallek
Honored Contributor
Solution

Re: Scripting question - inside my apache webpage

Rita,

Here's something I just came up with that I think will work for you.

# cat uptime.cgi

#!/bin/sh

SYSNAME=$1

/bin/cat << EOF
Content-Type: text/html



${SYSNAME} performance for ${W} of ${MONTH} ${YEAR}




EOF

UPTIME=$(remsh ${SYSNAME} -l root uptime)

/bin/cat << EOF

UPTIME FOR ${SYSNAME} IS : ${UPTIME}






Back to Main Page




This page maintained by Patrick Wallek




EOF

Now the key to the script is the 'remsh' line. The remsh will be executed as the user that the Apache server is running as, which is probably 'www'. Now you've either got to get remsh (or ssh) working for www, or set up someone else's .rhosts file to allow www to remsh to them to run uptime.

The uptime.cgi script goes in the Apache web server's cgi-bin directory and it needs to have 555 permissions.

Once that works, the rest is pretty easy.

Now you call the script from your main web page like this:

Steven E. Protter
Exalted Contributor

Re: Scripting question - inside my apache webpage

Hi Rita,

If you want it in perl, I'll write it in perl for you.

The webpage will be simple.

It will have a

In it.

There may initially be some permission issues with the binaries, but I doubt it.

I do this kind of stuff quite regularly for my customers.

SEP

Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Patrick Wallek
Honored Contributor

Re: Scripting question - inside my apache webpage

I missed a closing quote in my last HTML statement. There needs to be a closing " after the servername

UPTIME OUTPUT
John Payne_2
Honored Contributor

Re: Scripting question - inside my apache webpage

Rita,

What's the weather like out there? I'm only working 60 hours a week, maybe I can come and help...

John
Spoon!!!!
Rita C Workman
Honored Contributor

Re: Scripting question - inside my apache webpage

Oh you guys are so nice, even though I've been so bad.

Harry...you have fun, I'll be thinking of you as they install our UPS, and then our equipment shuffle starts.

Patrick & Stephen...many thanks and look forward to seeing you guys at the next conference.

John..It's Feb 9 in a mountain state, and the temp on Monday was 61 but starting Thursday...snow.

Thanks bunches !
Rita