Skip to content

🐧 Go-based CLI tool for Linux system administration with Zabbix and Prometheus integrations - kernel management, update monitoring, and automated maintenance

License

Notifications You must be signed in to change notification settings

yaroslav-gwit/SysChecks_v2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SysChecks v2

License Go Version Linux

A powerful, production-ready CLI tool for Linux system administration and monitoring. Built in Go for speed and reliability, SysChecks extends Zabbix functionality with kernel management, update monitoring, automated maintenance, and beautiful system banners.

✨ Features

  • πŸ” Kernel Management - Check reboot requirements and clean up old kernels
  • πŸ“¦ Update Monitoring - Track system and security updates with caching
  • πŸ€– Automated Updates - Schedule automatic security/system updates via cron
  • πŸ“Š Zabbix Integration - Native UserParameter support for monitoring
  • 🎨 SSH Login Banner - Beautiful system info display on login
  • ⚑ Performance - Fast execution with intelligent caching
  • πŸ”’ Package Locking - Prevent specific packages from auto-updating
  • 🐧 Multi-Distro - Supports Debian/Ubuntu, RHEL/CentOS/AlmaLinux/Rocky

πŸš€ Quick Start

One-Line Installation

curl -sSL https://raw.githubusercontent.com/yaroslav-gwit/SysChecks_v2/main/auto-install.sh | sudo bash

That's it! The script will:

  • Download the latest release binary
  • Install to /opt/syschecks/ and link to /usr/bin/
  • Set up bash completion (if available)
  • Configure cron jobs for update caching and automatic security updates
  • Preserve your configuration on updates

Manual Installation

# Download the binary
VERSION="1.0.0"  # Replace with desired version
wget https://github.com/yaroslav-gwit/SysChecks_v2/releases/download/v${VERSION}/syschecks-linux-amd64

# Install
sudo mkdir -p /opt/syschecks
sudo mv syschecks-linux-amd64 /opt/syschecks/syschecks
sudo chmod +x /opt/syschecks/syschecks
sudo ln -s /opt/syschecks/syschecks /usr/bin/syschecks

# Enable bash completion
sudo syschecks completion bash > /etc/bash_completion.d/syschecks

πŸ“– Usage

Check Kernel Status

# Check if kernel reboot is needed
syschecks kernel

# Pretty-printed JSON output
syschecks kernel --json-pretty

# Sample output:
{
   "kernel_needs_reboot": true,
   "running_kernel": "5.15.0-91",
   "latest_installed_kernel": "5.15.0-92",
   "active_kernels": ["5.15.0-91", "5.15.0-92"]
}

Clean Up Old Kernels

# Keep 4 most recent kernels (default)
sudo syschecks kernel cleanup

# Keep only 2 kernels
sudo syschecks kernel cleanup --keep 2

Check for Updates

# Check for updates (uses cache by default)
syschecks updates

# Force fresh check and create new cache
sudo syschecks updates --cache-create

# Pretty output
syschecks updates --json-pretty

Apply Updates

# Apply security updates only (default)
sudo syschecks apply-updates

# Apply all system updates
sudo syschecks apply-updates --system

# Ignore package lock file
sudo syschecks apply-updates --ignore-lock-file

Display System Banner

# Show system information banner
syschecks banner

# Without emojis
syschecks banner --no-emojies

To show banner on SSH login:

echo '([ -z "$PS1" ] && true) || syschecks banner' | sudo tee /etc/profile.d/syschecks_banner.sh
sudo chmod +x /etc/profile.d/syschecks_banner.sh

Cron Job Management

# Set up update cache refresh (runs every 12 hours)
sudo syschecks cron init

# Enable automatic security updates (runs daily at 4:15 AM)
sudo syschecks cron updates --security

# Enable automatic system updates
sudo syschecks cron updates --system

Zabbix Integration

# Initialize Zabbix agent integration
sudo syschecks zabbix init

This adds a UserParameter to your Zabbix agent configuration:

UserParameter=syschecks[*],syschecks $1

Usage in Zabbix:

  • Item key: syschecks[kernel] - Kernel status
  • Item key: syschecks[updates] - Update status
  • Item key: syschecks[sysinfo] - System IP addresses

πŸ”§ Configuration

Package Lock File

Prevent specific packages from being updated automatically:

Location: /opt/syschecks/package.lock.json

[
  "docker-ce",
  "docker-ce-cli",
  "nvidia-driver",
  "linux-headers"
]

Locked packages will be skipped during automatic updates. Use --ignore-lock-file flag to override.

