Skip to content

Commit

Permalink
Change default dbfile location to same directory as watch.php, and au…
Browse files Browse the repository at this point in the history
…to detect plesk admin pw for #4
  • Loading branch information
justyns committed Oct 17, 2011
1 parent 4bbc47e commit ca5da03
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
16 changes: 11 additions & 5 deletions watch.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* filename: watch.php
* author: Justyn Shull <justyn [at] justynshull.com>
* Created: July 21, 2011
* Last Updated: September 9, 2011
* Last Updated: October 16, 2011
*
* Meant to be used as a replacement for Pat's watch.py script
* Instructions:
Expand All @@ -17,14 +17,20 @@
*
*/
/** Config * */
$dbfile = "watch.db";
$dbfile = __DIR__ . DIRECTORY_SEPARATOR . "watch.db";
$interval = 60; // Every 60 seconds
$watchmysql = true; //Whether or not to monitor mysql
$watchhttp = true; //whether to get /server-status
$serverstatusurl = "http://localhost/server-status";
$mysql['user'] = 'root'; //User and pass to login to
$mysql['pass'] = ''; // mysql with
//TODO: Get mysql admin password automatically if its a plesk server
if (is_readable("/etc/psa/.psa.shadow")) {
//Appears to be a plesk machine
$mysql['user'] = 'admin';
$mysql['pass'] = file_get_contents("/etc/psa/.psa.shadow");
} else {
//Non-Plesk machine. Set mysql information manually
$mysql['user'] = 'root'; //User and pass to login to
$mysql['pass'] = ''; // mysql with
}

/** Check requirements * */
//dl() doesn't work after 5.3 and only works in certain cases anyway
Expand Down
7 changes: 4 additions & 3 deletions watchview.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
* filename: watchview.php
* author: Justyn Shull <justyn [at] justynshull.com>
* Created: July 21, 2011
* Last Updated: August 11, 2011
* Last Updated: October 16, 2011
*
* Displays stats taken from watch.db created by watch.php
*
* Changelog:
* 08/03/2011 - Added ob_start() before outputting the html pages
* - Added a no_cache header to the primary html page
* - Added a no_cache header to the primary html page
* 08/11/2011 - Added previous and next links to detail view
* 10/16/2011 - Added swap usage details to memory graph
* - Use a more sensible default location of watch.db
*/
/** Config * */
$dbfile = "watch.db";
$dbfile = __DIR__ . DIRECTORY_SEPARATOR . "watch.db";
$watchview = $_SERVER['PHP_SELF'];

function compress_data($data_string) {
Expand Down

0 comments on commit ca5da03

Please sign in to comment.