The graphit/sysadmtools repository contains a bunch of small tools our system administrators use to maintain our servers.
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.
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.
Here's an overview over all the tools and files we use. Note that some scripts will one work when run wit root privileges.
This script uses arcconf to read the S.M.A.R.T. and controler status of the adaptec raid controller on our webspace.
adaptec_raid_check.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.
check_certificates.php [<DOMAIN>[:days]] .. [<DOMAIN>[:days]]
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.
blockdevices.php <action>
This script allows to run 'btrfs scrub' for one or multiple UUIDs and check whether the last 'btrfs scrub'-call produced any errors.
cron_btrfs_scrub.php [uuid1] [uuid2] .. <start|status>
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.
check-ssh-vpn.sh <tunnel device> <public ip> <private ip>
This script allows to run a S.M.A.R.T.-test on disk drives and to check the results.
cron_smart_check.php [disk1] ... <action>
This script creates a backup of all databases using innobackupex which is part of Perconas XtraBackup.
dbbackup.php
This script checks whether a namesserver is active by checking a single domain against it.
dns_online_test.php [DOMAIN] [NAMESERVER]
This script allows create a 'Let's Encrypt SSLp'-certificates using certbot for one or multiple domains.
letsencrypt_create.php <web-root-path> <domain-1> ... <domain-n>
This script sets one pdf as background of another pdf using pdftk.
pdfmixer.php [options] <foreground-PDF> <background-PDF> <output-PDF>
Uploads all the pdf files of a folder to a graph and deletes them.
postbox.php <folder path> [graph-uri] [ca-file] [crt-file]
This script prints a given file x-times on a printer through lpr.
print.php <File> [printer] [count] [-d]
This scripts deletes files inside a folder which are older than 'time-string'.
remove_old_files.php folderpath time-string
Grabs the latest SpamAssassion updates from Heinlein Support.
sa-care.sh
This script allows to do some load tests.
serverstatus.php [hdd:wl] [memory:wl] [cpu] [swap:wl] [check]