Graph-IT

Graph-IT SysAdmTools

The graphit/sysadmtools repository contains a bunch of small tools our system administrators use to maintain our servers.

Installation

Run:

composer create-project graphit/sysadmtools <target folder>
<target folder>/dependencies.php

to install the tools itself into the 'target'-folder. This will also install any dependencies covered by composer and run checks for non-composer covered dependencies through the dependencies_check.php script.

Configuration

Most of the script will run without any parameters or at least use offer to set the parameters through the config.ini file. An example 'config.ini'-file is available as 'config.ini.example'. It is recommend to use:

cp config.ini.example config.ini
nano config.ini

to create a new 'config.ini' and at least adjust the options. Note: Some script will not work or at least not work when their own section or the 'Global' section is missing entries.

Overview

Here's an overview over all the tools and files we use. Note that some scripts will one work when run wit root privileges.

adaptec_raid_check.php

This script uses arcconf to read the S.M.A.R.T. and controler status of the adaptec raid controller on our webspace.

Usage:

adaptec_raid_check.php

check_certificates.php

This script checks whether the expiry date of the SSL certificates of one or multiple domains will be in less than X (default 25) days.

Usage:

check_certificates.php [<DOMAIN>[:days]] .. [<DOMAIN>[:days]]

blockdevices.php

This scripts reads model and serial number for each block device of type 'disk'. It can also update and compare the local values with values saved inside a connected graph.

Usage:

blockdevices.php <action>

cron_btrfs_scrub.php

This script allows to run 'btrfs scrub' for one or multiple UUIDs and check whether the last 'btrfs scrub'-call produced any errors.

Usage:

cron_btrfs_scrub.php [uuid1] [uuid2] .. <start|status>

check-ssh-vpn.sh

This scripts checks whether the tunnel to a remote location is alife by checking whether port 22 can be accessed on it's private an public ip.

Usage:

check-ssh-vpn.sh <tunnel device> <public ip> <private ip>

cron_smart_check.php

This script allows to run a S.M.A.R.T.-test on disk drives and to check the results.

Usage:

cron_smart_check.php [disk1] ... <action>

dbbackup.php

This script creates a backup of all databases using innobackupex which is part of Perconas XtraBackup.

Usage:

dbbackup.php

dns_online_test.php

This script checks whether a namesserver is active by checking a single domain against it.

Usage:

dns_online_test.php [DOMAIN] [NAMESERVER]

letsencrypt_create.php

This script allows create a 'Let's Encrypt SSLp'-certificates using certbot for one or multiple domains.

Usage:

letsencrypt_create.php <web-root-path> <domain-1> ... <domain-n>

pdfmixer.php

This script sets one pdf as background of another pdf using pdftk.

Usage:

 pdfmixer.php [options] <foreground-PDF> <background-PDF> <output-PDF>

postbox.php

Uploads all the pdf files of a folder to a graph and deletes them.

Usage:

postbox.php <folder path> [graph-uri] [ca-file] [crt-file]

print.php

This script prints a given file x-times on a printer through lpr.

Usage:

print.php <File> [printer] [count] [-d]

remove_old_files.php

This scripts deletes files inside a folder which are older than 'time-string'.

Usage:

remove_old_files.php folderpath time-string

sa-care.sh

Grabs the latest SpamAssassion updates from Heinlein Support.

Usage:

sa-care.sh

serverstatus.php

This script allows to do some load tests.

Usage:

serverstatus.php [hdd:wl] [memory:wl] [cpu] [swap:wl] [check]