check_zfs_snapshot

Monitoring plugin to check how long ago the last snapshot of a ZFS dataset was created.

.. image:: http://img.shields.io/pypi/v/check-zfs-snapshot.svg :target: https://pypi.org/project/check-zfs-snapshot :alt: This package on the Python Package Index

.. image:: https://github.com/Josef-Friedrich/check_zfs_snapshot/actions/workflows/tests.yml/badge.svg :target: https://github.com/Josef-Friedrich/check_zfs_snapshot/actions/workflows/tests.yml :alt: Tests

Note: This monitoring plugin is written in Python from version 3 onwards. Earlier versions of this plugin were written in shell script. The latest version of the shell script can be retrieved via the git history __.

Command line interface

::

usage: check_zfs_snapshot [-h] [-V] [-v] [-d DATASET] [-w TIMESPAN]
                          [-c TIMESPAN] [--last-snapshot-timestamp]
                          [--snapshot-count] [--no-performance-data]

version 2.1.0
Licensed under the MIT.
Repository: https://github.com/Josef-Friedrich/check_zfs_snapshot.
Copyright (c) 2016-2026 Josef Friedrich 

A monitoring plugin that checks how long ago the last snapshot of ZFS datasets was created.

options:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  -v, --verbose         Increase the output verbosity.

last snapshot:
  -d, --dataset DATASET
                        The ZFS dataset (filesystem) to check. All datasets are
                        checked if this option is omitted.
  -w, --warning TIMESPAN
                        Interval in seconds for warning state. See timespan
                        format specification below. Must be lower than -c.
  -c, --critical TIMESPAN
                        Interval in seconds for critical state. See timespan
                        format specification below.

performance data:
  --last-snapshot-timestamp
                        Output additional performance data with the UNIX
                        timestamps of the last snapshots.
  --snapshot-count      Output additional performance data with the number of
                        snapshots per dataset.
  --no-performance-data
                        Do not attach any performance data to the plugin output.

Performance data
----------------

 - dataset: last snapshot (timespan in sec)
    The time interval, in seconds, from the present moment until the last snapshot.
 - dataset: last snapshot (timestamp)
    The UNIX timestamp of the last snapshot.
    The --last-snapshot-timestamp option is required to output this
    performance data.
 - dataset: snapshot count
    The number of snapshots of the dataset.
    The --snapshot-count option is required to output this
    performance data.

Timespan format
---------------

If no time unit is specified, generally seconds are assumed. The following time
units are understood:

- years, year, y (defined as 365.25 days)
- months, month, M (defined as 30.44 days)
- weeks, week, w
- days, day, d
- hours, hour, hr, h
- minutes, minute, min, m
- seconds, second, sec, s
- milliseconds, millisecond, msec, ms
- microseconds,  microsecond, usec, μs, μ, us

The following are valid examples of timespan specifications:

- `1`
- `1.23`
- `2.345s`
- `3min 45.234s`
- `34min`
- `2 months 8 days`
- `1h30m`

Project pages