Skip to content

A collection of scripts for server management, health checking and reporting

License

Notifications You must be signed in to change notification settings

danielgrant/server-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Server Scripts

report_healthcheck.sh

About

General system healthcheck report that provides an email notification containing the following information:

  • Hostname and system uptime
  • CPU percentage usage
  • System load averages
  • Memory consumption
  • Disk usage
  • IO stats
  • Currently logged in users
  • Last 10 logins
  • Top 10 processes by CPU
  • Top 10 processes by memory

Configuration

The following dependencies are required:

  • sendmail
    • Available via most package managers, for example:
      • Debian variants: apt-get install sendmail
      • Red Hat variants: yum install sendmail
    • The script will pipe the contents of the report into the sendmail executable for email delivery.

Note that these instructions do not detail the installation and configuration of the above package.

The following variables must be set in the script:

  • TO_EMAIL
    • The email addess to which the bandwidth report is sent by sendmail.
  • CMD_SENDMAIL
    • The path to the installed sendmail executable.

Usage

The script can be invoked manually, however ideally it should be invokved through a cron job.

Alternatively, the script can be placed into the /etc/cron.daily, /etc/cron-weekly and / or the /etc/cron.monthly directories, which will be automatically invoked at the respective frequencies. Note that in order for the script to be detected in these directories, the extension .sh should be removed.

Notes

  • All logs generated by the script are redirected to stdout. It is normally the responsbility of the invoker to handle the log output.

report_vnstat.sh

About

Bandwidth reporting script that utilises vnstat to provide email notifications to system administrators with bandwidth usage details for the previous week, day or month.

Configuration

The following dependencies are required:

  • vnstat
    • Provides bandwidth monitoring via the terminal.
    • Available via most package managers, for example:
      • Debian variants: apt-get install vnstat
      • Red Hat variants: yum install vnstat
  • sendmail
    • Available via most package managers, for example:
      • Debian variants: apt-get install sendmail
      • Red Hat variants: yum install sendmail
    • The script will pipe the contents of the report into the sendmail executable for email delivery.

Note that these instructions do not detail the installation and configuration of the above packages.

The following variables must be set in the script:

  • MODE
    • Determines the range of bandwidth information reported, must be one of daily, weekly or monthly.
  • TO_EMAIL
    • The email addess to which the bandwidth report is sent by sendmail.
  • CMD_VNSTAT
    • The path to the installed vnstat executable.
  • CMD_SENDMAIL
    • The path to the installed sendmail executable.

Usage

The script can be invoked manually, however ideally it should be invokved through a cron job.

Alternatively, the script can be placed into the /etc/cron.daily, /etc/cron-weekly and / or the /etc/cron.monthly directories, which will be automatically invoked at the respective frequencies. Note that in order for the script to be detected in these directories, the extension .sh should be removed.

### Notes

  • All logs generated by the script are redirected to stdout. It is normally the responsbility of the invoker to handle the log output.

About

A collection of scripts for server management, health checking and reporting

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages