This is the modern Python re-implementation of the software version watcher (vwatcher), first implemented in Tcl/Scotty and Perl at Uninett in the 1990s.
Development of vwatcher which is a part of the Zino 2.0 project is fully sponsored by NORDUnet, on behalf of the nordic NRENs.
vwatcher monitors the software versions and restarts of network devices, and
reports on them daily and monthly. The daemon polls sysUpTime for each device,
when the reported uptime falls meaningfully short of what it
should have been given the previous poll, the device is presumed to have restarted.
In that case, vwatcher asks it for sysDescr, and on Cisco gear whyReload, and
writes what it finds to the event log. A software upgrade is assumed to require a reboot.
The daemon does not decide if a version changed, it only records what it sees. The reports replay the log against the version each device was running at the start of the day and draw relevant conclusions. This means that reports can be replayed over old logs.
vwatcher uses the following directories to store logs:
ver-watch/logs/today/ver-watch.log today's events
ver-watch/logs/today/descs/<device> the version as of the start of today
ver-watch/logs/today/uptime/<device> the last sysUpTime seen
ver-watch/logs/YYYY-MM/DD/ the same three, rotated at the end of day
ver-watch/logs/YYYY-MM/DD/report that day's report
descs is the baseline the reports diff against. The daemon writes a device's
file only when it is missing or empty. When the day is 'rotated', meaning the logs are moved
from the 'today' directory to the specific date folder with the day's report, a new baseline can be set.
- The daily and monthly reports list devices in name order, was random in the original.
- Monthly reports walk a month's days in date order instead of the original
readdir-based order. - JunOS release types (
R,S,F,X) are ordered as strings, the original ordering was broken. - Mail settings come from
vwatcher.toml, not from~/.zino-mail. - A device's SNMP version comes from
snmpversion(defaultv2c), as in Zino 2. The original derived the version fromhcounters, using SNMPv1 unless it was set. vw-month-upgrbaselines a month from its first rotated day, the old version needed a01directory.vw-dailyrefuses to rotate into a day that was already rotated into before moving anything. The original would also fail, but only after overwriting that day's log.vw-month-rsttracks new restarts per device. The original could list an old reboot as new if another device, one that reports no restart reason, had restarted earlier that day.uptimesorders devices the same way ascur-vers. The original did it differently for Cisco IOS and JunOS.- A device added to
polldevs.cfmid-month and upgraded the same day is reported invw-month-upgras upgraded from the first version logged for it. The original left the "from" version blank. - A device whose
polldevs.cfentry changes keeps its uptime history, the original logged it as reloaded again.
$ pip install .polldevs.cf is the same file Zino reads, read with Zino's own parser, so one
pollfile can serve both. vwatcher's own settings live in vwatcher.toml - see
vwatcher.toml.example - and its [polling] and
[snmp] sections are the ones from zino.toml. This replaces the legacy
~/.zino-mail and the %TOPDIR%/%CONFDIR% substitutions the Makefile used
to perform.
| Command | What it does |
|---|---|
vwatcher |
The daemon. Polls every device in polldevs.cf, re-reading the file when it changes. |
vw-daily |
Rotates today's logs into YYYY-MM/DD, then reports on and mails that day. Run from cron shortly before midnight. |
vw-day-report YYYY-MM DD |
Rebuilds an earlier day's report from its rotated logs: which devices were upgraded, and which restarted or crashed. |
vw-month-upgr YYYY-MM |
Every upgrade of a month, one line per version step. |
vw-month-rst YYYY-MM |
Every restart of a month for which the device reported a reason. |
cur-vers |
The version every device is running now, ordered by version. |
uptimes [-u] |
The same, with uptimes. -u orders by uptime instead. |
All of them take --config-file (default vwatcher.toml) and --debug.
Contributions are welcome, at this point especially bug reports (patches welcome), missing documentation, how to's and usage tips!
vwatcher uses ruff as its formatter and linter. It comes with the development tools:
$ pip install --group devor, you can install it directly with uv:
$ uv install ruffA pre-commit hook will format new code automatically before committing. To enable this pre-commit hook, run
$ pre-commit installIf you have installed tox, the following command will test vwatcher code
against several Python versions and automatically compute code coverage.
$ toxCoverage and test results land in reports/.
Refer to the tox.ini file for further options.