User avatar
Keschy
Posts: 21
Joined: Sat Aug 18, 2012 9:30 pm
Location: Mainz / Germany
Contact: Website

My RPi php-Sysinfo-Script - no sudo access required

Sat Sep 22, 2012 7:23 am

For those who are interested:

Download: http://derkev.in/rpisysinfoscript/
Demo: http://keschy.dlinkddns.com/sysinfo/ (might be a bit slow - 14kb/s upload)
Screenshot: http://imgur.com/YRUtS

It's pretty basic at the time but it's a good alternative (not competitor) to Raspcontrol because it doesn't need any root permissions.
My Webpage: http://derkev.in

saif
Posts: 74
Joined: Sun Apr 15, 2012 8:15 pm
Contact: Website

Re: My RPi php-Sysinfo-Script - no sudo access required

Sat Sep 22, 2012 8:18 am

Hi Keschy,

This is good. I like the fact that it has near zero dependency (nothing apart from php and server), being just one single file and of course the no sudo is an extra bonus. If you don't mind, I will borrow some of your ideas (e.g bar charting) for my own similar tool written in perl. ( http://www.windon.themoon.co.uk/NVSM/WebControl ). If it is alright with you, I will also include a link to your site on my help pages for people who are looking for php alternatives (I have already included raspcontrol)

Saif

User avatar
Keschy
Posts: 21
Joined: Sat Aug 18, 2012 9:30 pm
Location: Mainz / Germany
Contact: Website

Re: My RPi php-Sysinfo-Script - no sudo access required

Sat Sep 22, 2012 9:30 am

Thanks for the prositive feedback.
Of course you can use the code. Glad to help you :D

Edit: I just added your site to my blogroll. I really like your project.
My Webpage: http://derkev.in

adream
Posts: 23
Joined: Fri Jul 06, 2012 4:15 pm
Contact: Website

Re: My RPi php-Sysinfo-Script - no sudo access required

Sat Sep 22, 2012 11:49 am

my server status on my RPI

Click the server status menu at the top

probably too much info but i wanted to see how much and how quick..
it also displays cpu speed (variable!) ad cpu temperature
http://212.159.76.122:81/serendipity/

adream
Posts: 23
Joined: Fri Jul 06, 2012 4:15 pm
Contact: Website

Re: My RPi php-Sysinfo-Script - no sudo access required

Sat Sep 22, 2012 11:50 am

Keschy wrote:For those who are interested:

Download: http://derkev.in/rpisysinfoscript/
Demo: http://keschy.dlinkddns.com/sysinfo/ (might be a bit slow - 14kb/s upload)
Screenshot: http://imgur.com/YRUtS

It's pretty basic at the time but it's a good alternative (not competitor) to Raspcontrol because it doesn't need any root permissions.
ooh thats pretty :-)
http://212.159.76.122:81/serendipity/

xcorex
Posts: 4
Joined: Thu Oct 04, 2012 8:01 pm

Re: My RPi php-Sysinfo-Script - no sudo access required

Thu Oct 18, 2012 7:48 pm

Nice script.
My memory modification.

$active_mem = $total_mem - ($free_mem + $buffer_mem + $cache_mem);

Code
http://pastebin.com/4fsEXEGF
Attachments
sysinfo.png
screenshot
sysinfo.png (35.35 KiB) Viewed 6316 times

andrum99
Posts: 1264
Joined: Fri Jul 20, 2012 2:41 pm

Re: My RPi php-Sysinfo-Script - no sudo access required

Sat Oct 20, 2012 9:52 pm

There is an error in version 2 of the Sysinfo script. In the "updateText" Javascript function, it uses the method "innerText", which is non-standard and does not work on Firefox. Changing the script to use the "textContent" method fixes the problem.

xcorex
Posts: 4
Joined: Thu Oct 04, 2012 8:01 pm

Re: My RPi php-Sysinfo-Script - no sudo access required

Sun Oct 21, 2012 12:18 pm

andrum99 wrote:There is an error in version 2 of the Sysinfo script. In the "updateText" Javascript function, it uses the method "innerText", which is non-standard and does not work on Firefox. Changing the script to use the "textContent" method fixes the problem.
Thanks. It worked like a charm!

-heisenberg-
Posts: 21
Joined: Mon Dec 17, 2012 7:12 am

