User Tools

Site Tools


configuration:objecttypes

Configuration of object types

To define object types in yourCMDB, simply edit the <yourcmdb-dir>/etc/objecttype-configuration.xml configuration file.

structure of objecttype-configuration.xml

Let's start with a simple example of the object type configuration to understand the structure of the file:

<object-types>
      <group name="network devices">
            <object-type name="router">
               [...]
            </object-type>
            <object-type name="switch">
               [...]
            </object-type>
      </group>
      <group name="locations">
         [...]
      </group>
</object-types>

The configuration of object types starts with an <object-types>-tag. Object types are organized in groups (<group>-tags) with an unique name. The groups are used for grouping the object types in the WebUI and REST API. Object types are defined within a group using the <object-type> tag. Each object type must have a name, that is unqiue for the whole configuration (so it is not possible to define two object types with the same name in different groups). For the name of object types, the following restrictions are set:

  • max length: 64 characters
  • not allowed characters are dots ”.” or spaces ” ” or slashes “/”

define an object type

Below, you see an example of the definition of an object type:

<object-type name="router">
      <static>
              <comment>A comment on router objects...</comment>
      </static>
      <links>
              <link name="Search for manufacturer" href="http://www.google.de/#q=%manufacturer%" />
      </links>
      <eventdefs>
                      <eventdef name="exportObjects" label="Export Objects" />
      </eventdefs>
      <fields>
              <fieldgroup name="network">
                      <field name="hostname" type="text" label="Hostname" summaryfield="true" labelfield="true" />
                      <field name="management-ip" type="text" label="management IP" summaryfield="true"/>
                      <field name="snmpCommunity" type="text" label="SNMP community" default="public"/>
                      <field name="snmpVersion" type="dropdown-v1,v2c,v3" label="SNMP version" default="v2c" />
                      <field name="snmpPort" type="text" label="SNMP port" default="161" />
              </fieldgroup>
              <fieldgroup name="hardware">
                      <field name="manufacturer" type="text" summaryfield="true"/>
                      <field name="serialno" type="text" label="serial number" />
                      <field name="maintenance-contract" type="text" label="maintenance contract" />
              </fieldgroup>
              <fieldgroup name="age">
                      <field name="setup-date" type="date" label="setup date" />
                      <field name="contract-date" type="date" label="service contract date" />
              </fieldgroup>
              <fieldgroup name="location">
                      <field name="location" type="objectref-datacenter" label="location" />
              </fieldgroup>
              <fieldgroup name="admin">
                      <field name="Name" type="text" />
                      <field name="Mail" type="text" />
              </fieldgroup>
              <fieldgroup name="Management">
                      <field name="monitoring" label="Monitoring with OpenNMS" type="boolean" />
                      <field name="config-backup" label="Backup of configuration" type="boolean" />
              </fieldgroup>
              <fieldgroup name="Comment">
                      <field name="comment" type="textarea" />
              </fieldgroup>
      </fields>
 </object-type>

fields

The most important thing of an object type is the definition of fields within the <fields>-tag. The fields of an object type are organized in groups (<fieldgroup>-tag). Each field is defined using the <field>-tag and must have a unique name for the whole object type (so it is not allowed to use the same field name in two groups of a single object type). The following limitations are given for the fieldname:

  • max length 64 characters
  • not allowed characters are dots “.” or spaces “ ” or slashes “/”
  • the following strings are not allowed: action, id, type, yourCMDB_*

Each field has a data type that is defined in the type attribute and controls the behavior of the field in the web ui. You can use the following data types:

typedescriptionbehavioravailable since version
texttext fieldsimply shows/stores the text0.1
textareatextarea with multiple lines for bigger textssimply shows/stores the text0.5
booleanshows a checkboxstores only one of the value true/false0.5
dateshows a datepickerstores the date0.5
objectref-<objecttype>shows a selection of all objects of type <objecttype>stores the reference to an object of type <objecttype>0.5.1
dropdown-<allowed values>shows a selection of allowed valuesstores the selected value 0.14
passwordpassword fieldShows a password generator in edit mode. Hides passwords by default. 0.8

Optionally you can define a label using the label attribute for the field that is shown in the WebUI instead of the field name, which is limited in some points.

If you want to define a default value for the field, just use the attribute default. A default value is shown in the forms of the WebUI, when adding a new object.

The next attribute is summaryfield, which can be true or false and is false by default. Summary fields are the fields that summarize an object and are shown in lists or search results in the WebUI.

The last attribute is labelfield, which can be true or false and is false by default. Label fields are used for defining the content of an object label. See Label Printing for more information.

You can define external links to other websites for the objects of a specific type. In the links you can use the content of object fields. For example:

<links>
      <link name="Search for manufacturer" href="http://www.google.de/#q=%manufacturer%" />
</links>

All links are defined between the <links>-tags. A link needs a name and a target, which is defined with the href attribute. Within the target you can use %<fieldname>% as a variable. So in the example above, %manufacturer% is replaced with the content of the field “manufacturer” of the particular object. In version 0.13 or higher, you can also use the following variables:

  • %yourCMDB_object_id%
  • %yourCMDB_object_type%

eventDefs (version 0.6 or higher)

You can define custom events to use with the yourCMDB TaskScheduler.

static information

You can add some static informations to all objects of a specific type using the <static>-tags. At the moment there only is an implementation for the information in the <comment> section, where you can add comments to all object of a specific type. Since version 0.10 you can also use %fieldname% variables in comments. In version 0.13 or higher, you can also use the following variables:

  • %yourCMDB_object_id%
  • %yourCMDB_object_type%

use subfiles

In the main configuration file, you can use <includeconfig>-tags to store parts of the configuration in seperate files. That makes it more easy to handle big setups with many object types and groups. In the yourCMDB default configuration these files are stores in the objecttypes subdirectory:

<object-types>
      <includeconfig file="objecttypes/locations.xml" />
      <includeconfig file="objecttypes/network-devices.xml" />
</object-types>
configuration/objecttypes.txt · Last modified: 2017/07/24 11:43 (external edit)