Cache Files

  • /tmp/syscheck_updates.json - Update check cache (refreshed every 12 hours)

Cron Jobs

  • /etc/cron.d/syschecks_cache - Update cache refresh
  • /etc/cron.d/syschecks_updates_security - Automatic security updates
  • /etc/cron.d/syschecks_updates_system - Automatic system updates

Logs

  • /var/log/syschecks_updates.log - Automatic update log

πŸ“Š Supported Linux Distributions

Distribution Package Manager Status
Ubuntu 18.04+ apt βœ… Tested
Debian 9+ apt βœ… Tested
Pop!_OS apt βœ… Tested
CentOS 7 yum βœ… Tested
AlmaLinux 8+ dnf βœ… Tested
Rocky Linux 8+ dnf βœ… Tested
RHEL 8+ dnf βœ… Tested
Oracle Linux 8+ dnf βœ… Tested

πŸ” Command Reference

syschecks
β”œβ”€β”€ kernel [--json-pretty]        # Check kernel reboot status
β”‚   └── cleanup [--keep N]        # Clean up old kernels
β”œβ”€β”€ updates [flags]                # Check for updates
β”‚   β”œβ”€β”€ --json-pretty              # Pretty JSON output
β”‚   β”œβ”€β”€ --cache-create             # Create new cache
β”‚   └── --cache-use                # Use existing cache (default)
β”œβ”€β”€ apply-updates [flags]          # Apply updates
β”‚   β”œβ”€β”€ --system, -s               # Apply all updates (not just security)
β”‚   └── --ignore-lock-file, -i     # Ignore package lock
β”œβ”€β”€ banner [--no-emojies, -n]      # Display system banner
β”œβ”€β”€ cron                           # Cron job management
β”‚   β”œβ”€β”€ init                       # Set up cache cron
β”‚   └── updates [--security|--system]  # Enable auto-updates
β”œβ”€β”€ zabbix                         # Zabbix integration
β”‚   └── init                       # Initialize Zabbix support
β”œβ”€β”€ sysinfo                        # System IP addresses (JSON)
└── version [--verbose, -v]        # Show version info

πŸ› Troubleshooting

Command not found

Ensure /usr/bin is in your PATH:

echo $PATH
which syschecks

Permission denied

Most commands work without root, but some require it:

sudo syschecks updates --cache-create
sudo syschecks apply-updates
sudo syschecks kernel cleanup

Cache is stale

Refresh the cache manually:

sudo syschecks updates --cache-create

Zabbix not picking up metrics

  1. Verify UserParameter was added:

    grep syschecks /etc/zabbix/zabbix_agentd.conf
  2. Test from command line:

    syschecks kernel
  3. Test via zabbix_get:

    zabbix_get -s 127.0.0.1 -k "syschecks[kernel]"

Package lock not working

Verify the file exists and has correct permissions:

ls -la /opt/syschecks/package.lock.json
cat /opt/syschecks/package.lock.json

πŸ—οΈ Building from Source

Prerequisites

  • Go 1.21 or later
  • Git

Build

# Clone the repository
git clone https://github.com/yaroslav-gwit/SysChecks_v2.git
cd SysChecks_v2

# Standard build
./build.sh

# The binary will be in ./bin/syschecks
./bin/syschecks version

Build Options

# Cross-compilation
./build-advanced.sh

# Docker-based build (for maximum compatibility)
./docker-build.sh

# Manual build with version info
VERSION=$(git describe --tags --always --dirty)
COMMIT=$(git rev-parse --short HEAD)
DATE=$(date -u '+%Y-%m-%d_%H:%M:%S_UTC')

go build -ldflags="-X 'syschecks/cmd.Version=$VERSION' \
  -X 'syschecks/cmd.GitCommit=$COMMIT' \
  -X 'syschecks/cmd.BuildDate=$DATE'" \
  -o ./bin/syschecks

πŸ“š Documentation

🀝 Contributing

Contributions are welcome! Please read our Development Guide and Constitution before submitting PRs.

Quick Contribution Guide

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Follow the coding standards in CONSTITUTION.md
  4. Test your changes thoroughly
  5. Commit with clear messages: feat: add new feature
  6. Push and create a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Built with Cobra CLI framework
  • Inspired by the need for better system monitoring tools
  • Thanks to all contributors and users

πŸ“§ Support


Made with ❀️ for Linux sysadmins

About

🐧 Go-based CLI tool for Linux system administration with Zabbix and Prometheus integrations - kernel management, update monitoring, and automated maintenance

Topics

Resources

License

Stars

Watchers

Forks