check_os_updates
Checks for operating system updates.
Implementation
| Windows | Linux | FreeBSD | macOS |
|---|---|---|---|
| ✅ | ✅ | ✅ |
Argument Defaults
| Argument | Default Value |
|---|---|
| warning | count > 0 |
| critical | count_security > 0 |
| empty-state | 0 (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
| Argument | Description |
|---|---|
| –include-optional | Include optional Windows updates (default: false) |
| -m|–max-metadata-age | If repository metadata (apt/yum/dnf) exceeds this age, return UNKNOWN. For example: 48h (default: 24h) |
| -s|–system | Package system: auto, apt, yum, macos and windows (default: auto) |
| -u|–update | Update package list (if supported, e.g. apt-get update) |
Attributes
Filter Keywords
Use these attributes in filters and thresholds, along with the default attributes:
| Attribute | Description |
|---|---|
| package | Package name |
| security | Is this a security update: 0 / 1 |
| version | Version string of package |
| type | Windows only: update type (1 = software, 2 = driver) |
| is_beta | Windows only: beta update (true / false) |
| is_mandatory | Windows only: mandatory update (true / false) |
| deployment_action | Windows only: deployment action (0 = none, 1 = installation, 2 = uninstallation, 3 = detection, 4 = optional installation) |
| kb_article_ids | Windows only: comma-separated KB article IDs |
| severity | Windows only: MSRC security severity |
| is_downloaded | Windows only: update downloaded (true / false, empty if unavailable) |
| reboot_required | Windows only: update requires a reboot (true / false, empty if unavailable). Does not describe the system-wide reboot state |
| last_deployment_change_time | Windows only: deployment metadata change time (UTC, ISO 8601), not when the update became pending |
| update_id | Windows only: update GUID |
| revision_number | Windows only: update revision number (empty if unavailable) |
| browse_only | Windows only: optional update signal (true / false, empty if unavailable) |
| cve_ids | Windows only: comma-separated CVE IDs |
| max_download_size | Windows only: maximum download size in bytes (empty if unavailable) |
| driver_provider | Windows only: driver provider (empty for non-driver updates or if unavailable) |
| driver_model | Windows only: driver model (empty for non-driver updates or if unavailable) |
| driver_ver_date | Windows 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'
}