Difference between revisions of "PhpSysInfo"

From Amahi Wiki
Jump to: navigation, search
m (update of editing config.php so it works under amahi 5.1)
 
(45 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
[[Category:Apps]]
 
[[Category:Apps]]
 +
== Getting More Info ==
 +
After the one click install of phpsysinfo in Amahi 6 or greater, you need to do some modifications to get all system information displayed.
  
==PHP SysInfo==
+
==Install lm-sensors ==
 +
=== Fedora ===
 +
open a terminal session and login as root or if you have sudo configured use sudo in front of all commands.
  
PHP SysInfo is a php script that displays information about the host being accessed. Things like uptime and CPU memory are displayed using phpsysinfo. To run it from your hda:
+
type
 
+
su -
1. Navigate to the /var/hda/web-apps directory on your hda.
+
at the prompt enter your root password
 
 
2. Search for a phpsysinfo tarball through a web browser. You can find one at  
 
http://phpsysinfo.sourceforge.net/
 
 
 
3. Download the tarball into the web-apps directory using wget or another method. For example:
 
 
 
'''wget http://downloads.sourceforge.net/phpsysinfo/phpSysInfo-3.0-RC6.tar.gz'''
 
  
 +
then type
 +
yum install lm_sensors
 +
sensors-detect
  
4. Unpack the phpsysinfo tarball with the tar command:
+
::'''NOTE:'''  <code>yum</code> (deprecated) has been replaced with <code>dnf</code> as the package manager for Fedora 23 and greater.
  
'''tar -zxvf phpSysInfo-3.0-RC6.tar.gz''' 
+
=== Ubuntu ===
  
This will create a phpsysinfo directory and unpack all the files.
+
sudo apt-get install lm-sensors
 +
sudo sensors-detect
  
  
5. Remove the tarball since it will no longer be needed
+
Answer the questions. At the end of sensors-detect, Type "yes" to have sensors-detect insert modules into /etc/modules, or edit /etc/modules yourself  service module-init-tools start
  
'''rm -rf phpSysInfo-3.0-RC6.tar.gz'''
+
See [https://help.ubuntu.com/community/SensorInstallHowto#Install_and_Configure_lm-sensors Install and configure lm-sensors] for additional help.
  
 +
== Configure Settings ==
 +
first make a backup of your original configuration file
  
6. Enter the new phpsysinfo directory: '''cd phpsysinfo'''
+
cd /var/hda/web-apps/phpsysinfo/html
 +
cp phpsysinfo.ini phpsysinfo.inibak
  
7. Next, copy the php new configuration file to config.php using the cp command:
+
if neccessary
  
'''cp config.php.new config.php'''
+
yum install nano
  
 +
::'''NOTE:'''  <code>yum</code> (deprecated) has been replaced with <code>dnf</code> as the package manager for Fedora 23 and greater.
  
8. Use nano or another editor to modify config.php as desired. 
+
modify the configuration file
 +
nano phpsysinfo.ini
  
'''nano config.php'''
+
optional changes
  
 +
DEFAULT_LANG="en"
 +
LOAD_BAR=true
 +
USE_VHOST=true
 +
SENSOR_PROGRAM="LMSensors"
 +
HDD_TEMP="command"
 +
HIDE_FS_TYPES="tmpfs,devtmpfs"
  
9. Save and close the config.php file. Go to your hda Web Apps tab in a browser (http://setup then select Web Apps). Click on New Web App.
 
  
10. Enter "phpsysinfo" in the Name field. The Root Path field will automatically append the directory name onto the /var/hda/web-apps directory.
+
For Ubuntu run also
 +
sudo dpkg-reconfigure hddtemp
 +
and set suid to YES
  
11. Click Create. A URL will be created and displayed.
+
after saving phpsysinfo.ini phpsysinfo will provide voltage, fan, temperature data and more
  
12. PHPSysInfo should now be succesfully installed and running. To verify, click on the URL. If you are presented with your system information, phpsysinfo has been successfully installed.
+
=== Configure SMART information ===
 +
Ref:  [http://mewbies.com/how_to_install_phpsysinfo_nix_tutorial.html How to install phpSysInfo]
  
== Getting More Info ==
+
yum install smartmontools
  
After the one click install of phpsysinfo in Amahi 5.1 I needed to do some modifications to get all system information displayed.
+
::'''NOTE:'''  <code>yum</code> (deprecated) has been replaced with <code>dnf</code> as the package manager for Fedora 23 and greater.
For other users, this is what I did.
 
  
first open a terminal session and login as root
+
In phpsysinfo.ini (located in ''/var/hda/web-apps/phpsysinfo/html'')<br />
from another computer
+
:<code>ADD_PATHS="/usr/sbin,/sbin"</code>
in windows with putty
+
:<code>PLUGINS="SMART"</code>
or in linux: ssh root@hda
+
:<code>DEVICES="/dev/sda,/dev/sdb"</code>
  
type
+
You also need to change the plugin script and give apache permission to use smartctl with the sudo command:
  
yum install lm_sensors
+
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:
 +
First we make a copy of the original
 +
cp /var/hda/web-apps/phpsysinfo/html/plugins/smart/class.smart.inc.php /var/hda/web-apps/phpsysinfo/html/plugins/smart/class.smart.inc.php.bak
  
sensors-detect
+
Now edit the following file:
 +
nano /var/hda/web-apps/phpsysinfo/html/plugins/smart/class.smart.inc.php
 +
Search for (Ctrl+w) (line 60): --all
 +
It has this:
  
keep pressing enter for default answers.
+
:<code>if ( trim($diskname != "") && (CommonFunctions::executeProgram('smartctl', '--all'.' '.$diskdev.' '.$diskname, $buffer, PSI_DEBUG))) {</code>
  
cd /var/hda/web-apps/phpsysinfo/html
+
Change it to:
  
cp config.php config.php_bak
+
:<code>if ( trim($diskname != "") && (CommonFunctions::executeProgram('sudo', 'smartctl --all '.' '.$diskdev.' '.$diskname, $buffer, PSI_DEBUG))) {</code>
 
to make a backup of your original config file
 
  
nano config.php
+
Just a note that all we changed was:<br />
 +
:<code>'smartctl', '--all'</code>
 +
To:<br />
 +
:<code>'sudo', 'smartctl --all '</code>
  
I changed the following lines, but of course this is optional.
+
Change yours to be the same, including the space: all '
define('sensorProgram', 'LMSensors');
+
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''
define('hideMounts', '/boot');
+
And be sure that <code>smartctl</code> is the correct path.
define('hideFstypes', 'tmpfs');
 
define('hddTemp', 'tcp');
 
define('loadBar', true);
 
  
after saving the config.php phpsysinfo also provides voltage, fan and temperature data.
+
Next we need to add your web server group to ''sudo'' to be able to run <code>smartctl</code> cmds:
 +
sudo visudo
 +
Paste in this line under ''# User privilege specification'', changing your
 +
web server group (apache) to your own. For example I have pasted in:<br />
 +
:<code>apache ALL=NOPASSWD: /usr/sbin/smartctl</code>

Latest revision as of 03:52, 18 June 2017

Getting More Info

After the one click install of phpsysinfo in Amahi 6 or greater, you need to do some modifications to get all system information displayed.

Install lm-sensors

Fedora

open a terminal session and login as root or if you have sudo configured use sudo in front of all commands.

type

su -

at the prompt enter your root password

then type

yum install lm_sensors
sensors-detect
NOTE: yum (deprecated) has been replaced with dnf as the package manager for Fedora 23 and greater.

Ubuntu

sudo apt-get install lm-sensors
sudo sensors-detect


Answer the questions. At the end of sensors-detect, Type "yes" to have sensors-detect insert modules into /etc/modules, or edit /etc/modules yourself service module-init-tools start

See Install and configure lm-sensors for additional help.

Configure Settings

first make a backup of your original configuration file

cd /var/hda/web-apps/phpsysinfo/html
cp phpsysinfo.ini phpsysinfo.inibak

if neccessary

yum install nano
NOTE: yum (deprecated) has been replaced with dnf as the package manager for Fedora 23 and greater.

modify the configuration file

nano phpsysinfo.ini

optional changes

DEFAULT_LANG="en"
LOAD_BAR=true
USE_VHOST=true
SENSOR_PROGRAM="LMSensors"
HDD_TEMP="command"
HIDE_FS_TYPES="tmpfs,devtmpfs"


For Ubuntu run also

sudo dpkg-reconfigure hddtemp

and set suid to YES

after saving phpsysinfo.ini phpsysinfo will provide voltage, fan, temperature data and more

Configure SMART information

Ref: How to install phpSysInfo

yum install smartmontools
NOTE: yum (deprecated) has been replaced with dnf as the package manager for Fedora 23 and greater.

In phpsysinfo.ini (located in /var/hda/web-apps/phpsysinfo/html)

ADD_PATHS="/usr/sbin,/sbin"
PLUGINS="SMART"
DEVICES="/dev/sda,/dev/sdb"

You also need to change the plugin script and give apache permission to use smartctl with the sudo command:

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: First we make a copy of the original

cp /var/hda/web-apps/phpsysinfo/html/plugins/smart/class.smart.inc.php /var/hda/web-apps/phpsysinfo/html/plugins/smart/class.smart.inc.php.bak

Now edit the following file:

nano /var/hda/web-apps/phpsysinfo/html/plugins/smart/class.smart.inc.php

Search for (Ctrl+w) (line 60): --all It has this:

if ( trim($diskname != "") && (CommonFunctions::executeProgram('smartctl', '--all'.' '.$diskdev.' '.$diskname, $buffer, PSI_DEBUG))) {

Change it to:

if ( trim($diskname != "") && (CommonFunctions::executeProgram('sudo', 'smartctl --all '.' '.$diskdev.' '.$diskname, $buffer, PSI_DEBUG))) {

Just a note that all we changed was:

'smartctl', '--all'

To:

'sudo', '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 smartctl is the correct path.

Next we need to add your web server group to sudo to be able to run smartctl cmds:

sudo visudo

Paste in this line under # User privilege specification, changing your web server group (apache) to your own. For example I have pasted in:

apache ALL=NOPASSWD: /usr/sbin/smartctl