175 points · by afaqurk · 12y ago · 68 comments
e.g. # uptime.php <?php echo (int) (shell_exec('cat /proc/uptime')/(60*60));
What ideas do you have about reading the stats? You'll have to use a server side language anyway (or do you plan to read data from a third party service with a restful api?)
edit: if you want to have a zero-install tool I'd suggest to go with python plus bottle (a one file webframework), so that you would be able to clone and use it from any directory.
More of a problem for admin dashboards which have two-way control, which this one must if it can do on-demand refresh.
That's why I prefer munin static pages.
How difficult would it be to create widgets that show application-level stats like number of visitors on site or conversion rates (e.g. calculated from google analytics).
I'm tired of having to loging to google analytics, lulu.com, and gumroad in three different tabs....
[0] http://shopify.github.io/dashing/
[1] https://github.com/Shopify/dashing/wiki/Additional-Widgets
no one is running an X server on their production servers, perhaps unless somehow related to their actual purpose (screenshots, ui testing, etc.)
$ git clone https://github.com/afaqurk/linux-dash.git
$ mv linux-dash/ /var/www/
At the very least you would want to put some access control in front of this.
The example was for Apache webserver.
> At the very least you would want to put some access control in front of this.
You're right, access control would be in order. Though I was merely suggesting the fastest way to try it out.
Looks really nice. Was this built for Debian-based distros?
Still, the interface is really cool!
However, multi-server support would make this even more amazing.
Requires a distro w/ "proc" functionality for the most metrics.
Also you can put it behind http auth or restrict the vhost by IP etc
Can you elaborate on this? I'm looking for you to clarify which other dynamic languages would be considered less risky in this specific application and why.
However, I'd rather not have a program execute a shell command when it receives a PHP request. Written in PHP or not. It's just wrong.
>Other dynamic languages have similar risks but at least they don't have a history[1,2] of making completely stupid decisions when it comes to security.
Yes like Ruby and Active Records SQL injection debacle where Github was pwned and the developers din't seem to care?
I can't argue that PHP is better than other languages, but holding it to f*ck ups from over 5+ years ago, most of which have been fixed, is a low.
If you can find something vulnerable within this open source coded, then I happy to hear you out and would prefer that than your unregistered paranoia.
Also, sorry for being harsh but this kind of attitude just deters people from contributing to open source unless they follow the 'elite' practices of the hivemind.
Think of all the libraries that are just abstraction layers to imagemagick or ffmpeg. Do you really think there no legitimite use case for executing commands via some web program?
Back-end: a daemon process that runs at an interval, collecting data and writing it to a data store.
Front-end: connects to the data store, processes statistics, and formats for display.
By constructing your application in this way, the data store acts as a firewall between the system calls required to collect the data and the interface used to view the data. Your daemon application needn't listen on any network ports if it is running locally.
Your web application still needs to be secure, but you don't have the additional risk of many calls to system/shell exec commands that are a honey pot for exploitation.
By collecting the data periodically (i.e a cron job) you eliminate most possible vulnerabilities.