Follow

How To Add Custom Properties

Applies To

Zenoss 4.x

Summary

Custom properties allow you to define arbitrary properties for devices or device classes that you can use for a variety of purposes. A custom property is created with a default value chosen by the administrator. It will only be used once it is referred to by some other part of Zenoss subsequent to its creation.

Important: The default (or manually entered) values for the custom properties inherit down the device class tree, enabling administrators to make a change to a subset of device classes (and thereby to devices within those device classes).

The best way to illustrate custom properties is to explore a particular use case. Consider a scenario in which a Zenoss administrator needs to use a different threshold for CPU idle percentage for the /Server/Linux class and for every subclass of /Server/Linux. One option would be to copy the /Server/Linux device template to each individual class and to modify the template accordingly; however, that method would be labor intensive and difficult to audit for accuracy. An alternative approach would be to create a custom property for the idle percentage threshold by editing the value of that property for the /Server/Linux class. Since the values of custom properties inherit down the device class tree, the new threshold would automatically be applied to all sub-classes of /Server/Linux.

Procedure

Note: Many of the steps outlined in this Procedure section apply to this specific use case only. This article explains those steps required to create any custom property and those that are specific to this example. The steps outlined apply to Zenoss 3.x and above. Although the methods for completing this procedure on versions of Zenoss prior to 3.x will differ, the underlying concepts remain the same.

  1. Signed in to Zenoss.
  2. Select the Infrastructure tab from the top navigation bar. Make sure that Devices is highlighted in the device class tree on the left. Notice that on the right side of the Devices button a forward slash (/) displays. The slash indicates that you are at the root level of the device class tree.

    Important: The ability to create a new custom property is only available at this root level of the device class tree. The step outlined above applies to the creation of any custom property.

  3. Click the Details arrow. This step also applies to the creation of any custom property.

    Important: The list of Custom Properties is titled Custom Schema when you are editing the properties of a device class, but is titled Custom Properties when you are editing the properties of a particular device. Although the title differs, content of the page that loads (a list of custom properties) is the same.

  4. Select Custom Schema from the left navigation bar. A two-part page appears. In the upper half, a list of existing custom properties is shown. In the lower half, a form entitled Add Property displays. This step applies to the creation of any custom property.
  5. To create your new custom property, enter cPercentFree in the label and name fields. The label and name values are arbitrary; the cPercentFree label is specific to this example.

    Important: When entering the name value, ensure the first letter of the name is lowercase c and that the second letter is capitalized.

  6. From the Type drop down menu, select int. This value is specific to this example.
  7. In the Default field enter 2 for the value. This value is specific to this example; in the default template for /Server/Linux, the threshold for CPU idle is 2%. By choosing this default value, you can later refer to this custom property and keep the default value constant except for those specific classes or devices where you wish to change it.

    Note: Make sure to leave the default value of True for the Visible field (used in most cases).

  8. Click the Add button. The new custom property is created and shown in the list above.
  9. Click the SEE ALL Button in the upper left to display the full list of device classes and the full device list.
  10. Navigate to the /Server/Linux class in the list of device classes. This step and those that follow are specific to this example.
  11. Click the DETAILS toggle button near the top of the device class list.
  12. Select Custom Schema from the left navigation bar to display custom property information.
  13. From the Custom Properties middle pane, enter 70 in the Value field of the property cPercentFree.

    Later in this process you will activate this custom property by modifying the /Server/Linux device template to refer to the new custom property for its Low CPU Idle threshold instead of using a raw value of 2, as the template does by default.

    Referring to your new custom property will therefore change the Low CPU Idle threshold to 70 for servers in the /Server/Linux class, since you entered this value at the /Server/Linux class level. This value will be inherited by any child classes.

  14. Click the Save button.
  15. Modify the template threshold by selecting the Advanced tab from the top navigation bar.
  16. Click on the Monitoring Templates tab on the second navigation bar.
  17. Select Device from the left navigation bar, then select /Server/Linux from the list of displayed templates.
  18. Under the Thresholds pane, double click on low CPU idle to display the Edit Threshold dialog box. Notice that the value in the Minimum Value field is 2. Replace this value with a reference to the new custom property that you created, providing greater flexibility when using varying thresholds for different device classes or even specific devices.
  19. Replace the value 2 with the Python expression here.cPercentFree in the Minimum Value field.
  20. Click the Save button.
    Notice in the Thresholds pane that the Python expression that refers to the custom property is now used for the Minimum Value threshold for low CPU Idle.

The outcome of this procedure will be that alerts will be generated for any devices in the /Server/Linux class whenever their CPU idle value drops below 70%, a change from the default template, wherein an alert would only be generated when their CPU idle value dropped below 2%.

Although this article details a specific use case for custom properties in the interest of clarity, custom properties have many uses beyond the single example examined here. The key items to remember regarding custom properties are:

  • Custom properties are new, arbitrary attributes that can be created by administrators for almost any purpose.
  • The values specified for custom properties inherit down the device class tree.
  • Once created, custom properties are given a default value and are not activated or used until the administrator puts them to use elsewhere in Zenoss. In the use case detailed in this article, the new property was put to use the moment  a template was edited to refer to the new custom property for the High Load threshold.
  • Custom properties may only be added from the root Devices level of the device class tree, but they can be edited at any level.
  • The list of custom properties is labeled Custom Schema when viewing the details of a device class and Custom Properties when viewing the details of a specific device.
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk