DRSM Documentation Live demo Downloads

Thresholds and alerts

Every check has default warning and error levels that suit most hosts. Change them for all hosts in _defaults.conf or for one host in its host file, then decide who gets the email and text alerts.

Plugin settings

Set a plugin's setting as <category>_<name>_<SETTING>=value in etc/hosts/_defaults.conf for every host, or in etc/hosts/<host>.conf for one host. Every plugin also takes TIMEOUT.

$ vi ~/drsm/etc/hosts/db1.conf

storage_disk_WARN=80
storage_disk_CRIT=90
storage_disk_SKIP="/tmp /usr1"
core_memory_MIN_AVAIL_MB=1024
core_load_WARN=16
core_users_ERROR_USERS="root"
PluginSettingDefaultMeaning
core/cpuWARN, CRIT85, 95Total CPU use in percent
NUMPROCS100Processes listed in the report
SAMPLE_SECS2Seconds between the two /proc/stat samples
TEMPSyesReport CPU temperatures when lm_sensors is installed
core/loadWARN, CRIT2x, 4x CPUs15 minute load average; empty scales with the CPU count
core/memoryMIN_AVAIL_MB256Error at or below this much available memory
SWAP_WARN_MB1024Warning at or above this much swap in use
NUMPROCS100Processes listed in the report
core/usersERROR_USERS, WARN_USERSnoneUser names that raise an error or warning when logged in
storage/diskWARN, CRIT90, 99Space and inode use in percent
SKIPnoneMount points to skip
FSTYPESxfs, ext2/3/4, btrfs, zfs, f2fs, jfs, reiserfsLocal file system types to check
storage/raidMEGACLI/opt/MegaRAID/MegaCli/MegaCli64LSI MegaRAID utility, needs sudo
storage/diskioDEVICESall whole disksDisks to report, never alerts
SAMPLE_SECS5Seconds for the current rate sample
cloud/awsIMDS_URL, HTTP_TIMEOUThttp://169.254.169.254, 3EC2 instance metadata service, never alerts
network/nicsNICSall activeInterfaces to check
MAX_DROPPED, MAX_COLLISIONS, MAX_ERRORS1000, 100, 100Alert levels during the sample window
SAMPLE_SECS5Sample window in seconds
network/pingCOUNT, DEADLINE3, 30Packets and deadline, any reply passes
network/http, https, ftpURL<scheme>://<host>URL to test
CONNECT_TIMEOUT, MAX_TIME, RETRIES15, 30, 2curl limits

A Web server that answers with an error page or a redirect still counts as up. An invalid HTTPS certificate counts as a failure.

Profiles for system_report.sh

Sites still on system_report.sh set levels in the $CONFIGdir/<host>_profile.sh script generated for each host. Edit the arguments inside the double quotes:

LineArguments
disk_checks.sh '/tmp /usr1' 80 90Mounts to skip (or NONE), warning %, error %
cpu_checks.sh 75 85 200Warning %, error %, processes listed
load_checks.sh 100 250Warning and error 15 minute load
memory_checks.sh 128 4096 300Error at MB available, warning at MB swap used, processes listed
network_checks.sh '' 5000 500 500 10NICs ('' for all), dropped, collisions, errors, sample seconds
user_checks.sh 'usr1 usr2' 'usr4'Users that raise an error, users that raise a warning

The scripts are copied to $REMOTEdir on each host, drsm/health_check_scripts under the remote user's home by default. Delete a profile to have a new one generated. utils/migrate_systems_dat.sh carries these levels over to host files.

Email and text alerts

Alerts go to root on the monitor host until you add addresses. An alert for the same problem goes out at most once every 4 hours, so a host that stays down does not flood your inbox. Each connectivity alert includes the host's IMPACT line.

$ source ~/.drsm.sh
$ vi $DRSMHOME/etc/alert.email.list

export EMAILlist="root,ops@example.com"

$ $DRSMHOME/bin/test_alert.sh email

Texts now go out as push alerts. A TEXTlist of carrier email to text addresses in alert.email.list still works when no push provider is set.

Most carriers have shut down or filter their email to text gateways, including AT&T (2025), Sprint, Nextel and Cingular. Use a push provider for text alerts.

Push alerts: Pushover, ntfy, Gotify and webhooks

Push alerts go out for errors on production hosts, the alerts that used to send texts, with the same 4 hour throttle as the email. The settings and API tokens are in alert.push.conf. It is read as KEY=value lines, never run as a script. Keep it mode 600.

$ source ~/.drsm.sh
$ cd $DRSMHOME/etc
$ cp alert.push.conf_example alert.push.conf
$ chmod 600 alert.push.conf
$ vi alert.push.conf

PUSH_PROVIDERS="pushover"
PUSHOVER_TOKEN="your application API token"
PUSHOVER_USER="your user or group key"

$ $DRSMHOME/bin/test_alert.sh push
ProviderSettings
pushoverPUSHOVER_TOKEN (application API token), PUSHOVER_USER (user or group key, several comma delimited), PUSHOVER_PRIORITY (-2 to 2, default 1), PUSHOVER_RETRY and PUSHOVER_EXPIRE for priority 2, PUSHOVER_DEVICE, PUSHOVER_SOUND
ntfyNTFY_URL (server and topic), NTFY_TOKEN, NTFY_PRIORITY (1 to 5, default 4)
gotifyGOTIFY_URL, GOTIFY_TOKEN (application token), GOTIFY_PRIORITY
webhookWEBHOOK_URL: a POST of {"title","text","message"} JSON, for Slack style incoming webhooks. The URL is a secret too
smsgatewayMails TEXTlist from alert.email.list, the old way

