MEWBIES@: Facebook Twitter G+ YouTube DeviantArt Forum Wall
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██ ██
█▌ - HOW TO INSTALL PHPSYSINFO FOR LINUX - █▌
█▌ █▌
█ ▐▌
█ phpSysInfo is fabulous PHP script to easily check on your computer's ▐▌
█ system information. From the site "It will display items such as Uptime, ▐▌
█ CPU, Memory, SCSI, IDE, PCI, Ethernet, Floppy, and Video Information." ▐▌
█ phpSysInfo site is HERE, SourceForge page is HERE and GitHub page HERE. ▐▌
█ There is a demo HERE. The forum is HERE and HERE. ▐▌
█ ▐▌
█ I hadn't planned on writing a tutorial for this; I thought it would be a ▐▌
█ fun 5 minute setup :D. Then I ran into a few problems and...so here is how ▐▌
█ I did it on my Debian with PHP 5.2.6. Much credit to the author jacky672 ▐▌
█ and the information on phpsysinfo forums. In fact, it's quite easy to have ▐▌
█ running smoothly, if you have an understanding of such matters :D ▐▌
█ ▐▌
█ PREREQUISITES ▐▌
█ AUTO INSTALL PHPSYSINFO ▐▌
█ MANUAL INSTALL PHPSYSINFO ▐▌
█ config.php NOTES ▐▌
█ TROUBLE SHOOTING ▐▌
█ INTEGRATE TEMPERATURE READINGS INTO PHPSYSINFO ▐▌
█ LM-SENSORS FOR CPU ▐▌
█ HDDTEMP FOR HARD DRIVES ▐▌
█ PHPSYSINFO INCLUDED PLUGINS ▐▌
█ BAT ▐▌
█ IPMI ▐▌
█ MDStatus ▐▌
█ PS ▐▌
█ PSStatus ▐▌
█ Quotas ▐▌
█ SMART ▐▌
█ APCUPSD ▐▌
█ PASSWORD PROTECT PHPSYSINFO OR DISABLE IT ▐▌
█ ▐▌
█ PREREQUISITES: ▐▌
█ `````````````` ▐▌
█ Web Server ▐▌
█ PHP 5.2 + ▐▌
█ ▐▌
█ AUTO INSTALL PHPSYSINFO: ▐▌
█ ```````````````````````` ▐▌
█ NOTES phpsysinfo-3.0.4: ▐▌
█ I tried both aptitude install and manually installing phpsysinfo with a ▐▌
█ number of problems. If you do have problems with the auto install; after ▐▌
█ follow the directions in the 'MANUAL INSTALL PHPSYSINFO' section below. ▐▌
█ ▐▌
█ INSTALL: ▐▌
█ Install by doing: ▐▌
█ aptitude install phpsysinfo ▐▌
█ This will install phpsysinfo vx.x.x here: /usr/share/phpsysinfo/ ▐▌
█ With a short cut here: /var/www/phpsyinfo ▐▌
█ Now you can test it here: http://yoursite.com/phpsysinfo/ and ▐▌
█ /phpsysinfo/xml.php and /phpsysinfo/index.php?disp=static ▐▌
█ ▐▌
█ If you don't have any problems running phpsysinfo skip to ▐▌
█ 'config.php NOTES' section below. ▐▌
█ ▐▌
█ Note that if you did auto install it, my editing file instructions below ▐▌
█ you'll need to change the path to your own. For example: ▐▌
█ /var/www/phpsysinfo/ ▐▌
█ Change to: ▐▌
█ /usr/share/phpsysinfo/ ▐▌
█ ▐▌
█ My results: ▐▌
█ I ended up with the phpsysinfo web page giving errors such as: ▐▌
█ 'Fatal error: Can't be cloned in /usr/share/phpsysinfo/includes/class.Error.inc.php on line 75'
█ 'Fatal error: Can't be cloned in /var/www/phpsysinfo/includes/error/class.Error.inc.php on line 80'
█ ▐▌
█ If you do receive this error you can fix it by: ▐▌
█ pico /etc/php5/apache2/php.ini ▐▌
█ search for (Ctrl+w): zend.ze1_compatibility_mode ▐▌
█ It will have this: ▐▌
█ zend.ze1_compatibility_mode = On ▐▌
█ Change it to: ▐▌
█ zend.ze1_compatibility_mode = Off ▐▌
█ ▐▌
█ Note: zend.ze1_compatibility_mode: Removed in PHP 5.3.0 Read HERE. ▐▌
█ ▐▌
█ Then restart your web server: ▐▌
█ /etc/init.d/apache2 restart ▐▌
█ ▐▌
█ My results were the page loaded nicely 'once'. After that it would never ▐▌
█ load complete again only stating 'Loading... please wait!'. ▐▌
█ To fix I have read, though it didn't work for me, to do: ▐▌
█ aptitude install php5-xsl ▐▌
█ /etc/init.d/apache2 restart ▐▌
█ ▐▌
█ If you run into problems and want to remove it and install manually, as I ▐▌
█ have below, then do this first: ▐▌
█ aptitude --purge remove phpsysinfo ▐▌
█ And if you are left with any files: ▐▌
█ rm /usr/share/phpsysinfo -rf ▐▌
█ rm /var/www/phpsyinfo ▐▌
█ ▐▌
█ ▐▌
█ MANUAL INSTALL PHPSYSINFO: ▐▌
█ `````````````````````````` ▐▌
█ Some dependencies that are needed; php5-xsl libapache2-mod-php5 php5-mysql ▐▌
█ php5-curl lsscsi ▐▌
█ To view if you have them installed already: ▐▌
█ dpkg -l | grep -e lsscsi -e php5 ▐▌
█ Remove those that you have already from the install line below. ▐▌
█ su ▐▌
█ aptitude install php5-xsl libapache2-mod-php5 php5-mysql php5-curl lsscsi ▐▌
█ (if you want to know more about lsscsi: man lsscsi) ▐▌
█ ▐▌
█ cd /var/www/ ▐▌
█ wget http://citylan.dl.sourceforge.net/project/phpsysinfo/phpsysinfo/3.0.4/phpsysinfo-3.0.4.tar.gz
█ tar xvzf phpsysinfo-3.0.4.tar.gz ▐▌
█ ▐▌
█ If you would like to rename your directory to another name, for instance ▐▌
█ psi: ▐▌
█ mv -i phpsysinfo psi ▐▌
█ cd psi or if you didn't rename: cd phpsysinfo ▐▌
█ cp config.php.new config.php ▐▌
█ pico config.php ▐▌
█ ▐▌
█ Read the description for each setting and make your desired changes. For an▐▌
█ example only I have put my config.php HERE, and read the notes below first.▐▌
█ ▐▌
█ config.php NOTES: ▐▌
█ 1. Set this to true so we can trouble shoot: define('PSI_DEBUG', true); ▐▌
█ ▐▌
█ 2. Go ahead and set your temperature format to your liking e.g.: ▐▌
█ define('PSI_TEMP_FORMAT', 'c-f'); ▐▌
█ ▐▌
█ 3. Leave these 3 lines false for now, or you won't be able to open your ▐▌
█ phpsysinfo web page to test, we'll get to them later: ▐▌
█ define('PSI_PLUGINS', false); ▐▌
█ define('PSI_SENSOR_PROGRAM', false); ▐▌
█ define('PSI_HDD_TEMP', false); ▐▌
█ ▐▌
█ Now you can test it here (or whatever you changed the directory name to): ▐▌
█ http://yoursite.com/phpsysinfo/ and /phpsysinfo/xml.php and ▐▌
█ /phpsysinfo/index.php?disp=static ▐▌
█ ▐▌
█ TROUBLE SHOOTING: ▐▌
█ 1. If you receive either one of these errors and your web page will not ▐▌
█ load: ▐▌
█ Strict Standards: Implicit cloning object of class 'Error' because of ▐▌
█ 'zend.ze1_compatibility_mode' or 'Fatal error: Can't be cloned in ▐▌
█ /var/www/phpsysinfo/includes/class.Error.inc.php on line 75' ▐▌
█ ▐▌
█ You can fix it by doing: ▐▌
█ pico /etc/php5/apache2/php.ini ▐▌
█ Search for (Ctrl+w): zend.ze1_compatibility_mode ▐▌
█ It will have this: ▐▌
█ zend.ze1_compatibility_mode = On ▐▌
█ Change it to: ▐▌
█ zend.ze1_compatibility_mode = Off ▐▌
█ ▐▌
█ Note: zend.ze1_compatibility_mode: Removed in PHP 5.3.+ Read HERE. ▐▌
█ ▐▌
█ Then restart your web server: ▐▌
█ /etc/init.d/apache2 restart ▐▌
█ ▐▌
█ Test your page again. ▐▌
█ ▐▌
█ 2. If you have an exclamation point icon top left- this is the debugging ▐▌
█ information. Click on it for more information to sort out the problems. ▐▌
█ For example if yours has this: ▐▌
█ find_program(xxxxxxxx) ▐▌
█ <snip> ▐▌
█ Solve it by doing: apt-get install xxxxxxxx ▐▌
█ Replacing 'xxxxxxxx' with the the program name it is complaining about. ▐▌
█ ▐▌
█ My debugging has this (since my OS is Debian, read HERE if yours is too): ▐▌
█ find_program(lsb_release) ▐▌
█ program not found on the machine ▐▌
█ <snip> ▐▌
█ ▐▌
█ For OSes other that Debian do this: ▐▌
█ apt-get install lsb_release base-files ▐▌
█ ▐▌
█ For Debian, disable that error: ▐▌
█ pico /var/www/phpsysinfo_3.0.4/includes/os/class.Linux.inc.php ▐▌
█ Search for (Ctrl+w) (line 499): lsb_release', '-a 2 ▐▌
█ Change this line: ▐▌
█ if (CommonFunctions::executeProgram('lsb_release', '-a 2> /dev/null', $distro_info, PSI_DEBUG)) {
█ To this:
█ if (CommonFunctions::executeProgram('lsb_release', '-a 2> /dev/null', $distro_info, false)) {
█ ▐▌
█ 3. If your page shows: ▐▌
█ Bad Request ▐▌
█ Error 400: ▐▌
█ Your browser sent a request that this server could not understand. ▐▌
█ Size of a request header field exceeds server limit. ▐▌
█ Cookie: HardwareTree=24|22|20|7|<snip blah blah> ▐▌
█ ▐▌
█ This is because the cookie your browser is storing is either too large or ▐▌
█ it has been corrupted. Very easy to fix; remove the cookie for that site: ▐▌
█ Firefox: Tools/Options/Privacy/ click on the blue text bottom right ▐▌
█ 'remove individual cookies', then select the cookie, click Remove Cookies. ▐▌
█ ▐▌
█ Older versions: Tools/Options/Privacy/Show Cookies/Browse in the list to ▐▌
█ the site that you want to clear the cookie for, select it then click ▐▌
█ Remove Cookie, click Close/OK. Now try your page again. ▐▌
█ ▐▌
█ IE: Tools/Internet Options/General tab, under 'Browsing history' click the ▐▌
█ Settings button, click OK if prompted about size, Temporary Internet Files ▐▌
█ window click View Files/ explorer window will open, browse to the cookie ▐▌
█ you want to delete, for example cookie:user@yoursite.com, then delete it. ▐▌
█ Opera: Tools/Preferences/Advanced tab/select Cookies on left pane/click ▐▌
█ Manage Cookies button/browse the cookie you want to delete, click ▐▌
█ Delete/Close/OK. ▐▌
█ Safari: Edit/Preferences/Security/click Show Cookies button/browse to the ▐▌
█ cookie you want to delete, select it, click Remove/Done/Red X to close it. ▐▌
█ ▐▌
█ INTEGRATE TEMPERATURE READINGS INTO PHPSYSINFO: ▐▌
█ ▐▌
█ LM-SENSORS FOR CPU: ▐▌
█ `````````````````` ▐▌
█ apt-get install lm-sensors ▐▌
█ (If you want to know more about lm-sensors: man lm-sensors press q to quit)▐▌
█ sensors-detect ▐▌
█ Hit enter key when prompted YES/No questions to select the default answer ▐▌
█ for all. (You can easily modify these by running sensors-detect again if ▐▌
█ needed later.) ▐▌
█ ▐▌
█ If sensors-detect hangs on a sensor; make a note which one, then press ▐▌
█ Ctrl+C to quit sensors-detect. ▐▌
█ Then run sensors-detect again and answer No to the one that it hung on. ▐▌
█ ▐▌
█ At the end you'll have been prompted to add lines to your /etc/modules. ▐▌
█ ▐▌
█ This is the reply I received: ▐▌
█ To load everything that is needed, add this to /etc/modules: ▐▌
█ #----cut here---- ▐▌
█ # Chip drivers ▐▌
█ w83627hf ▐▌
█ k8temp ▐▌
█ #----cut here---- ▐▌
█ ▐▌
█ Now you need to add the output that it replied with, as shown above: ▐▌
█ pico /etc/modules ▐▌
█ Mine has this: ▐▌
█ loop ▐▌
█ ▐▌
█ Changed it to, using example above, (add your own output): ▐▌
█ loop ▐▌
█ # Chip drivers ▐▌
█ w83627hf ▐▌
█ k8temp ▐▌
█ ▐▌
█ Now start it: ▐▌
█ /etc/init.d/module-init-tools ▐▌
█ reply: Loading kernel modules...done. ▐▌
█ JFYI (just for your information): ▐▌
█ /etc/init.d/module-init-tools start ▐▌
█ /etc/init.d/module-init-tools stop ▐▌
█ /etc/init.d/module-init-tools restart ▐▌
█ /etc/init.d/module-init-tools force-reload ▐▌
█ By the way it has a run level 'S' - it will run at start up on its own. ▐▌
█ ▐▌
█ Now to load the modules that you have added above to /etc/modules, ▐▌
█ changing the module name below to your own, for the example above, I ▐▌
█ would run: ▐▌
█ modprobe w83627hf ▐▌
█ modprobe k8temp ▐▌
█ And then to update the modules (previously known as update-modules): ▐▌
█ depmod -a ▐▌
█ ▐▌
█ After the update is finished, test lm-sensors by running: ▐▌
█ sensors ▐▌
█ ▐▌
█ Your reply should be similar to: ▐▌
█ k8temp-pci-00c3 ▐▌
█ Adapter: PCI adapter ▐▌
█ Core0 Temp: +29.0 C ▐▌
█ ▐▌
█ w83627thf-isa-0290 ▐▌
█ Adapter: ISA adapter ▐▌
█ VCore: +1.43 V (min = +0.70 V, max = +1.87 V) ▐▌
█ +12V: +11.98 V (min = +1.95 V, max = +6.02 V) ALARM ▐▌
█ +3.3V: +3.36 V (min = +0.00 V, max = +1.58 V) ALARM ▐▌
█ +5V: +4.99 V (min = +1.81 V, max = +3.84 V) ALARM ▐▌
█ -12V: -11.46 V (min = -14.91 V, max = -4.38 V) ▐▌
█ V5SB: +5.05 V (min = +2.85 V, max = +0.43 V) ALARM ▐▌
█ VBat: +3.49 V (min = +3.62 V, max = +0.02 V) ALARM ▐▌
█ fan1: 2721 RPM (min = 8035 RPM, div = 2) ALARM ▐▌
█ CPU Fan: 3054 RPM (min = -1 RPM, div = 2) ALARM ▐▌
█ fan3: 0 RPM (min = 168750 RPM, div = 2) ALARM ▐▌
█ M/B Temp: +36.0 C (high = +5.0 C, hyst = +0.0 C) ALARM sensor = ▐▌
█ thermistor ▐▌
█ CPU Temp: +30.5 C (high = +60.0 C, hyst = +55.0 C) sensor = ▐▌
█ thermistor ▐▌
█ temp3: +65.5 C (high = +60.0 C, hyst = +55.0 C) ALARM sensor = ▐▌
█ thermistor ▐▌
█ cpu0_vid: +0.000 V ▐▌
█ beep_enable:enabled ▐▌
█ ▐▌
█ ▐▌
█ Now to add lm-sensors to phpsysinfo: ▐▌
█ pico /var/www/phpsysinfo/config.php ▐▌
█ Where it has this: ▐▌
█ define('sensorProgram', false); ▐▌
█ and this: ▐▌
█ define('PSI_HDD_TEMP', false); ▐▌
█ ▐▌
█ Change it to: ▐▌
█ define('PSI_SENSOR_PROGRAM', 'LMSensors'); ▐▌
█ define('PSI_HDD_TEMP', true); ▐▌
█ ▐▌
█ Try your web page again; it should now have 3 new tables; VOLTAGE, ▐▌
█ TEMPERATURE, & FANS. If you see an exclamation point image on the top ▐▌
█ left, click on it to find out the reason and trouble shoot from there. If ▐▌
█ it states 'hddtemp', not to worry, that is next. ▐▌
█ ▐▌
█ HDDTEMP FOR HARD DRIVES: ▐▌
█ ```````````````````````` ▐▌
█ apt-get install hddtemp ▐▌
█ (If you want to know more about hddtemp: man hddtemp) ▐▌
█ ▐▌
█ Select <Yes> to all the questions asked by using your arrow or tab key ▐▌
█ then hitting Enter. You can easily modify these settings later if needed. ▐▌
█ (You'll be asked 3 questions: to run as a daemon, to listen on local IP, ▐▌
█ and what port). After it is finished it will reply similar to: ▐▌
█ Starting disk temperature monitoring daemon: hddtemp: /dev/hda. ▐▌
█ ▐▌
█ It will run as a daemon (run levels 2-5). ▐▌
█ To modify any of these settings: ▐▌
█ dpkg-reconfigure hddtemp ▐▌
█ or ▐▌
█ pico /etc/default/hddtemp ▐▌
█ ▐▌
█ Try your web page again; it should now state the temperature for your hard ▐▌
█ drive/s under the TEMPERATURE table. For example mine has: ▐▌
█ /dev/hda (WDC WD400BB-22JHC0) 33.0 C (91.4 F) 60.0 C (140.0 F) ▐▌
█ ▐▌
█ If there is an exclamation point image on the top left, click on it to ▐▌
█ find out the reason and trouble shoot from there. ▐▌
█ ▐▌
█ Not needed: If you want to make changes to sensors.conf: ▐▌
█ man sensors.conf ▐▌
█ pico /etc/sensors3.conf ▐▌
█ ▐▌
█ Now test hddtemp cmd: ▐▌
█ hddtemp -v ▐▌
█ If you receive 'hddtemp: command not found' run this: ▐▌
█ dpkg-reconfigure hddtemp ▐▌
█ answer Yes to all ▐▌
█ Then try it again: ▐▌
█ hddtemp -v ▐▌
█ ▐▌
█ NOT NEEDED, JFYI- HDDTEMP VIEW IN CONSOLE: ▐▌
█ 1) To view hard drive temperature in your console: ▐▌
█ hddtemp /dev/hda ▐▌
█ or yours might be: hddtemp /dev/sda ▐▌
█ Reply similar to: ▐▌
█ /dev/hda: WDC WD400BB-22JHC0: 35 C ▐▌
█ ▐▌
█ Replace the 'a' in hda or sda with the drive letter you want hddtemp to ▐▌
█ report on. ▐▌
█ Some examples of hard drive names: ▐▌
█ /dev/hda master device on primary IDE channel ▐▌
█ /dev/hdb slave device on primary IDE channel ▐▌
█ /dev/hdc master device on secondary IDE channel ▐▌
█ /dev/hdd slave device on secondary IDE channel ▐▌
█ /dev/sda first SCSI hard drive ▐▌
█ /dev/sdb second SCSI hard drive ▐▌
█ ▐▌
█ 2) If you would like to shorten the reply to temperature only e.g. 35: ▐▌
█ hddtemp -n /dev/hda ▐▌
█ ▐▌
█ Or if you would like reply to have ' C' count the characters from the ▐▌
█ beginning of the reply until where you want it to reply. Using my example ▐▌
█ above the cmd would be, to reply only the 31st - 35th characters: ▐▌
█ hddtemp /dev/hda | cut -c 31-35 ▐▌
█ ▐▌
█ 3) To display temperature in Fahrenheit: ▐▌
█ hddtemp /dev/hda -uf ▐▌
█ ▐▌
█ PHPSYSINFO INCLUDED PLUGINS: ▐▌
█ ```````````````````````````` ▐▌
█ Included with v3.0.4 are a variety of plugins (phpsysinfo/plugins/) to ▐▌
█ enable more information. Each plugin has its own *.config.php file ▐▌
█ containing instructions how to enable it. ▐▌
█ BAT: Battery Statistic Data - for Laptops ▐▌
█ ipmi: IPMI (enabled devices) Statistic Data ▐▌
█ MDStatus: RAID Statistic Data ▐▌
█ PS: Process Statistic Data (currently running processes) ▐▌
█ PSStatus: Process Statistic Data for programs such as Apache, MySQL, SSHD ▐▌
█ Quotas: repquota Statistic Data (disk usage and quotas for file systems) ▐▌
█ SMART: S.M.A.R.T (enabled devices) Statistic Data ▐▌
█ ▐▌
█ PLUGIN NOTES: ▐▌
█ 1) If a plugin isn't working correctly for you, you can trouble shoot the ▐▌
█ error by going to: ▐▌
█ http://yoursite.com/phpsysinfo/xml.php?plugin=PLUGINS_NAME, for example: ▐▌
█ http://yoursite.com/phpsysinfo/xml.php?plugin=MDStatus ▐▌
█ http://yoursite.com/phpsysinfo/xml.php?plugin=SMART ▐▌
█ ▐▌
█ 2) To have your phpsysinfo page display data from a file and not a command,▐▌
█ you would change in the plugin's *.config.php file 'command' to 'data'. ▐▌
█ For example I did this for BAT & MDStatus since I do not have either, but ▐▌
█ wanted to do the steps for this tutorial. Note that the data shown on ▐▌
█ phpsysinfo page will be false and or not up to date with this method since ▐▌
█ it is only showing the data that you have given it in its *.txt file. ▐▌
█ For my 'fake' data *.txt files I just used the same data as phpsysinfo, ▐▌
█ for example HERE, HERE and HERE, or download their data samples HERE. ▐▌
█ ▐▌
█ 3) For many of the cmds below you need to su / logged in as root or your ▐▌
█ output will be: command not found ▐▌
█ ▐▌
█ BAT: ▐▌
█ ```` ▐▌
█ Since I'm not doing this on a laptop I don't use it, but this is how you ▐▌
█ would do it: ▐▌
█ Save the output from the cmds below: ▐▌
█ cat /proc/acpi/battery/BAT0/info ▐▌
█ cat /proc/acpi/battery/BAT0/state ▐▌
█ ▐▌
█ Create a new file and paste in the output of /info from above: ▐▌
█ pico /var/www/phpsysinfo/data/bat_info.txt ▐▌
█ Create a new file and paste in the output of /state from above: ▐▌
█ pico /var/www/phpsysinfo/data/bat_state.txt ▐▌
█ ▐▌
█ To define your battery device: ▐▌
█ pico /var/www/phpsysinfo/plugins/BAT/BAT.config.php ▐▌
█ Replace BATO with your battery device on this line: ▐▌
█ define('PSI_PLUGIN_BAT_DEVICE', 'BAT0'); ▐▌
█ ▐▌
█ Then to enable it on phpsysinfo: ▐▌
█ pico /var/www/phpsysinfo/config.php ▐▌
█ Change this line: ▐▌
█ define('PSI_PLUGINS', false); ▐▌
█ To: ▐▌
█ define('PSI_PLUGINS', 'BAT'); ▐▌
█ ▐▌
█ Now test your phpsysinfo page. It should now have BATTERY STATUS. ▐▌
█ ▐▌
█ IPMI: ▐▌
█ ````` ▐▌
█ Again another plugin I can't use; ipmitool, but this is how you would do ▐▌
█ it: ▐▌
█ First check if you have IPMI devices here: ▐▌
█ /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0 ▐▌
█ If you don't have those paths/files chances are you do not have IPMI ▐▌
█ enabled devices. ▐▌
█ If you do: ▐▌
█ aptitude install ipmitool ▐▌
█ man ipmitool ▐▌
█ ipmitool sensor ▐▌
█ (A good IPMItool article here.) ▐▌
█ ▐▌
█ Create a file with the output of 'ipmitool sensor': ▐▌
█ pico /var/www/phpsysinfo/data/ipmi.txt ▐▌
█ ▐▌
█ Then to enable it on phpsysinfo: ▐▌
█ pico /var/www/phpsysinfo/config.php ▐▌
█ Change this line: ▐▌
█ define('PSI_PLUGINS', false); ▐▌
█ To: ▐▌
█ define('PSI_PLUGINS', 'ipmi'); ▐▌
█ ▐▌
█ Or if you had other plugins on it, it would be for example: ▐▌
█ define('PSI_PLUGINS', 'BAT,ipmi'); ▐▌
█ ▐▌
█ Now test your phpsysinfo page. It should now have IPMI STATUS. ▐▌
█ ▐▌
█ MDSTATUS: ▐▌
█ ````````` ▐▌
█ Again another plugin I can't use as I don't have RAID, but this is how you ▐▌
█ would do it: ▐▌
█ cat /proc/mdstat ▐▌
█ ▐▌
█ Create a file with the output of cat /proc/mdstat ▐▌
█ pico /var/www/phpsysinfo/data/mdstat.txt ▐▌
█ ▐▌
█ Then to enable it on phpsysinfo: ▐▌
█ pico /var/www/phpsysinfo/config.php ▐▌
█ Change this line: ▐▌
█ define('PSI_PLUGINS', false); ▐▌
█ To: ▐▌
█ define('PSI_PLUGINS', 'MDStatus'); ▐▌
█ Or if you had other plugins on it, it would be for example: ▐▌
█ define('PSI_PLUGINS', 'BAT,ipmi,MDStatus'); ▐▌
█ ▐▌
█ Now test your phpsysinfo page. It should now have RAID STATUS. ▐▌
█ ▐▌
█ PS: ▐▌
█ ``` ▐▌
█ Finally one that I and everyone has :) Run this cmd: ▐▌
█ ps axo pid,ppid,pmem,args ▐▌
█ ▐▌
█ Create a file with the entire output of the above cmd: ▐▌
█ pico /var/www/phpsysinfo/data/ps.txt ▐▌
█ ▐▌
█ Then to enable it on phpsysinfo: ▐▌
█ pico /var/www/phpsysinfo/config.php ▐▌
█ Change this line: ▐▌
█ define('PSI_PLUGINS', false); ▐▌
█ To: ▐▌
█ define('PSI_PLUGINS', 'PS'); ▐▌
█ Or if you had other plugins on it, it would be for example: ▐▌
█ define('PSI_PLUGINS', 'BAT,ipmi,MDStatus,PS'); ▐▌
█ ▐▌
█ Now test your phpsysinfo page. It should now have PROCESS STATUS. ▐▌
█ ▐▌
█ PSSTATUS: ▐▌
█ ````````` ▐▌
█ Another plugin everyone can use. Run this cmd: ▐▌
█ ps=("apache2" "mysqld" "sshd"); for((i=0;i<${#ps};i++)); do echo ${ps[$i]} "|" `pidof -s ${ps[$i]}` ;done
█ Note that you can include other applications in that line if you like. ▐▌
█ ▐▌
█ Create a file with the entire output of the above cmd: ▐▌
█ pico /var/www/phpsysinfo/data/psstatus.txt ▐▌
█ For example I pasted in my output of: ▐▌
█ apache2 | 23001 ▐▌
█ mysqld | 22628 ▐▌
█ sshd | 19966 ▐▌
█ | ▐▌
█ | ▐▌
█ | ▐▌
█ | ▐▌
█ ▐▌
█ Then to enter the same applications ps is to report on: ▐▌
█ pico /var/www/phpsysinfo/plugins/PSStatus/PSStatus.config.php ▐▌
█ Change this line: ▐▌
█ define('PSI_PLUGIN_PSSTATUS_PROCESSES', 'mysqld, sshd, explorer.exe'); ▐▌
█ To, using the example above to: ▐▌
█ define('PSI_PLUGIN_PSSTATUS_PROCESSES', 'apache2, mysqld, sshd'); ▐▌
█ ▐▌
█ Then to enable it on phpsysinfo: ▐▌
█ pico /var/www/phpsysinfo/config.php ▐▌
█ Change this line: ▐▌
█ define('PSI_PLUGINS', false); ▐▌
█ To: ▐▌
█ define('PSI_PLUGINS', 'PSStatus'); ▐▌
█ Or if you had other plugins on it, it would be for example: ▐▌
█ define('PSI_PLUGINS', 'BAT,ipmi,MDStatus,PS,PSStatus'); ▐▌
█ ▐▌
█ Now test your phpsysinfo page. It should now have a new section PROCESS ▐▌
█ STATUS listing those applications you put in the cmd line. ▐▌
█ ▐▌
█ QUOTAS: ▐▌
█ ``````` ▐▌
█ To enable the next two plugins (Quotas & SMART) it's quite a few more ▐▌
█ steps; time to refill your pot of tea :) ▐▌
█ ▐▌
█ INSTALL: ▐▌
█ aptitude install quota repquota ▐▌
█ man quota ▐▌
█ ▐▌
█ NOTES: ▐▌
█ Quotas will read from users and groups mounted file system: ▐▌
█ /etc/mtab default filesystems ▐▌
█ /etc/passwd default set of users ▐▌
█ /etc/group default set of groups ▐▌
█ ▐▌
█ WHICH MOUNT YOU WILL USE: ▐▌
█ You need to decide what file system you have mounted that you want quota ▐▌
█ to read from. For example if you have /home mounted use that. ▐▌
█ To know what file systems are mounted: ▐▌
█ df -k ▐▌
█ For example, my output is: ▐▌
█ /dev/hda3 35869332 4616584 29401260 14% / ▐▌
█ tmpfs 250112 0 250112 0% /lib/init/rw ▐▌
█ udev 10240 636 9604 7% /dev ▐▌
█ tmpfs 250112 0 250112 0% /dev/shm ▐▌
█ /dev/hda1 93309 29360 59132 34% /boot ▐▌
█ ▐▌
█ I don't have /home mounted. So I'm going to use / ▐▌
█ (btw mounting a directory with --bind will not work since --bind is not ▐▌
█ part of the file system.) ▐▌
█ This is what I did to get quota reading user and group for phpsysinfo ▐▌
█ output: ▐▌
█ ▐▌
█ ENABLE QUOTA ON A MOUNT: ▐▌
█ Make a backup copy just in case; errors could disable system from booting ▐▌
█ properly: ▐▌
█ cp /etc/fstab /etc/fstab.backup ▐▌
█ ▐▌
█ To assign quota on / for example: ▐▌
█ pico /etc/fstab ▐▌
█ Mine has: ▐▌
█ /dev/hda3 / ext3 defaults,errors=remount-ro 0 1 ▐▌
█ Change to: ▐▌
█ /dev/hda3 / ext3 defaults,usrquota,usrjquota=aquota.user,jqfmt=vfsv0,errors=remount-ro 0 1
█ ▐▌
█ NOTE THAT: ▐▌
█ 1) I added only, without spaces, after 'default,': ▐▌
█ usrquota,usrjquota=aquota.user,jqfmt=vfsv0, ▐▌
█ ▐▌
█ 2) Redhat, Debian it's: usrquota & if you want group quota; grpquota ▐▌
█ FreeBSD it's: userquota & if you want group quota; groupquota ▐▌
█ usrquota/userquota = enable user quota ▐▌
█ grpquota/groupquota = enable group quota ▐▌
█ usrjquota/userjquota = journaled user quota ▐▌
█ grpjquota/groupjquota = journaled group quota ▐▌
█ aquota.user/aquota.group/quota.user/quota.group = the file name it will ▐▌
█ create ▐▌
█ ▐▌
█ To enable the quota attribute on that mount: ▐▌
█ mount -o remount / ▐▌
█ Or if you did /home for example, it would be: ▐▌
█ mount -o remount /home ▐▌
█ There will be no output on a successful remount. If there is an error, ▐▌
█ make sure you have entered the line correctly for your mount. ▐▌
█ ▐▌
█ If you view your /etc/mtab the change will be listed there as well: ▐▌
█ cat /etc/mtab ▐▌
█ ▐▌
█ QUOTACHECK: ▐▌
█ Next you need to run quotacheck so that it will analyze the files on the ▐▌
█ mount it is enabled on, and it will create its aquota.user file in the ▐▌
█ root of the mount. If you have many files on the mount it could take some ▐▌
█ time. For myself it took less than a minute. Run this cmd: ▐▌
█ quotacheck -c -u -m -v -F vfsv0 / ▐▌
█ Or if you mounted /home it would be: ▐▌
█ quotacheck -c -u -m -v -F vfsv0 /home ▐▌
█ ▐▌
█ My output was: ▐▌
█ reply: quotacheck: Scanning /dev/hda3 [/] / ▐▌
█ ▐▌
█ After it was finished, the output was: ▐▌
█ quotacheck: Scanning /dev/hda3 [/] done ▐▌
█ quotacheck: Cannot stat old user quota file: No such file or directory ▐▌
█ quotacheck: Old group file not found. Usage will not be substracted. ▐▌
█ quotacheck: Checked 14649 directories and 115293 files ▐▌
█ quotacheck: Old file not found. ▐▌
█ ▐▌
█ (In the root of your mount there will now be a file 'aquota.user' with ▐▌
█ perms 0600) ▐▌
█ ▐▌
█ REPQUOTA: ▐▌
█ To view the report from quota: ▐▌
█ repquota -au ▐▌
█ ▐▌
█ Create a file with the entire output from repquota -au above: ▐▌
█ pico /var/www/phpsysinfo/data/quotas.txt ▐▌
█ ▐▌
█ Note that using mount / instead of /home is going to have output for items ▐▌
█ that you might not want on phpsysinfo. We'll get to that later (under ▐▌
█ CLEAN UP), just paste the entire output in (leaving off entries will not ▐▌
█ have an affect on phpsysinfo reporting). ▐▌
█ ▐▌
█ ENABLE QUOTAS ON PHPSYSINFO: ▐▌
█ Because the cmd 'repquota' is only available to root it will not work for ▐▌
█ your web server. So we need to set some permissions on it and change the ▐▌
█ command it uses. Go to ▐▌
█ http://yoursite.com/phpsysinfo/xml.php?plugin=Quotas to view the errors, ▐▌
█ it will most likely state 'program not found on the machine <snip>' ▐▌
█ ▐▌
█ 1. First we need to find out if your system has 'sudo', as Debian does not ▐▌
█ come with sudo, type into your shell: ▐▌
█ sudo ▐▌
█ If you have sudo output will be: ▐▌
█ usage: sudo -h | -K | -k | -L | -l | -V | -v ▐▌
█ Then move on to the next step. ▐▌
█ If your reply is: ▐▌
█ bash: sudo: command not found ▐▌
█ Then hop over to my sudo tutorial HERE. After you have sudo setup, move on ▐▌
█ to the next step. ▐▌
█ ▐▌
█ 2. Then to change the cmd the web server will send: ▐▌
█ pico /var/www/phpsysinfo/plugins/Quotas/class.Quotas.inc.php ▐▌
█ ▐▌
█ Search for (Ctrl+w) (line 55): -au ▐▌
█ It has this: ▐▌
█ CommonFunctions::executeProgram("repquota", "-au", $buffer, PSI_DEBUG);
█ Change it to: ▐▌
█ CommonFunctions::executeProgram("sudo", "/usr/sbin/repquota -au", $buffer, PSI_DEBUG);
█ ▐▌
█ Just a note that all we changed was: ▐▌
█ "repquota", "-au" ▐▌
█ To: ▐▌
█ "sudo", "/usr/sbin/repquota -au" ▐▌
█ ▐▌
█ Be sure that line isn't broken into multiple lines. If it is you'll see on ▐▌
█ your xml.php?plugin=Quota page errors containing: \n ▐▌
█ And be sure that /usr/sbin/repquota is the correct path for your ▐▌
█ installation- try the cmd out for yourself that you have changed above in ▐▌
█ the shell. ▐▌
█ For example the change above would yield your web server sending this cmd: ▐▌
█ sudo /usr/sbin/repquota -au ▐▌
█ ▐▌
█ 3. Next to give your web server permission to use 'sudo': ▐▌
█ First find out the group name of your web server, for some it is apache, ▐▌
█ for myself it is www-data: ▐▌
█ cat /etc/group ▐▌
█ Scan the list for the name, for example mine has: ▐▌
█ <snip> ▐▌
█ dip:x:30: ▐▌
█ www-data:x:33: ▐▌
█ backup:x:34: ▐▌
█ <snip> ▐▌
█ ▐▌
█ Then add your web server group to sudo to be able to run repquota: ▐▌
█ visudo ▐▌
█ Paste in this line under '# User privilege specification', changing your ▐▌
█ web server group (www-data) and path to repquota (/usr/sbin/requota) to ▐▌
█ your own. ▐▌
█ For example I have pasted in: ▐▌
█ www-data ALL=NOPASSWD: /usr/sbin/repquota ▐▌
█ And if you like while you are there add your self in for testing purposes, ▐▌
█ replacing user with your user name: ▐▌
█ user ALL=NOPASSWD: /usr/sbin/repquota ▐▌
█ ▐▌
█ 4. Now test your phpsysinfo page again. It should now load QUOTA STATUS ▐▌
█ properly. ▐▌
█ ▐▌
█ CLEAN UP: ▐▌
█ If you had used mount point / to create the data for repquota -au as I ▐▌
█ stated above it might list quotas you don't want to list. To prevent it I ▐▌
█ used 'grep' to list only those I want. For example if repquota -au output ▐▌
█ has: ▐▌
█ root -- 2312244 0 0 93112 0 0 ▐▌
█ daemon -- 52 0 0 4 0 0 ▐▌
█ man -- 1512 0 0 76 0 0 ▐▌
█ rat -- 1412 0 0 76 0 0 ▐▌
█ dogs -- 1522 0 0 76 0 0 ▐▌
█ mewbies -- 1812 0 0 76 0 0 ▐▌
█ mewb -- 1922 0 0 76 0 0 ▐▌
█ bob -- 1682 0 0 76 0 0 ▐▌
█ news -- 4 0 0 1 0 0 ▐▌
█ www-data -- 3420 0 0 5 0 0 ▐▌
█ #1336 -- 56 0 0 14 0 0 ▐▌
█ ▐▌
█ And I want phpsysinfo to list only rat, dogs, mewbies, mewb, & bob ▐▌
█ I would change the cmd: ▐▌
█ pico /var/www/phpsysinfo/plugins/Quotas/class.Quotas.inc.php ▐▌
█ This line has: ▐▌
█ CommonFunctions::executeProgram("sudo", "/usr/sbin/repquota -au", $buffer, PSI_DEBUG);
█ I changed it to: ▐▌
█ CommonFunctions::executeProgram("sudo", "/usr/sbin/repquota -au | grep -e xyz -e ra -e do -e wb -e ob", $buffer, PSI_DEBUG);
█ ▐▌
█ It doesn't matter the order you list them, they will be alphabetically ▐▌
█ sorted on phpsysinfo page. ▐▌
█ What this will do is only list in the report lines that contain matching ▐▌
█ strings: ra (rat) do (dog) wb (mewbies, mewb) ob (bob). ▐▌
█ Note that I also have '-e xyz'. The reason for this is I find a number of ▐▌
█ times the first in the grep list wouldn't be listed. I don't know why, so ▐▌
█ I gave it a bogus string to search for. If you don't have a problem with ▐▌
█ it listing the first entry, then don't use '-e xyz' in the line. ▐▌
█ ▐▌
█ Try out the cmd to view its results, for example as above it would be: ▐▌
█ sudo /usr/sbin/repquota -au | grep -e xyz -e ra -e do -e wb -e ob ▐▌
█ ▐▌
█ Instead of a cmd that list matching strings (as you might have many and ▐▌
█ those are changing), use a cmd to 'not' list matching strings by adding ▐▌
█ the switch -v. For example: ▐▌
█ /usr/sbin/repquota -au | grep -v -e da -e man -e ro -e ma -e ww -ews -e "#"▐▌
█ Two problems with this: ▐▌
█ If a user that you want to list has that string in their name, they won't ▐▌
█ be listed. ▐▌
█ The character # must be used in the cmd line as "#", which will not work ▐▌
█ in the php script- you'll need to adjust that line so "#" works - I don't ▐▌
█ know php to do that :) . ▐▌
█ Done. ▐▌
█ ▐▌
█ SMART: ▐▌
█ `````` ▐▌
█ This will require that you have SMART enabled hard drives. There might be ▐▌
█ a cmd to view if you do without out installing smartmontools, but I don't ▐▌
█ know it. Once you install smartmontools then you will know for sure. ▐▌
█ ▐▌
█ 1. Install smartmontools (which is a utility having two programs; smartctl ▐▌
█ which we will use for this, and smartd which we do not need to use for ▐▌
█ this): ▐▌
█ aptitude install smartmontools ▐▌
█ ▐▌
█ My output was: ▐▌
█ <snip> ▐▌
█ Setting up smartmontools (5.38-2+lenny1) ... ▐▌
█ Not starting S.M.A.R.T. daemon smartd, disabled via ▐▌
█ /etc/default/smartmontools (warning). ▐▌
█ <snip> ▐▌
█ So not to worry about smartd being disabled since we aren't using it for ▐▌
█ this. ▐▌
█ ▐▌
█ Don't need, JFYI optional cmds for more information: ▐▌
█ man smartctl ▐▌
█ man smartd ▐▌
█ smartctl -h ▐▌
█ ▐▌
█ 2. Now to find out the name of our disk: ▐▌
█ df -h ▐▌
█ or ▐▌
█ fdisk -l ▐▌
█ My output is: ▐▌
█ Disk /dev/hda: 40.0 GB, 40020664320 bytes ▐▌
█ 255 heads, 63 sectors/track, 4865 cylinders ▐▌
█ Units = cylinders of 16065 * 512 = 8225280 bytes ▐▌
█ Disk identifier: 0x00000000 ▐▌
█ ▐▌
█ Device Boot Start End Blocks Id System ▐▌
█ /dev/hda1 * 1 12 96358+ 83 Linux ▐▌
█ /dev/hda2 13 255 1951897+ 82 Linux swap / Solaris ▐▌
█ /dev/hda3 256 4865 37029825 83 Linux ▐▌
█ ▐▌
█ From the output, my disk is named: /dev/hda ▐▌
█ ▐▌
█ 3. Now run smartctl, with your own disk name, for my example: ▐▌
█ smartctl -a /dev/hda ▐▌
█ ▐▌
█ If in the first section of the output it states: ▐▌
█ SMART support is: Available - device has SMART capability. ▐▌
█ SMART support is: Enabled ▐▌
█ Then you do have SMART enabled drives. ▐▌
█ ▐▌
█ If in the first section of the output it states: ▐▌
█ SMART support is: Available - device has SMART capability. ▐▌
█ SMART support is: Disabled ▐▌
█ Then run the cmd, with your own disk name: ▐▌
█ smartctl -s on -a /dev/hda ▐▌
█ You'll now see more output including errors that are in the SMART log, if ▐▌
█ any. ▐▌
█ Then run the cmd again, with your own hard disk name: ▐▌
█ smartctl -a /dev/hda ▐▌
█ ▐▌
█ When the output states 'SMART support is: Enabled' move on to the next ▐▌
█ step. ▐▌
█ ▐▌
█ 4. Create a file named "SMART{disk_number}.txt" replacing {disk_number} ▐▌
█ with your own disk number ▐▌
█ For example my disk number is 0. Use 0 if you aren't sure yours. ▐▌
█ ('IDE hard disks are numbered in order, beginning from hd0 for the primary ▐▌
█ master and its slave hd1, followed by the secondary master hd2 and its ▐▌
█ slave hd3. SCSI drives are also numbered in absolute order. They will ▐▌
█ always be sd0, sd1, and so on regardless of whether the two drives are ▐▌
█ SCSI id 4 and 5 or whatever.' from HERE.) ▐▌
█ ▐▌
█ pico /var/www/phpsysinfo/data/SMART0.txt ▐▌
█ Then paste in the entire output of the cmd in step 3 'smartctl -a ▐▌
█ /dev/hda'. ▐▌
█ ▐▌
█ Here is a small sample of my output that I pasted in: ▐▌
█ smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen ▐▌
█ Home page is http://smartmontools.sourceforge.net/ ▐▌
█ ▐▌
█ === START OF INFORMATION SECTION === ▐▌
█ Model Family: Western Digital Caviar family ▐▌
█ Device Model: WDC WD400BB-22JHC0 ▐▌
█ Serial Number: WD-***removed*** ▐▌
█ Firmware Version: 05.01C05 ▐▌
█ User Capacity: 40,020,664,320 bytes ▐▌
█ Device is: In smartctl database [for details use: -P show] ▐▌
█ ATA Version is: 6 ▐▌
█ ATA Standard is: Exact ATA specification draft version not indicated ▐▌
█ Local Time is: Sun May 1 09:15:22 2010 UTC ▐▌
█ SMART support is: Available - device has SMART capability. ▐▌
█ SMART support is: Enabled ▐▌
█ <snip> ▐▌
█ SMART Attributes Data Structure revision number: 16 ▐▌
█ Vendor Specific SMART Attributes with Thresholds: ▐▌
█ ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
█ 1 Raw_Read_Error_Rate 0x000f 200 200 051 Pre-fail Always - 0
█ 3 Spin_Up_Time 0x0003 167 165 021 Pre-fail Always - 2641
█ 4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 50
█ 5 Reallocated_Sector_Ct 0x0033 200 200 140 Pre-fail Always - 0
█ 7 Seek_Error_Rate 0x000f 200 200 051 Pre-fail Always - 0
█ 9 Power_On_Hours 0x0032 075 075 000 Old_age Always - 18615
█ 10 Spin_Retry_Count 0x0013 100 253 051 Pre-fail Always - 0
█ 11 Calibration_Retry_Count 0x0012 100 253 051 Old_age Always - 0
█ 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 50
█ 194 Temperature_Celsius 0x0022 106 093 000 Old_age Always - 37
█ 196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always - 0
█ 197 Current_Pending_Sector 0x0012 200 200 000 Old_age Always - 0
█ 198 Offline_Uncorrectable 0x0010 200 200 000 Old_age Offline - 0
█ 199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0
█ 200 Multi_Zone_Error_Rate 0x0009 200 200 051 Pre-fail Offline - 0
█ ▐▌
█ SMART Error Log Version: 1 ▐▌
█ No Errors Logged ▐▌
█ <snip> ▐▌
█ ▐▌
█ Take note of the output in section 'Vendor Specific SMART Attributes with ▐▌
█ Thresholds' as we'll enter those ID#s to enable showing of those items in ▐▌
█ step 6, or you can leave it at default as I have done. ▐▌
█ ▐▌
█ 5. Now we need to find out the 'device type' of your hard disk. The device ▐▌
█ type in my output above is 'ATA Version is: 6'. So the device type is ▐▌
█ 'ata'. ▐▌
█ Valid device types are ata, scsi, sat, marvell, 3ware,N, and hpt,L/M, ▐▌
█ cciss,N or hpt,L/M/N. ▐▌
█ If you aren't sure your device type, try the device type in the cmd line, ▐▌
█ for example: ▐▌
█ smartctl -d ata /dev/hda ▐▌
█ If correct there will be no output except the smartctl header logo. ▐▌
█ To find out more: ▐▌
█ man smartctl ▐▌
█ ▐▌
█ 6. We now have the information we need to make the changes: ▐▌
█ pico /var/www/phpsysinfo/plugins/SMART/SMART.config.php ▐▌
█ A. Edit your 'disk name/s', it has: ▐▌
█ define('PSI_PLUGIN_SMART_DEVICES', '/dev/sda, /dev/sdb'); ▐▌
█ For my example, I change it to: ▐▌
█ define('PSI_PLUGIN_SMART_DEVICES', '/dev/hda'); ▐▌
█ ▐▌
█ B. Edit your 'device type', it has: ▐▌
█ define('PSI_PLUGIN_SMART_DEVICE', false); ▐▌
█ For my example, I change it to: ▐▌
█ define('PSI_PLUGIN_SMART_DEVICE', 'ata'); ▐▌
█ ▐▌
█ C. Edit the method in which the data for 'Vendor Specific SMART ▐▌
█ Attributes with Thresholds' will be displayed (as shown in my example on ▐▌
█ step 4.) on the web page on this line: ▐▌
█ define('PSI_PLUGIN_SMART_IDS', '005-RAW_VALUE,194-RAW_VALUE,4-R <snip> ▐▌
█ I just left mine how it was. Read that section if you want to change ▐▌
█ yours. ▐▌
█ The output would show the values for ID# 5, 194, 9, 12, 193, 1, 7, & 200 ▐▌
█ in that order. ▐▌
█ ▐▌
█ View phpsysinfo demo page for a visual understanding under S.M.A.R.T ▐▌
█ HERE. ▐▌
█ ▐▌
█ 7. Then to enable it on phpsysinfo: ▐▌
█ pico /var/www/phpsysinfo/config.php ▐▌
█ Change this line: ▐▌
█ define('PSI_PLUGINS', false); ▐▌
█ To: ▐▌
█ define('PSI_PLUGINS', 'SMART'); ▐▌
█ Or if you had other plugins on it, it would be for example: ▐▌
█ define('PSI_PLUGINS', 'BAT,ipmi,MDStatus,PS,PSStatus,Quotas,SMART'); ▐▌
█ ▐▌
█ 8. Now test your phpsysinfo page. It should now have a new section ▐▌
█ S.M.A.R.T INFORMATIONS. If does; great! If it doesn't list SMART, page ▐▌
█ won't load, states only 'No matching records found' or errors out and ▐▌
█ xml.php states: ▐▌
█ <Error Function="find_program(smartctl)"> ▐▌
█ program not found on the machine ▐▌
█ <snip> ▐▌
█ then continue. ▐▌
█ ▐▌
█ 9. First we need to find out if your system has 'sudo', as Debian does not ▐▌
█ come with sudo, type into your shell: ▐▌
█ sudo ▐▌
█ If you have sudo output will be: ▐▌
█ usage: sudo -h | -K | -k | -L | -l | -V | -v ▐▌
█ Then move on to the next step. ▐▌
█ If your reply is: ▐▌
█ bash: sudo: command not found ▐▌
█ Then hop over to my sudo tutorial HERE. After you have sudo setup, move on ▐▌
█ to the next step. ▐▌
█ ▐▌
█ 10. Because the cmd 'smartctl' is only available to root; it will not work ▐▌
█ for your web server, we need to set some permissions on it and change the ▐▌
█ command it uses: ▐▌
█ pico /var/www/phpsysinfo/plugins/SMART/class.SMART.inc.php ▐▌
█ Search for (Ctrl+w) (line 60): --all ▐▌
█ It has this: ▐▌
█ if (CommonFunctions::executeProgram('smartctl', '--all'.((PSI_PLUGIN_SMART_DEVICE) ? ' --device '.PSI_PLUGIN_SMART_DEVICE : '').' '.$disk, $buffer, PSI_DEBUG)) {
█ Change it to: ▐▌
█ if (CommonFunctions::executeProgram('sudo', '/usr/sbin/smartctl --all '.((PSI_PLUGIN_SMART_DEVICE) ? ' --device '.PSI_PLUGIN_SMART_DEVICE : '').' '.$disk, $buffer, PSI_DEBUG)) {
█ ▐▌
█ Just a note that all we changed was: ▐▌
█ 'smartctl', '--all' ▐▌
█ To: ▐▌
█ 'sudo', '/usr/sbin/smartctl --all ' ▐▌
█ Change yours to be the same, including the space: all ' ▐▌
█ Be sure that line isn't broken into multiple lines. If it is you'll see on ▐▌
█ your xml.php?plugin=SMART page errors containing: \n ▐▌
█ And be sure that /usr/sbin/smartctl is the correct path for your ▐▌
█ installation of smartctl. ▐▌
█ ▐▌
█ Try the cmd out for yourself that you have changed above in the shell. For ▐▌
█ example the change above would yield phpsysinfo sending this cmd: ▐▌
█ sudo /usr/sbin/smartctl --all --device ata /dev/hda ▐▌
█ ('ata /dev/hda' will be read from SMART.config.php) ▐▌
█ ▐▌
█ 11. Now to give your web server permission to run 'sudo' for smartctl: ▐▌
█ First find out the group name of your web server, for some it is apache, ▐▌
█ for myself it is www-data: ▐▌
█ cat /etc/group ▐▌
█ Scan the list for the name, for example mine has: ▐▌
█ <snip> ▐▌
█ dip:x:30: ▐▌
█ www-data:x:33: ▐▌
█ backup:x:34: ▐▌
█ <snip> ▐▌
█ ▐▌
█ Next we need to add your web server group to sudo to be able to run ▐▌
█ smartctl cmds: ▐▌
█ visudo ▐▌
█ Paste in this line under '# User privilege specification', changing your ▐▌
█ web server group (www-data) to your own. For example I have pasted in: ▐▌
█ in: ▐▌
█ www-data ALL=NOPASSWD: /usr/sbin/smartctl ▐▌
█ ▐▌
█ 12. Now test your phpsysinfo page again. It should now load S.M.A.R.T ▐▌
█ INFORMATIONS properly. ▐▌
█ ▐▌
█ 13. Not needed, just a little touch up - If you don't like the heading ▐▌
█ 'S.M.A.R.T INFORMATIONS' and would like to change it to for example ▐▌
█ 'S.M.A.R.T. INFORMATION': ▐▌
█ pico /var/www/phpsysinfo/plugins/SMART/lang/en.xml ▐▌
█ Search for: Informations ▐▌
█ It has: ▐▌
█ <exp> S.M.A.R.T Informations</exp> ▐▌
█ Change it to: ▐▌
█ <exp> S.M.A.R.T. Information</exp> ▐▌
█ ▐▌
█ APCUPSD: ▐▌
█ ```````` ▐▌
█ At the end of phpsysinfo's config.php file you'll see an entry for UPS. I ▐▌
█ don't have a UPS so my install instructions are just some steps taken and ▐▌
█ notes. Note that your UPS must have a 'data port' (not just a power cable ▐▌
█ as some models). phpsysinfo supports Nut, which is only for Linux, and ▐▌
█ Apcupsd, which is for Linux, Mac & Win. ▐▌
█ ▐▌
█ Apcupsd sure is sweet if you have a UPS that is supported; check HERE. ▐▌
█ HERE is his real-time apcupsd, click on 'Local Host' for some goodies :) ▐▌
█ ▐▌
█ APCUPSD INSTALL NOTES: ▐▌
█ apt-get install apcupsd ▐▌
█ Answer 'y' (yes) when asked during installation if prompted, such as: ▐▌
█ The following extra packages will be installed: ▐▌
█ apcupsd-doc libsensors3 libsnmp-base libsnmp15 ▐▌
█ Suggested packages: ▐▌
█ apcupsd-cgi hal ▐▌
█ Creating config file /etc/sensors.conf with new version ▐▌
█ Please check your configuration ISCONFIGURED in /etc/default/apcupsd ▐▌
█ ▐▌
█ 'apcupsd-cgi' is the web interface that is used in the apcupsd demo above. ▐▌
█ We don't need it for this purpose, but sure is fab and silly easy :) ▐▌
█ ▐▌
█ You then need to edit apcupsd configuration file for your UPS. It explains ▐▌
█ each section very well in the file: ▐▌
█ pico /etc/apcupsd/apcupsd.conf ▐▌
█ ▐▌
█ After you have your configuration correct, you need to enable apcupsd: ▐▌
█ pico /etc/default/apcupsd ▐▌
█ Has this line: ▐▌
█ ISCONFIGURED=no ▐▌
█ Change to: ▐▌
█ ISCONFIGURED=yes ▐▌
█ ▐▌
█ Then run: ▐▌
█ apcaccess ▐▌
█ or ▐▌
█ apcaccess status ▐▌
█ ▐▌
█ Optional; to reboot after a power failure: ▐▌
█ pico /etc/init.d/halt ▐▌
█ Search for this line: poweroff="-p" ▐▌
█ And change it to: ▐▌
█ poweroff="" ▐▌
█ ▐▌
█ You might need to do this; find out what running kernel version you have: ▐▌
█ uname -r ▐▌
█ My out put is: 2.6.26-2-486 If you have a 2.6+ you'll need to: ▐▌
█ cp /etc/fstab /etc/fstab.backup ▐▌
█ pico /etc/fstab ▐▌
█ paste in: ▐▌
█ none /sys sysfs defaults 0 0 ▐▌
█ ▐▌
█ Then run this cmd: ▐▌
█ mount /sys ▐▌
█ My output was: ▐▌
█ mount: none already mounted or /sys busy ▐▌
█ mount: according to mtab, sysfs is already mounted on /sys ▐▌
█ So I'm going to take a look at mtab: ▐▌
█ cat /etc/mtab ▐▌
█ It does have this line: sysfs /sys sysfs rw,noexec,nosuid,nodev 0 0 ▐▌
█ ▐▌
█ And too bad this is as far as I can take it since I don't have a UPS I ▐▌
█ can't confirm if my changes worked well or not. ▐▌
█ ls -l /sys/bus/usb/drivers ▐▌
█ ▐▌
█ Some of sites that I'll continue to read if I get a UPS; HERE, HERE, HERE ▐▌
█ & HERE. ▐▌
█ ▐▌
█ PHPSYSINFO APCUPSD SETUP: ▐▌
█ Once you have apcupsd running smooth, I can help with the phpsysinfo ▐▌
█ setup. It's about the same as the plugins: ▐▌
█ 1. First we need to find out if your system has 'sudo', as Debian does not ▐▌
█ come with sudo, type into your shell: ▐▌
█ sudo ▐▌
█ If you have sudo output will be: ▐▌
█ usage: sudo -h | -K | -k | -L | -l | -V | -v ▐▌
█ Then move on to the next step. ▐▌
█ If your reply is: ▐▌
█ bash: sudo: command not found ▐▌
█ Then hop over to my sudo tutorial HERE. After you have sudo setup, move on ▐▌
█ to the next step. ▐▌
█ ▐▌
█ 2. Because the cmd 'apcaccess' is only available to root; it will not work ▐▌
█ for your web server, we need to set some permissions on it and change the ▐▌
█ command it uses: ▐▌
█ pico /var/www/phpsysinfo/includes/ups/class.Apcupsd.inc.php ▐▌
█ Search for (Ctrl+w) (line 44): apcaccess ▐▌
█ It has this: ▐▌
█ CommonFunctions::executeProgram('apcaccess', 'status '.trim($ups), $temp);
█ Change it to: ▐▌
█ CommonFunctions::executeProgram('sudo', '/sbin/apcaccess status'.trim($ups), $temp);
█ ▐▌
█ Just a note that all we changed was: ▐▌
█ 'apcaccess', 'status ' ▐▌
█ To: ▐▌
█ 'sudo', '/sbin/apcaccess status' ▐▌
█ Change yours to be the same, including the removal of the space before: ' ▐▌
█ Be sure that line isn't broken into multiple lines. If it is you'll see on ▐▌
█ your xml.php? page errors containing: \n ▐▌
█ And be sure that /sbin/apcaccess is the correct path for your ▐▌
█ installation of apcaccess. ▐▌
█ ▐▌
█ Try the cmd out for yourself that you have changed above in the shell. For ▐▌
█ example the change above would yield phpsysinfo sending this cmd: ▐▌
█ sudo /sbin/apcaccess status ▐▌
█ ▐▌
█ 3. Now to give your web server permission to run 'sudo' for apcaccess: ▐▌
█ First find out the group name of your web server, for some it is apache, ▐▌
█ for myself it is www-data: ▐▌
█ cat /etc/group ▐▌
█ Scan the list for the name, for example mine has: ▐▌
█ <snip> ▐▌
█ dip:x:30: ▐▌
█ www-data:x:33: ▐▌
█ backup:x:34: ▐▌
█ <snip> ▐▌
█ ▐▌
█ Next we need to add your web server group to sudo to be able to run ▐▌
█ apcaccess cmds: ▐▌
█ visudo ▐▌
█ Paste in this line under '# User privilege specification', changing your ▐▌
█ web server group (www-data) to your own. For example I have pasted in: ▐▌
█ in: ▐▌
█ www-data ALL=NOPASSWD: /sbin/apcaccess ▐▌
█ ▐▌
█ 4. Then to enable it on phpsysinfo: ▐▌
█ pico /var/www/phpsysinfo/config.php ▐▌
█ Change this line from false to true: ▐▌
█ define('PSI_UPS_PROGRAM', false); ▐▌
█ ▐▌
█ 5. Now test your phpsysinfo page again. It should now have UPS. ▐▌
█ ▐▌
█ PASSWORD PROTECT PHPSYSINFO OR DISABLE IT: ▐▌
█ `````````````````````````````````````````` ▐▌
█ My preference only since I do not like the idea of phpsysinfo being ▐▌
█ available 'at all' when I don't need it, even tho it is password protected ▐▌
█ for example: ▐▌
█ cd /var/www/phpsysinfo ▐▌
█ mv config.php disabled ▐▌
█ ▐▌
█ Then when I want to use phpsysinfo: ▐▌
█ mv disabled config.php ▐▌
█ ▐▌
█ Or you could password protect it. See my Apache tutorial HERE, under the ▐▌
█ section 'USER AUTHENTICATION | PASSWORD PROTECT YOUR SITE' ▐▌
█ ▐▌
█ //---------------------------------------------------------------------- ▐▌
█ ▐▌
█ If you find mistakes, have suggestions, and or questions please post at ▐▌
█ mewbies forum HERE - thank you. ▐▌
█ ▐▌
█ Last update on 08 Jun '10 ▐▌
█ ▐▌
█▌ █▌
█▌ - mewbies.com - █▌
█▌ █▌
██▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄██