mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Merge pull request #437 from pi-hole/tweak/FTLdisplay
Improve FTL information box on the Settings page
This commit is contained in:
@@ -140,7 +140,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
if(strpos(exec("ps -p `cat /var/run/pihole-FTL.pid` -o comm="), "pihole-FTL") !== false)
|
||||
$FTL = false;
|
||||
$FTLpid = file_get_contents("/var/run/pihole-FTL.pid");
|
||||
if (file_exists( "/proc/".$FTLpid ))
|
||||
{
|
||||
$FTL = true;
|
||||
}
|
||||
|
||||
+11
-18
@@ -802,17 +802,12 @@
|
||||
<?php
|
||||
if($FTL)
|
||||
{
|
||||
$parts = preg_split('/\s+/',trim(exec("ps -p `cat /var/run/pihole-FTL.pid` -o pid,start,vsz,rss,euser,egroup,cputime,%cpu,%mem")));
|
||||
function get_FTL_data($arg)
|
||||
{
|
||||
global $FTLpid;
|
||||
return trim(exec("ps -p ".$FTLpid." -o ".$arg));
|
||||
}
|
||||
$FTLversion = exec("/usr/bin/pihole-FTL version");
|
||||
// pid
|
||||
// time the command started. If the process was started less than 24 hours ago, the output format is "HH:MM:SS", else it is " Mmm dd" (where Mmm is a three-letter month name).
|
||||
// virtual memory size of the process in KiB
|
||||
// resident set size, the non-swapped physical memory that a task has used (inkiloBytes).
|
||||
// effective user name. This will be the textual user ID, if it can be obtained
|
||||
// effective group ID of the process. This will be the textual group ID, if it can be obtained
|
||||
// cumulative CPU time, "[DD-]hh:mm:ss" format. (alias time)
|
||||
// cpu utilization of the process in "##.#" format. Currently, it is the CPU time used divided by the time the process has been running (cputime/realtime ratio), expressed as a percentage.
|
||||
// ratio of the process's resident set size to the physical memory on the machine, expressed as a percentage.
|
||||
}
|
||||
?>
|
||||
<div class="box box-danger collapsed-box">
|
||||
@@ -822,14 +817,12 @@ if($FTL)
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<?php if($FTL){ ?>FTL version: <?php echo $FTLversion; ?><br>
|
||||
Process identifier (PID): <?php echo $parts[0]; ?><br>
|
||||
Time FTL started: <?php echo $parts[1]; ?><br>
|
||||
User / Group: <?php echo $parts[4]; ?> / <?php echo $parts[5]; ?>
|
||||
<?php if($parts[4] == "root" || $parts[5] == "root"){?><br><span style="color:red">(WARNING: You should not use root as user for running FTL!)</span><?php } ?><br>
|
||||
Total CPU utilization: <?php echo $parts[7]; ?>%<br>
|
||||
Total CPU time: <?php echo $parts[6]; ?><br>
|
||||
Memory utilization: <?php echo $parts[8]; ?>%<br>
|
||||
<span title="Resident memory is the portion of memory occupied by a process that is held in main memory (RAM). The rest of the occupied memory exists in the swap space or file system.">Used memory: <?php echo formatSizeUnits(1e3*$parts[3]); ?></span><br>
|
||||
Process identifier (PID): <?php echo $FTLpid; ?><br>
|
||||
Time FTL started: <?php print_r(get_FTL_data("start")); ?><br>
|
||||
User / Group: <?php print_r(get_FTL_data("euser")); ?> / <?php print_r(get_FTL_data("egroup")); ?><br>
|
||||
Total CPU utilization: <?php print_r(get_FTL_data("%cpu")); ?>%<br>
|
||||
Memory utilization: <?php print_r(get_FTL_data("%mem")); ?>%<br>
|
||||
<span title="Resident memory is the portion of memory occupied by a process that is held in main memory (RAM). The rest of the occupied memory exists in the swap space or file system.">Used memory: <?php echo formatSizeUnits(1e3*floatval(get_FTL_data("rss"))); ?></span><br>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user