List several providers comma delimited, such as PUSH_PROVIDERS="pushover,ntfy". The alert text is the ERROR and WARNING lines, each once, cut to PUSH_MAXCHARS (900). PUSH_URL adds a link, such as your dashboard. Tokens and webhook URLs go to curl in a private file, never on the command line, and are never printed. test_alert.sh takes all (the default), email or push. utils/drsm_preflight.sh names the providers, not the keys, and warns when the file can be read by other users.

DEV and QA push hours

Errors on DEV and QA hosts (drsm_run.sh -g dev, -g qa) always send email. They push only inside the hours set by PUSH_DEV_HOURS and PUSH_QA_HOURS in alert.push.conf; with none set they send email only.

# Weekdays, 8 AM up to 5 PM
PUSH_DEV_HOURS="Mon-Fri 08:00-17:00"
PUSH_QA_HOURS="Mon-Fri 08:00-17:00"

A setting is always (or 24x7), never, 8x5 (the same as Mon-Fri 08:00-17:00), or windows [DAYS] HH:MM-HH:MM separated by ;, with DAYS such as Mon-Fri or Sat,Sun (no DAYS: every day). The end time is not included, and an end before the start runs past midnight. The times are in the site's TZ, else the monitor's time zone. PUSH_DEV_HOURS in a site file replaces the one in alert.push.conf for that site. These pushes have their own 4 hour throttle per site and tier, so an error found before the hours start pushes as soon as they do, even though its email went out less than 4 hours ago.

Email hours

By default alert emails go out at any time. EMAIL_DEV_HOURS and EMAIL_QA_HOURS in alert.push.conf (or a site file, which replaces it for that site) hold DEV and QA alert emails to those hours, with the same values and time zone as the push hours. Outside them drsm_run.sh logs INFO - dev alert held outside email hours (8x5) and sends nothing; the dashboard and reports are not changed. A held alert does not start the 4 hour email throttle, so if the error is still there the first run inside the hours emails it.

# DEV and QA email weekdays, 8 AM up to 5 PM; production any time
EMAIL_DEV_HOURS="8x5"
EMAIL_QA_HOURS="8x5"

EMAIL_PROD_HOURS (or EMAIL_OPS_HOURS) holds production emails the same way, unset is 24x7. Production errors still push at any time, and that push starts the 4 hour throttle the email shares. DEV and QA push hours are separate settings and work as before. utils/drsm_preflight.sh checks the values.

Standby and powered off hosts

Hosts with STATUS=standby or STATUS=poweredoff in their host file never send an alert (email, text or push), whatever they find, offline included; their reports and the dashboard still show it. POWEREDOFF_ALERTS=yes lets a powered off host alert while it is on. A decommissioned host is not checked at all. See Host status.

Agent hosts that stop reporting (new in 1.36). An active Windows or Linux agent host whose agent report is missing or older than OFFLINE_HOURS (default 4) gets ERROR - web1 is not reporting, agent report missing for 4h 10m and alerts like any other error: email, push (DEV and QA inside their push hours) and texts for OPS, with the 4 hour throttle. Before 1.36 an old agent report warned at 48 hours and alerted at 15 days. A laptop or VM that is off overnight or on weekends should get a larger OFFLINE_HOURS in its host file (such as OFFLINE_HOURS=72) or STATUS=poweredoff; OFFLINE_HOURS=0 turns the check off for a host. Other active hosts alert exactly as before.

Per site and per tier addresses

With organizations and sites, ALERT_EMAIL in a site file sends that site's alerts to its own addresses in place of EMAILlist, and the subject names the site. ALERT_EMAIL_DEV, ALERT_EMAIL_QA and ALERT_EMAIL_OPS go further and give each tier its own addresses, falling back to ALERT_EMAIL. Each site has its own 4 hour throttle. OPS (production) alerts send texts and push alerts at any time, DEV and QA alerts only inside their push hours.

# etc/sites/acme/hq.site
ALERT_EMAIL="ops@acme.example"
ALERT_EMAIL_DEV="dev-team@acme.example"
ALERT_EMAIL_QA="qa@acme.example"

DRSM uses the first mail, mailx or s-nail command it finds. Set MAILcmd in ~/.drsm.sh to use another.

Relay host

If your network has a mail relay, point postfix at it:

# vi /etc/postfix/main.cf

relayhost = 192.168.1.12

# systemctl restart postfix

Smart host

Without a relay, or on a cloud server where port 25 is blocked, send through an external mail account on port 587:

# vi /etc/postfix/main.cf

smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/relay_passwd
relayhost = [smtp.gmail.com]:587
smtp_generic_maps = hash:/etc/postfix/generic

# vi /etc/postfix/relay_passwd
[smtp.gmail.com]:587 USERNAME:PASSWORD

# chmod 600 /etc/postfix/relay_passwd
# postmap /etc/postfix/relay_passwd
# rm /etc/postfix/relay_passwd      # postmap made relay_passwd.db

# vi /etc/postfix/generic
root@localdomain.local  username@example.com
@localdomain.local      username@example.com

# postmap /etc/postfix/generic
# systemctl restart postfix
# tail -f /var/log/maillog

The generic map gives outgoing mail a valid From address. On Debian and Ubuntu the log is /var/log/mail.log.