Coder Social home page Coder Social logo

linux-serverbot's Introduction

This project migrated to https://github.com/nozel-org/freebsd-serverbot and is unmaintained.

Serverbot

Serverbot is a simple and small (<50 kilobytes/<1500 LOC) server monitoring tool that is both easy to use and easy to extend. We found most monitoring software to be overkill for our needs and made a simplistic and lightweight alternative. It's well commented and can be easily extended or hacked to provide more features.

It offers the following features:

Feature Description
Overview Outputs a rather complete server overview.
Metrics Outputs server metrics like uptime, load, ram and disk.
Alert Outputs whether load, ram or disk space exceeds the configured threshold.
Updates Outputs available system updates.
EOL Outputs whether the operating system is end-of-life.

Aside from features, there are also different methods that can be used with the features:

Method Description
CLI Feature feedback or output on the CLI.
Telegram Feature feedback or output to a Telegram bot.

Some examples from both Telegram and CLI: alt text

Install serverbot

Easy! But before you download software, always check its source code and/or credibility. Never trust random people on the internet ;-). If you are particularly gullible or like living on the edge, you can also skip this. To install, download serverbot.sh to your device and run bash serverbot.sh --install to install.

Some common methods of downloading the file would be:

wget https://raw.githubusercontent.com/nozel-org/serverbot/master/serverbot.sh
curl -O https://raw.githubusercontent.com/nozel-org/serverbot/master/serverbot.sh

Use serverbot

After installing serverbot you can run serverbot as a normal command. For example serverbot --metrics --cli or the shorter notation serverbot -m -c. Parameters like automated tasks and thresholds can be configured from a central configuration file in /etc/serverbot/serverbot.conf.

serverbot --help provides a handy overview of arguments:

root@server:~# serverbot --help
Usage:
 serverbot [feature]... [method]...
 serverbot [option]...

Features:
 --overview        Show server overview
 --metrics         Show server metrics
 --alert           Show server alert status
 --updates         Show available server updates
 --eol             Show end-of-life status of operating system

Methods:
 --cli             Output [feature] to command line
 --telegram        Output [feature] to Telegram bot

Options:
 --cron            Effectuate cron changes from serverbot config
 --validate        Check validity of serverbot.conf
 --install         Installs serverbot on the system and unlocks all features
 --upgrade         Upgrade serverbot to the latest stable version
 --uninstall       Uninstalls serverbot from the system
 --help            Display this help and exit
 --version         Display version information and exit

For information on how to aquire a Telegram bot, look at Telegram's documentation.

Support

If you can't figure something out, take a look at the documentation. If you can't figure it out on your own, create a issue and we'll help you when there is time. If you find bugs: please let us know!

Compatibility

We try to support a wide range of linux distributions. As of now, support includes most distros set to English that use dpkg (apt-get, apt), rpm (yum, dnf), systemd and bash. This should include at least the following distributions (which have been tested during developement):

Distro name Compatible releases
Debian GNU/Linux 8, 9, 10
Ubuntu 14.04 LTS, 14.10, 15.04, 15.10, 16.04 LTS, 16.10, 17.04, 17.10, 18.04 LTS, 18.10, 19.04, 19.10 LTS
RHEL 7, 8
CentOS 7, 8
Fedora 27, 28, 29, 30, 31

Note that feature eol specifically will only work on pre-defined distributions. Let us know what distro you use, and we will add full support for it as long as it meets the basic requirements of serverbot.

Roadmap

The below ideas are planned for future releases of serverbot.

  • Add feature end-of-life that notifies when the OS is nearing EOL status (Q3 2019).
  • Add feature outage that monitors the availability of remote systems and reports the status (Q1 2020).
  • Add method email (Q1 2020).
  • Add feature audit that audits (web)servers (TLS, security headers, firewalls, DNS records etc.) (Q2 2020)

Ideas

The below ideas are unplanned for future releases of serverbot.

  • Extend feature alert with SSD life expectancy.
  • Extend feature alert or add feature login with realtime logins and currently logged in users.
  • Extend feature alert with filesystem monitoring.
  • Extend feature alert with CPU / HDD temperature monitoring.
  • Extend feature alert with USB device monitoring.
  • Extend feature alert with notice on shutdown and boot.
  • Extend feature overview with total network traffic amount.
  • Extend feature overview with logged in users.
  • Add support for Alpine Linux.
  • Add support for NixOS.
  • Add support for FreeBSD.
  • Add support for OpenBSD.

More ideas are welcome!

linux-serverbot's People

Contributors

sveeke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

linux-serverbot's Issues

Make automatic update possible

Of course just downloading a new version every week is possible with a cronjob, but I would much rather use something that checks of there are updates available first.

Options to investigate:

  • GitHub API that lists the latest date changes were made?
  • VERSION-file that consists of a variable for the version, that gets checked daily for a higher number.

Feature Manage Cron

Cronjobs should be managed by the argument --cron. It would be even better if there could be only one cronjob file, but this might add too much code.

Feature Alert

Base alert feature that checks cpu load, memory consumption and disk usage.

Echo's in error functions are not consistent

#############################################################################
# ERROR FUNCTIONS
#############################################################################

function error_invalid_option {

    echo
    echo "serverbot: invalid option -- '$@'"
    echo "Try 'serverbot --help' for more information."
    echo
    exit 1
}

function error_not_yet_implemented {

    echo "[!] Error: this feature has not been implemented yet."
    exit 1
}

function error_os_not_supported {

    echo
    echo '[!] Error: this operating system is not supported.'
    echo
    exit 1
}

function error_method_not_available {

    echo
    echo '[!] Error: this method is not available without Serverbot configuration file.'
    echo
    exit 1
}

Update serverbot.conf

  • Easy to follow comments
  • Clear lay-out
  • Not too much bloat
  • Make it definitive / non-breaking for 1.X

FreeBSD support

Check whether Serverbot can be made compatible with FreeSBD.

Add main function

To follow conventions, the main code should be in the function main.

Unset variables in serverbot

It seems hardly common that something else uses one of the variables I use, especially global ones. But just to be safe I could take a look at unsetting the vars first in the script.

Feature Overview

Add new feature so show a more complete overview of the system. With stuff like:

  • hostname
  • ipv4
  • ipv6
  • uptime
  • OS
  • kernel
  • cpu
  • ram
  • disk

Should be easy to implement since all gather functions are already there.

Stand alone operation

Serverbot should be able to function without a config file, with some default values that get used when the config file isn't available.

Consider putting all features in functions

Instead of having much of the feature functions in the main function if's, I could also put them in dedicated functions, so the main function's if's consist solely of function calls. This might improve readability.

Feature Generate Config

When user wants to go from stand alone mode to config mode, it should be made easy for him/her :).

NixOS support

Investigate whether this is something that can be done easily.

Support: old versions of Ubuntu

Ubuntu 14.04 LTS (Trusty Tahr)
Ubuntu 14.10 (Utopic Unicorn)
Ubuntu 15.04 (Vivid Vervet)
Ubuntu 15.10 (Wily Werewolf)
Ubuntu 16.04 LTS (Xenial Xerus)
Ubuntu 16.10 (Yakkety Yak)
Ubuntu 17.04 (Zesty Zapus)
Ubuntu 17.10 (Artful Aardvark)
Ubuntu 18.04 LTS (Bionic Beaver)
Ubuntu 18.10 (Cosmic Cuttlefish)
Ubuntu 19.04 (Disco Dingo)
Ubuntu 19.10 LTS (Eoan Ermine)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.