Server Stats is a Bash script that provides a snapshot of key system information, such as uptime, installed software versions, resource usage, logged-in users, and running services.
- Displays system time and uptime.
- Show installed OS and kernel.
- Shows installed software versions for:
- Nginx
- Apache
- PHP
- Node.js
- MariaDB
- MySQL
- MS SQL
- Apache Cassandra
- Apache Solr
- MongoDB
- Redis
- RavenDB
- Notifies about system updates and security patches.
- Shows logged-in users and their active sessions.
- Displays open public network ports.
- Displays network traffic.
- Reports CPU and memory usage, including per-core utilization.
- Reports disk space usage.
- Lists top 10 memory and CPU-consuming processes.
- Ability to turn features on/off.
The script requires mpstat from sysstat to be installed to fetch CPU info.
sudo apt install sysstat # For Debian/Ubuntu
sudo dnf install sysstat # For RHEL/Fedora- Set up configuration file:
- Copy the example config file:
cp server-stats.conf.example server-stats.conf
- Make the script executable:
chmod +x server-stats.sh
- Run the script:
./server-stats.sh
Edit server-stats.conf and set variables to 'on' to enable features, or leave them empty to disable. Example:
TIME=on #Feature is turned on.
TIME= #Feature is turned off.If you want the script to run automatically every time you log in via SSH, follow these steps:
-
Open your shell profile file in a text editor:
nano ~/.bashrcOr if you use
zsh:nano ~/.zshrc -
Add the following line at the end of the file (replace the path with your actual path):
~/scripts/server-stats/server-stats.sh -
Save and exit (in nano: press
CTRL + X, thenY, thenEnter). -
Apply the changes:
source ~/.bashrc
Now, the script will execute automatically each time you log in via SSH.
- All data reported is a snapshot in time and not updated in real-time.
If you found this script useful, a small tip is appreciated ❤️
https://buymeacoffee.com/paulsorensen
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License.
Legal Notice: If you edit and redistribute this code, you must mention the original author, Paul Sørensen (paulsorensen.io), in the redistributed code or documentation.
Copyright (C) 2025 Paul Sørensen (paulsorensen.io)
See the LICENSE file in this repository for the full text of the GNU General Public License v3.0, or visit https://www.gnu.org/licenses/gpl-3.0.txt.