Skip to content

Crontab recommended configuration

Niels Korschinsky edited this page Sep 23, 2021 · 3 revisions

Recommended Crontab configuration

This page contains all information required to set up SPPMon to automatical query its data from SPP. Without the execution, via Crontab no information can be displayed within Grafana.

Please run SPPMon at least once with --all before setting up Crontab.

It is possible to monitor multiple SPP-Server with a single Crontab setup. To do so, create multiple config files - one file per server. To start the data collection, add each below each other, separated by a few blank lines, and the name of the server as a comment.\

It is possible to semi-automatically create a crontab configuration by using a stand-alone script from the install script.
Execute python3 ./scripts/addCrontabConfig.py

Timing recommendations and extra arguments

The general recommendation is following:

  • --all: Run only when editing Sites in SPP. Recommended to regularly run once every 15 days (ranging from 1-90 days)
  • --daily: Recommended to run every 12h (ranging from every 1-36 hours)
  • --hourly: Recommended to run every 30 min (ranging from 15-120 min)
  • --constant: Recommended to run every 3 min (ranging from every 1-15 mins)

--all includes --daily, --daily include hourly and hourly also includes --constant.
It is not required or recommended to run any of those args together.

If you have a highly loaded SPP System with an initial starting time of over 10 hours and a --daily runtime with over 60 mins, please use the --loadedSystem flag in addition to any command. You may also use this flag if SPPMon causes CPU-Spikes on your SPP-System.

If your system is running smoothly and you want to track additional data, use the --fullLogs flag to gain access to extra statistics.
Due to performance reasons, Office365 Backup data statistics are only available when running with --fullLogs.

Editing Crontab

Existing crontab-entries can be view with sudo crontab -l. It's possible to edit the crontab entries with sudo crontab -e.

Only add crontab entries as sudo since only the root user has permission to access them.

sudo crontab -l

# run all functions every 15 days at 4:30am, every month.
30 4 */15 * * /usr/bin/python3.8 /home/USERNAME/spectrum-protect-sppmon/python/sppmon.py --cfg=/home/USERNAME/spectrum-protect-sppmon/sppserver1.conf --all >/dev/null 2>&1

# run daily functions once a day at 4:20am, every day, every week, every month
20 4 * * * /usr/bin/python3.8 /home/USERNAME/spectrum-protect-sppmon/python/sppmon.py --cfg=/home/USERNAME/spectrum-protect-sppmon/sppserver1.conf --daily >/dev/null 2>&1

# run hourly functions every 30 minutes, every day, every week, every month
*/30 * * * * /usr/bin/python3.8 /home/USERNAME/spectrum-protect-sppmon/python/sppmon.py --cfg=/home/USERNAME/spectrum-protect-sppmon/sppserver1.conf --hourly >/dev/null 2>&1

# query CPU and RAM utilization every 3 minutes
*/3 * * * * /usr/bin/python3.8 /home/USERNAME/spectrum-protect-sppmon/python/sppmon.py --cfg=/home/USERNAME/spectrum-protect-sppmon/sppserver1.conf --constant  >/dev/null 2>&1

It is also possible to use other versions of these settings. Do not simply add the lines. It is required to replace the lines above accordingly.

# Alternatives

# run daily functions every twelve hour instead of every 24h
 10 */12 * * * /usr/bin/python3.8 /home/USERNAME/spectrum-protect-sppmon/python/sppmon.py --cfg=/home/USERNAME/spectrum-protect-sppmon/sppserver1.conf --daily  >/dev/null 2>&1

# Daily Settings for loaded systems - adds the --loadedSystem argument
20 4  * * * /usr/bin/python3.8 /home/USERNAME/spectrum-protect-sppmon/python/sppmon.py --cfg=/home/USERNAME/spectrum-protect-sppmon/sppserver1.conf --daily --loadedSystem >/dev/null 2>&1

# Daily Settings for smooth systems - adds the --fullLogs argument
20 4  * * * /usr/bin/python3.8 /home/USERNAME/spectrum-protect-sppmon/python/sppmon.py --cfg=/home/USERNAME/spectrum-protect-sppmon/sppserver1.conf --daily --fullLogs >/dev/null 2>&1

To add another SPP-Server, just add it below the first Crontab configuration

# here is the last line of the spp server 1

# SPP Server2
# Copy all configurations from above, adjust the config file.

# run daily functions once a day at 4:20pm, every day, every week, every month
20 16 * * * /usr/bin/python3.8 /home/USERNAME/spectrum-protect-sppmon/python/sppmon.py --cfg=/home/USERNAME/spectrum-protect-sppmon/sppserver2.conf --daily >/dev/null 2>&1

# query CPU and RAM utilization every 2 minutes
*/2 * * * * /usr/bin/python3.8 /home/USERNAME/spectrum-protect-sppmon/python/sppmon.py --cfg=/home/USERNAME/spectrum-protect-sppmon/sppserver2.conf --constant  >/dev/null 2>&1
Clone this wiki locally