BetaArchive Logo
Total Current Archive Size: 4765.54GB in 15409 files
Navigation Home Screenshots Image Uploader Server Info FTP Servers Wiki Forum RSS Feed Rules Please Donate
UP: 10d, 18h, 8m | CPU: 15% | MEM: 5707MB of 12279MB used
{The community for beta collectors}

Forum rules


Before you post, please make sure...

- ...you have first used Google to look for an answer, and you have asked other people you know via other methods (IM, e-mail, etc).
- ...your question has not been asked before. Search the forum first before posting.

If you meet those criteria, go ahead and post your question. Be sure to provide as much information you can about the problem and how to recreate it. Also provide information on hardware and software if applicable.


Post new topic Reply to topic  [ 8 posts ] 
Author Message
 PostPost subject: How to make a server usage meter?        Posted: Fri Feb 08, 2008 2:21 pm 
Pro Beta Collector
Pro Beta Collector
Offline

Joined
Tue Oct 23, 2007 11:21 pm

Posts
593
How to make a server usage meter like this one?

http://www.betaarchive.co.uk/cpu.php


Top  Profile
 PostPost subject:        Posted: Fri Feb 08, 2008 5:06 pm 
Amateur Beta Collector
Amateur Beta Collector
Offline

Joined
Wed Jun 27, 2007 8:13 pm

Posts
131

Location
France
You can use SNMP to get the data.
Then you can read the manual to use it with php :)


I love Munin ...


Top  Profile  WWW
 PostPost subject:        Posted: Fri Feb 08, 2008 5:21 pm 
Site Administrator
Site Administrator
User avatar
Offline

Joined
Fri Aug 18, 2006 11:47 am

Posts
11407

Location
Merseyside, United Kingdom

Favourite OS
Microsoft Windows 7 Ultimate x64
Uptime is done primarily through PHP
CPU is a custom made program that is not available for release
Memory is an external program manipulated by PHP.

Only the graphs are done by SNMP, not the data on that bar.

_________________
Image


Top  Profile  WWW
 PostPost subject:        Posted: Fri Feb 08, 2008 5:36 pm 
Pro Beta Collector
Pro Beta Collector
Offline

Joined
Tue Oct 23, 2007 11:21 pm

Posts
593
@thenico: SNMP should be kinda cool, but for some strange reason, by installing it, add/remove programs asks me for a XP CD. I have some XP CDs, but they don't match my language and service pack.

@Andy: I can make CPU monitoring and memory monitoring in AutoIt. I think PHP can read the console stream (not the command prompt stream).

EDIT#1:
Well, here's it: a memory stat program in AutoIt.

Code:
; obtain stats
$MStats = MemGetStats()

; cut the dots (we don't need what's after them) and convert values to MB
; StringSplit is virtually the same as PHP explode()
; yet another bug requires +1 to free memory; eg. if the system have 255 MB RAM and 156 MB are free,
; MemGetStats returns 98 MB in free memory.
$total2 = StringSplit($MStats[1] / 1024,".")
$used2 = StringSplit(($MStats[1] - $MStats[2]) / 1024,".")
$free2 = StringSplit(($MStats[2] / 1024) + 1,".")
$total = $total2[1]
$used = $used2[1]
$free = $free2[1]

; write the stats to console stream (not the stdout!)
ConsoleWrite("<b>Total memory:</b> " & $total & " MB, Used: " & $used & " MB, Free: " & $free & " MB" & @CRLF)



Compiled version is here.

EDIT#2:
THE LINK IS NOW OK.
Good news: PHP can read command output via console stream.
Only tested with passthru().


Top  Profile
 PostPost subject:        Posted: Mon Feb 11, 2008 12:42 pm 
Pro Beta Collector
Pro Beta Collector
Offline

Joined
Tue Oct 23, 2007 11:21 pm

Posts
593
New version. See the link. (if you can't find it...)

<blink>For hardware monitoring to work, you must have EVEREST installed and open. Don't forget to go to</blink> File > Preferences > Hardware monitoring > External Applications > tick Enable writing sensor values to Registry > Select All.

WARNING: If PHP don't runs as the same user as EVEREST (eg. when Abyss is installed as service), the program doesn't work. The workaround is: Start > Run > services.msc > Right-click "Abyss Web Server" or "Apache2" > Properties > Logon > This account > your user in the first input box > the other two with your user's password. Restart the web server to make guarantee.

Video tutorial (the configuring EVEREST one):
http://www.mephost.com/~richard/betaarc ... gistry.htm
A small typo leads the File menu to appear too fast.
I clicked the first item, which is "Preferences".

_________________
you've got to fling yourself. fling into space.


Top  Profile
 PostPost subject:        Posted: Mon Feb 11, 2008 5:57 pm 
1337 Beta Collector
1337 Beta Collector
User avatar
Offline

Joined
Mon Sep 04, 2006 1:06 pm

Posts
1010

Location
USA

Favourite OS
Mac OS X 10.5
A while ago the script you see above was still offered on the AbyssUnderground website: http://web.archive.org/web/200602080942 ... script.php

(Andy: if you want that removed, feel free to get rid of it)

_________________
Old-Computer
BetaArchive VIP | Ex-OSBA Member


Top  Profile  WWW
 PostPost subject:        Posted: Mon Feb 11, 2008 10:59 pm 
Site Administrator
Site Administrator
User avatar
Offline

Joined
Fri Aug 18, 2006 11:47 am

Posts
11407

Location
Merseyside, United Kingdom

Favourite OS
Microsoft Windows 7 Ultimate x64
Its still available on the old site (http://old.abyssunderground.co.uk). This is an unsupported script though because it doesn't work on all systems. The CPU Usage is got from WMI which is slow and buggy.

_________________
Image


Top  Profile  WWW
 PostPost subject:        Posted: Tue Feb 12, 2008 6:22 pm 
Pro Beta Collector
Pro Beta Collector
Offline

Joined
Tue Oct 23, 2007 11:21 pm

Posts
593
I tried phpSysInfo and it's good. (Edited 26/Nov/2009)
It supports several sensors programs, including the popular Motherboard Monitor 5 (Windows) and LM-Sensors (Linux). (Edited 26/Nov/2009)
Also, version 3 has UPS support, but only apcupsd at this time. (Edited 26/Nov/2009)

http://phpsysinfo.sourceforge.net

_________________
you've got to fling yourself. fling into space.


Top  Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 




Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

All views expressed in these forums are those of the author and do not necessarily represent the views of the BetaArchive site owner.

Powered by phpBB® Forum Software © phpBB Group

Copyright © 2006-2013

 

Sitemap | XML | RSS