Recurrent tasks and maintenance

Landscape Server installs a few scheduled tasks, defined in the /etc/cron.d/landscape-server file.

  • /opt/canonical/landscape/scripts/
    • This task does the daily maintenance of adding monitoring graphs tables and deleting older data. Failure to run this task for multiple days prevents monitoring data from being stored, and will lead to gaps in the graphs.
  • /opt/canonical/landscape/scripts/
    • This task loads new USN/CVE data. This is required for identifying which updates are "security updates".
  • ( /opt/canonical/landscape/scripts/; /opt/canonical/landscape/scripts/; /opt/canonical/landscape/scripts/ )
    • This set of tasks processes alerts and applies profiles. Part of the Landscape functionalities depends on checking conditions at frequent intervals. This includes offline alerts, and package profile compliance.
  • /opt/canonical/landscape/scripts/
    • This tasks regenerates packages hash-ids mapping files. Those hash-id files are what helps for newly registered computers to report their installed and available packages quickly. Out-of-date hash-id files causes computers to report their package at a slower rate (500 packages at a time).
  • /opt/canonical/landscape/scripts/
    • This task checks for new releases of Ubuntu.
  • /opt/canonical/landscape/scripts/
    • This task verifies if there are new Landscape Server upgrades available in order to add a notification on the account page.
  • /opt/canonical/landscape/scripts/
    • This task reports some anonymous metrics, such as the installed Landscape Server version.

Optional Cleaning of Activity History

Landscape already includes maintenance tasks to limit monitoring graphs history, as mentioned above. Extra maintenance jobs can also be scheduled to limit old activities and old events to a retention period. For example, create a /etc/cron.d/ls_maintenance file and add the following:

0 3 * * * landscape /opt/canonical/landscape/cleanup-activities 90
30 3 * * * landscape /opt/canonical/landscape/cleanup-events 90

This will schedule 2 tasks:

  • A cleanup of finished activities older than 90 days. Runs every day at 3:00.
  • A cleanup of events older than 90 days. Runs every day at 3:30.

Those tools will log their output to syslog. This can be inspected by running

journalctl -t cleanup-activities -t cleanup-events

The result of those tasks can also be logged to separate files, much like other Landscape services. To do that, edit the /etc/rsyslog.d/20-landscape.conf file and add the following lines to the end:

if $programname == 'cleanup-activities' then /var/log/landscape-server/cleanup-activities.log;Landscape
& ~
if $programname == 'cleanup-events' then /var/log/landscape-server/cleanup-events.log;Landscape
& ~

Then restart the logging service by running:

sudo systemctl restart rsyslog.service