Re: My RPi php-Sysinfo-Script - no sudo access required

Sun Dec 30, 2012 11:38 pm

Nice script, but unfortunately it includes a lot of exec() calls. For every exec(), a shell process has to be spawned, which results in a significant system load and memory consumption. In fact, I was able to crash the RPi by repeatedly accessing the script from several computers concurrently. Also, sometimes the shell process wouldn't terminate and turn into zombies.

So, I rewrote it to use only php-internal calls to gather the same info. You can get my version here: http://pastebin.com/1MYJVw4W. The CPU load and memory consumption are now greatly reduced. I would also recommend using lighttpd with fastcgi, again resulting in lower CPU usage and memory consumption:

Code: Select all

sudo apt-get install lighttpd
sudo lighty-enable-mod fastcgi-php
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/lighttpd start
sudo update-rc.d apache2 disable
sudo update-rc.d lighttpd enable
arm_freq=1100 / core_freq=500 / sdram_freq=450 / over_voltage=6

permaband
Posts: 62
Joined: Wed Aug 01, 2012 2:14 pm
Location: uk
Contact: Website

Re: My RPi php-Sysinfo-Script - no sudo access required

Mon Dec 31, 2012 1:17 am

adream wrote:my server status on my RPI


Click the server status menu at the top

probably too much info but i wanted to see how much and how quick..
it also displays cpu speed (variable!) ad cpu temperature
Uptime 75 days 4 hours 11 minutes
nice :D

are you using the sdcard or have you linked it to a hdd/ssd?

adream
Posts: 23
Joined: Fri Jul 06, 2012 4:15 pm
Contact: Website

Re: My RPi php-Sysinfo-Script - no sudo access required

Mon Dec 31, 2012 1:29 am

Thanks for the re-write, it works fine on my piserver now
-heisenberg- wrote:Nice script, but unfortunately it includes a lot of exec() calls. For every exec(), a shell process has to be spawned, which results in a significant system load and memory consumption. In fact, I was able to crash the RPi by repeatedly accessing the script from several computers concurrently. Also, sometimes the shell process wouldn't terminate and turn into zombies.

So, I rewrote it to use only php-internal calls to gather the same info. You can get my version here: http://pastebin.com/1MYJVw4W. The CPU load and memory consumption are now greatly reduced. I would also recommend using lighttpd with fastcgi, again resulting in lower CPU usage and memory consumption:

Code: Select all

sudo apt-get install lighttpd
sudo lighty-enable-mod fastcgi-php
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/lighttpd start
sudo update-rc.d apache2 disable
sudo update-rc.d lighttpd enable
http://212.159.76.122:81/serendipity/

adream
Posts: 23
Joined: Fri Jul 06, 2012 4:15 pm
Contact: Website

Re: My RPi php-Sysinfo-Script - no sudo access required

Mon Dec 31, 2012 1:34 am

I'm using an SD card yes, it will be interesting to see how long it lasts, i suspect quite a long time
the server is pretty busy so a fair number of writes to card,mysql etc..
now i just need to find a way to keep it powered while i install a ups,

quite proud of 75 days :-)


permaband wrote:
adream wrote:my server status on my RPI

Click the server status menu at the top

probably too much info but i wanted to see how much and how quick..
it also displays cpu speed (variable!) ad cpu temperature
Uptime 75 days 4 hours 11 minutes
nice :D

are you using the sdcard or have you linked it to a hdd/ssd?
http://212.159.76.122:81/serendipity/

adream
Posts: 23
Joined: Fri Jul 06, 2012 4:15 pm
Contact: Website

Re: My RPi php-Sysinfo-Script - no sudo access required

Wed Feb 13, 2013 12:13 am

indeed the above script is great EXCEPT

my pi has been taken down by a ddos aimed at the script page, 1500 requests for the script over 90 seconds and apache went into terminal meltdown, and the pi needs rebooting

just aim apachbench at the page and see the results, i was attacked from germany and portugal at the same time and it was terminal

i have since tested this vulnerability with lighttpd instead of apache and the pi crashed

heres a repeated message from lighttpd error log just before death

2013-02-12 23:45:08: (mod_fastcgi.c.2676) FastCGI-stderr: PHP Notice: Undefined variable: shared_mem in /var/www/sysinfo/index.php on line 106
http://212.159.76.122:81/serendipity/

Return to “Networking and servers”