check_os_updates

Checks for operating system updates.

Implementation

WindowsLinuxFreeBSDmacOS
✅✅✅

Argument Defaults

ArgumentDefault Value
warningcount > 0
criticalcount_security > 0
empty-state0 (OK)
empty-syntax%(status) - no updates available
top-syntax%(status) - %(count_security) security updates / %(count) updates available.\n%(list)
ok-syntax
detail-syntax%(prefix)%(package): %(version)

Check Specific Arguments

ArgumentDescription
–include-optionalInclude optional Windows updates (default: false)
-m|–max-metadata-ageIf repository metadata (apt/yum/dnf) exceeds this age, return UNKNOWN. For example: 48h (default: 24h)
-s|–systemPackage system: auto, apt, yum, macos and windows (default: auto)
-u|–updateUpdate package list (if supported, e.g. apt-get update)

Attributes

Filter Keywords

Use these attributes in filters and thresholds, along with the default attributes:

AttributeDescription
packagePackage name
securityIs this a security update: 0 / 1
versionVersion string of package
typeWindows only: update type (1 = software, 2 = driver)
is_betaWindows only: beta update (true / false)
is_mandatoryWindows only: mandatory update (true / false)
deployment_actionWindows only: deployment action (0 = none, 1 = installation, 2 = uninstallation, 3 = detection, 4 = optional installation)
kb_article_idsWindows only: comma-separated KB article IDs
severityWindows only: MSRC security severity
is_downloadedWindows only: update downloaded (true / false, empty if unavailable)
reboot_requiredWindows only: update requires a reboot (true / false, empty if unavailable). Does not describe the system-wide reboot state
last_deployment_change_timeWindows only: deployment metadata change time (UTC, ISO 8601), not when the update became pending
update_idWindows only: update GUID
revision_numberWindows only: update revision number (empty if unavailable)
browse_onlyWindows only: optional update signal (true / false, empty if unavailable)
cve_idsWindows only: comma-separated CVE IDs
max_download_sizeWindows only: maximum download size in bytes (empty if unavailable)
driver_providerWindows only: driver provider (empty for non-driver updates or if unavailable)
driver_modelWindows only: driver model (empty for non-driver updates or if unavailable)
driver_ver_dateWindows only: driver version date (UTC, ISO 8601, empty if unavailable)

Examples

Default Check

check_os_updates
OK - no updates available |...

To receive notifications only for security updates:

check_os_updates warn=none crit='count_security > 0'
CRITICAL - 1 security updates / 3 updates available. |'security'=1;;0;0 'updates'=3;0;;0

On Windows, the check excludes optional updates (DeploymentAction = 4) by default. Use –include-optional to include them. Additional Windows metadata attributes are empty when unavailable or unsupported.

On DNF/APT systems, –update refreshes repository metadata in a private cache. Unless you start the check as root, the SNClient service user owns this cache.

If an enabled repository is unavailable, the DNF check returns UNKNOWN. Otherwise, it could report no updates for an incomplete set of repositories.

Use –max-metadata-age to limit the age of repository metadata, for example –max-metadata-age=24h. If the metadata exceeds this age, the check returns UNKNOWN.

Example using check_snclient and Naemon

Naemon Config

define command{
    command_name         check_snclient
    command_line         $USER1$/check_snclient -k -p 'your-password' -u 'https://$HOSTADDRESS$:8443' $ARG1$ $ARG2$
}

define service {
    host_name            testhost
    service_description  check_os_updates
    use                  generic-service
    check_command        check_snclient!check_os_updates!warn='count > 0' crit='count_security > 0'
}