How to Use zenrelationscan to Scan/Fix Zenrelations

Applies To

  • Zenoss 5.x
  • Zenoss 4.x


The zenrelationscan python script (available as part of the zenoss.toolbox project on Github - all ZenRelations defined on DMD objects and confirms that they correctly reference other objects.

Zenrelationscan is intended to be run from the Zenoss master server as the Zenoss user. Zenrelationscan requires that the zenoss.toolbox be installed.

WARNING: Before running zenrelationscan, you must first confirm that both zodbscan and findposkeyerror return with no issues found.

Note: The zenrelationscan script is intended to replace/supersede the older zenchkrels script that is installed with Resource Manager. Always use the zenrelationscan script in any situation when previously you would run the zenchkrels script.

Symptoms of Broken Zenrelations

Broken relationships that require zenrelationscan have varied symptoms, some of which are not evident via the UI. The zenrelationscan script should be run if and when administrators report that:

  • they see a yellow error banner in the web interface flagging an AttributeError
  • zodbscan/findposkeyerror detected underlying zodb issues (that have since been resolved)
  • they cannot view/delete certain devices/device components
  • they cannot run certain reports

In some cases, flares in the UI may signify an issue with zenrelations. In other cases, underlying POSKeyError issues (PKEs) could be evidence of zenrelations errors.


Using the zenrelationscan Script:

usage: zenrelationscan [-h] [-v] [-v10] [--tmpdir TMPDIR] [-s][-f] [-n CYCLES] [-u]

zenrelationscan -
scans ZODB object ZenRelations for issues -

Optional arguments:

-h, --help show this help message and exit
-v, --version show program's version number and exit
-v10, -debug verbose log output (debug logging)
--tmpdir TMPDIR override the TMPDIR setting
-s, --skipEvents skip creating summary events
-f attempt to remove any invalid references
-n CYCLES, --cycles maximum times to cycle (with --fix)
-u, --unlimitedram skip transaction.abort() - unbounded RAM, ~40% faster

Example Script Output

[2016-02-18 13:07:57] Initializing zenrelationscan v2.0.0 (detailed log at /opt/zenoss/log/toolbox/zenrelationscan.log)
[2016-02-18 13:08:01] Examining ZenRelations...

[2016-02-18 13:09:02]  | Items Scanned:        25602 | Errors:       0 |

[2016-02-18 13:09:02] Execution finished in 0:01:05

Was this article helpful?
1 out of 2 found this helpful


Powered by Zendesk