Skip to content

PaulSorensen/server-stats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Server Stats

Overview

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.

Features

  • 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.

Requirements

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

Usage

  1. Set up configuration file:
    • Copy the example config file:
    cp server-stats.conf.example server-stats.conf
  2. Make the script executable:
    chmod +x server-stats.sh
  3. Run the script:
    ./server-stats.sh

Configuration

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.

Automatically Execute on SSH Login

If you want the script to run automatically every time you log in via SSH, follow these steps:

  1. Open your shell profile file in a text editor:

    nano ~/.bashrc

    Or if you use zsh:

    nano ~/.zshrc
  2. Add the following line at the end of the file (replace the path with your actual path):

    ~/scripts/server-stats/server-stats.sh
  3. Save and exit (in nano: press CTRL + X, then Y, then Enter).

  4. Apply the changes:

    source ~/.bashrc

Now, the script will execute automatically each time you log in via SSH.

Important Notes

  • All data reported is a snapshot in time and not updated in real-time.

Enjoying This Script?

If you found this script useful, a small tip is appreciated ❤️
https://buymeacoffee.com/paulsorensen

License

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.

About

Provides a snapshot of key system information.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages