Announcement

Collapse
No announcement yet.

uptime and load average

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DrkShadow
    replied
    Cool

    Works with WinXP using MS uptime.exe proggy. Added after the copyright in the template.

    \\WEBSERVER has been up for: 24 day(s), 23 hour(s), 25 minute(s), 18 second(s)

    Leave a comment:


  • Billy
    replied
    Or, this may work:
    $uptime = `uptime`;
    Then put $uptime in the template.

    Leave a comment:


  • rylin
    replied
    or you could fread() /proc/uptime & /proc/loadavg.. just parse the first value in /proc/uptime.. it's how many seconds since the computer booted

    Leave a comment:


  • express
    replied
    Look Here

    At the bottom
    I used this for the middle one number 2 that you see there

    PHP Code:
    $uptime=exec('uptime'); 
    then I put this in the template

    PHP Code:
    <tr>
    <
    smallfont><nobr><b>Server 1</b$ubuptime</smallfont><br>    
    <
    smallfont><nobr><b>Server 2</b$uptime</smallfont><br>        
    <
    smallfont><nobr><b>Server 3</b$uauptime</smallfont>
    </
    tr>
        </
    table

    I used other coding for the other 2 because I am tracking some other servers also for someone else.

    Leave a comment:


  • Marc Smith
    replied
    Thanks for the idea. I may try that later. It's not really a big deal - mostly for my own curiosity.

    Leave a comment:


  • George L
    replied
    well i still have this code but don't use it
    PHP Code:
    <?php
    $uptime 
    = `uptime`;
    $uptime eregi_replace("(.*up |, .[0-9] user.*)"""$uptime);
    echo 
    '<FONT FACE="Verdana, Arial" SIZE="1">Server uptime: '$uptime '.</font>';
    ?>
    you can place it in a file like uptime.php and include it into the page

    Leave a comment:


  • Marc Smith
    replied
    Changing it from:
    PHP Code:
    $uptime=passthru("uptime"); 
    to
    PHP Code:
    $uptime=exec('uptime'); 
    Didn't do it for me. Neither did:
    PHP Code:
    $uptime=exec("uptime"); 
    Thanks for the suggestion, however. Have you gotten it to work? I'm on a virtual server running FreeBSD / Apache.
    Last edited by Marc Smith; Tue 16 Oct '01, 5:19pm.

    Leave a comment:


  • express
    replied
    Try placing this in your index.php file

    PHP Code:
    $uptime=exec('uptime'); 

    Then place $uptime in your forumhome template

    Leave a comment:


  • montybug
    replied
    did work for me either. even tried changing the passthru to include the exact path to uptime.

    Leave a comment:


  • Marc Smith
    replied
    Originally posted by The Prohacker
    At the bottom of index.php before the closing ?>

    Add:
    PHP Code:
    $uptime=passthru("uptime"); 

    And now edit your forumhome template, and add the var, $uptime, to where ever you want the information to show up....
    I tried this but the display comes up blank where I insert $uptime in the forumhome template. Any other ideas? I saw something about running uptime from the shell command line (I'm a novice at this) a few posts up. Do I also have to do tht?
    Last edited by Marc Smith; Sat 22 Sep '01, 7:09pm.

    Leave a comment:


  • The Prohacker
    replied
    At the bottom of index.php before the closing ?>

    Add:
    PHP Code:
    $uptime=passthru("uptime"); 

    And now edit your forumhome template, and add the var, $uptime, to where ever you want the information to show up....

    Leave a comment:


  • Bouddha
    replied
    Thank you, I'll try when I'll come home

    Leave a comment:


  • Mark Hensler
    replied
    You could use exec(), system(), or passthru() then run the shell command 'uptime'.

    Leave a comment:


  • Bouddha
    started a topic uptime and load average

    uptime and load average

    Would like to put those informations on my index.php
    any ideas ?
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X