Difference between revisions of "PhpSysInfo"

From Amahi Wiki
Jump to: navigation, search
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:Apps]]
 
[[Category:Apps]]
 
== Getting More Info ==
 
== Getting More Info ==
After the one click install of phpsysinfo in Amahi 6 or 7, you need to do some modifications to get all system information displayed.
+
After the one click install of phpsysinfo in Amahi 6 or greater, you need to do some modifications to get all system information displayed.
 
 
This [http://mewbies.com/how_to_install_phpsysinfo_nix_tutorial.html How to install phpSysInfo] tutorial is quite helpful.
 
  
 
==Install lm-sensors ==
 
==Install lm-sensors ==
Line 16: Line 14:
 
  yum install lm_sensors
 
  yum install lm_sensors
 
  sensors-detect
 
  sensors-detect
 +
 +
::'''NOTE:'''  <code>yum</code> (deprecated) has been replaced with <code>dnf</code> as the package manager for Fedora 23 and greater.
  
 
=== Ubuntu ===
 
=== Ubuntu ===
Line 36: Line 36:
  
 
  yum install nano
 
  yum install nano
 +
 +
::'''NOTE:'''  <code>yum</code> (deprecated) has been replaced with <code>dnf</code> as the package manager for Fedora 23 and greater.
  
 
modify the configuration file
 
modify the configuration file
Line 42: Line 44:
 
optional changes
 
optional changes
  
  DEFAULT_LANG="nl"
+
  DEFAULT_LANG="en"
 
  LOAD_BAR=true
 
  LOAD_BAR=true
 
  USE_VHOST=true
 
  USE_VHOST=true
Line 57: Line 59:
  
 
=== Configure SMART information ===
 
=== Configure SMART information ===
 +
Ref:  [http://mewbies.com/how_to_install_phpsysinfo_nix_tutorial.html How to install phpSysInfo]
  
 
  yum install smartmontools
 
  yum install smartmontools
  
in phpsysinfo.ini
+
::'''NOTE:'''  <code>yum</code> (deprecated) has been replaced with <code>dnf</code> as the package manager for Fedora 23 and greater.
PLUGINS="SMART"
 
  
DEVICES="/dev/sda,/dev/sdb"
+
In phpsysinfo.ini (located in ''/var/hda/web-apps/phpsysinfo/html'')<br />
 +
:<code>ADD_PATHS="/usr/sbin,/sbin"</code>
 +
:<code>PLUGINS="SMART"</code>
 +
:<code>DEVICES="/dev/sda,/dev/sdb"</code>
  
 
You also need to change the plugin script and give apache permission to use smartctl with the sudo command:
 
You also need to change the plugin script and give apache permission to use smartctl with the sudo command:
 
(source http://mewbies.com/how_to_install_phpsysinfo_nix_tutorial.html)
 
  
 
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:
 
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
 
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
 
  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
 
  nano /var/hda/web-apps/phpsysinfo/html/plugins/smart/class.smart.inc.php
 
Search for (Ctrl+w) (line 60): --all
 
Search for (Ctrl+w) (line 60): --all
 
It has this:
 
It has this:
  
if ( trim($diskname != "") && (CommonFunctions::executeProgram('smartctl', '--all'.' '.$diskdev.' '.$diskname, $buffer, PSI_DEBUG))) {
+
:<code>if ( trim($diskname != "") && (CommonFunctions::executeProgram('smartctl', '--all'.' '.$diskdev.' '.$diskname, $buffer, PSI_DEBUG))) {</code>
  
 
Change it to:
 
Change it to:
  
if ( trim($diskname != "") && (CommonFunctions::executeProgram('sudo', '/usr/sbin/smartctl --all '.' '.$diskdev.' '.$diskname, $buffer, PSI_DEBUG))) {
+
:<code>if ( trim($diskname != "") && (CommonFunctions::executeProgram('sudo', 'smartctl --all '.' '.$diskdev.' '.$diskname, $buffer, PSI_DEBUG))) {</code>
 +
 
 +
Just a note that all we changed was:<br />
 +
:<code>'smartctl', '--all'</code>
 +
To:<br />
 +
:<code>'sudo', 'smartctl --all '</code>
  
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 '
 
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
+
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.
+
And be sure that <code>smartctl</code> is the correct path.
  
Next we need to add your web server group to sudo to be able to run smartctl cmds:
+
Next we need to add your web server group to ''sudo'' to be able to run <code>smartctl</code> cmds:
 
  sudo visudo
 
  sudo visudo
Paste in this line under '# User privilege specification', changing your
+
Paste in this line under ''# User privilege specification'', changing your
web server group (apache) to your own. For example I have pasted in:
+
web server group (apache) to your own. For example I have pasted in:<br />
apache ALL=NOPASSWD: /usr/sbin/smartctl  
+
:<code>apache ALL=NOPASSWD: /usr/sbin/smartctl</code>
'''(WARNING you are using the vi-editor, first google "vi commands" for some guidance!)'''
 

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