[DZ] AdminCP Server Information

[DZ] AdminCP Server Information 1.1.0

No permission to download

jjasko11

Active member
jjasko11 submitted a new resource:

[DZ] AdminCP Server Information - server-info

[DZ] AdminCP Server Information


A lightweight but powerful system monitoring tool for XenForo 2.
This add-on adds a fully dynamic Server Status Dashboard directly inside your AdminCP, refreshing automatically every 5 seconds.


🔍 Features


  • Real-time server monitoring (RAM, CPU, Disk, PHP memory)
  • Live network usage (RX/TX)
  • Active TCP/UDP connections
  • Load averages (1 / 5 / 15 min)
  • Uptime, hostname, IP address...

Read more about this resource...
 
Hello.
Will this addon work on FreeBSD?
It wouldn't as currently written (fellow FreeBSD user here!). Whilst there is a check to see if the OS is Windows it's only an if/else (FWIW the windows output is a hard coded example rather than dynamic data at present) and the commands run in the else are Linux specific (either the commands or switches). So the data is gathered using lines such as $loadLine = $this->runCommand("cat /proc/loadavg | awk '{print \$1, \$2, \$3}'");. You could add another switch to check for FreeBSD and put in equivalent commands and parse their output.
 
Ne bi tako trenutno napisano (dopustite korisnika FreeBSD-a ovdje!). Iako postoji provjera da li je OS Windows, to je samo ako / else (FWIW izlaz prozora je teško kodiran primjer, a ne dinamični podaci) i naredbe koje se pokreću u inače su Linux specifični (bilo naredbe ili prekidači). Dakle, podaci se prikupljaju pomoću linija poput $loadLine = $this->runCommand("cat /proc/loadavg | awk '{print \$1, \$2, \$3}'");, Možete dodati još jedan prekidač za provjeru FreeBSD-a i staviti u jednake naredbe i raščlaniti njihov izlaz.
good idea, there will be a future update if you have any other ideas feel free to write
 
jjasko11 updated [DZ] AdminCP Server Information with a new update entry:

Version 1.0.1 — Stability Improvements & Cleanup

Ovo ažuriranje donosi važne popravke stabilnosti i unutarnja poboljšanja kako bi se osigurao glađi rad modula za praćenje podataka o poslužitelju i Redis.


🔧 Što je novo u 1.0.1


  • Fiksni problem s opcijskim zaslonom: nositelj mjesta “Info ” polje je pogrešno prikazano na stranici opcija AKP-a — sada pravilno skriveno i više nije vidljivo za prijem.
  • Očistili neiskorištene definicije opcija i osigurali kompatibilnost s XenForo 2.3 formatiranjem...

Read the rest of this update entry...
 
jjasko11 updated [DZ] AdminCP Server Information with a new update entry:

Server Info Add-on — Version 1.1.0 (Linux + FreeBSD + Windows Support)

Update message


Version 1.1.0 delivers a significant expansion of functionality and improved compatibility across multiple operating systems.




🔧


Full FreeBSD support added


  • Reads RAM, CPU, load average, disk usage and network statistics
  • Automatically detects BSD environment and uses native system commands

Basic Windows support added


  • Automatic Windows OS detection...

Read the rest of this update entry...
 
Is there any chance of any history on some of this really useful info?
I'm looking to change hosts soon, so would be good to know (over time) what max/mins etc have been. Or maybe something like this?? :

1765473737422.webp

Maybe a graph showing ram/cpu/disk over the previous 30/60/90 days??

Just asking... ;) :)
 
Nice idea :)

Some suggestions
  1. The Add-on displays quite sensitive information so access to the controller should be guarded by admin permission serverInfo, not node
  2. The service is quite complex; I'd split this into an abstract service and one service per OS
  3. You may want to consider retuning a ServerInfo object with strictly typed properties instead of an array
  4. addon.json is missing the PHP 8 system requirement
  5. A direct call to echo in a controller is not how a controller should work, it should always return a \XF\Mvc\Reply\AbstractReply or throw an Exception
  6. formatUptime() uses a hardcoded format, ideally this should use language settings for date / time formatting as far as possible
  7. I'd probably avoid to use shell_exec directly, especially as it doesn't allow to get the exit code so you don't really know if the call was successful or had errors.
    XenForo bundles the Symfony Process component, this provides an high-level, elegant, feature rich and safe way to run commands so I'd use this instead and probably also run all the extraction logic (sed, awk, head, etc.) in PHP to reduce the depencency on external tools.
  8. The (PHP-FPM) process running the XenForo web code might not have access to the tools / paths you are reading / executing in a restricted (hardened) environment.
    You may want to consider alternatives for this use-case (for example a CLI command that updates the cache while the web code only reads it or a standalone script (Bash) that outputs JSON)
 
The 5 second polling should be configurable too. That's WAY too much load for my liking. Per haps an on-the-fly ping when the page loads could be an option.
 
Nice idea :)

Some suggestions
  1. The Add-on displays quite sensitive information so access to the controller should be guarded by admin permission serverInfo, not node
  2. The service is quite complex; I'd split this into an abstract service and one service per OS
  3. You may want to consider retuning a ServerInfo object with strictly typed properties instead of an array
  4. addon.json is missing the PHP 8 system requirement
  5. A direct call to echo in a controller is not how a controller should work, it should always return a \XF\Mvc\Reply\AbstractReply or throw an Exception
  6. formatUptime() uses a hardcoded format, ideally this should use language settings for date / time formatting as far as possible
  7. I'd probably avoid to use shell_exec directly, especially as it doesn't allow to get the exit code so you don't really know if the call was successful or had errors.
    XenForo bundles the Symfony Process component, this provides an high-level, elegant, feature rich and safe way to run commands so I'd use this instead and probably also run all the extraction logic (sed, awk, head, etc.) in PHP to reduce the depencency on external tools.
  8. The (PHP-FPM) process running the XenForo web code might not have access to the tools / paths you are reading / executing in a restricted (hardened) environment.
    You may want to consider alternatives for this use-case (for example a CLI command that updates the cache while the web code only reads it or a standalone script (Bash) that outputs JSON)
This is my first addon (apart from translations for some) of course I will consider your ideas and advice
 
The 5 second polling should be configurable too. That's WAY too much load for my liking. Per haps an on-the-fly ping when the page loads could be an option.
Yeah, a fetch ("AJAX") every 5 seconds is too much considering the overhead for a full HTTP request, framework bootstrap, etc.

Ideally a WS connection should be used for realtime updates, but that probably would be too complicated / impossible to setup for most XenForo customers.
 
Back
Top Bottom