Data Fields¶
Managing Fields¶
This example wants to show you how to make use of the Array
data
type when creating fields for custom variables. First, please got to the
Dashboard
and choose the Define data fields
dashlet:

Fig. 71 Dashboard - Define data fields¶
Then create a new data field and select Array
as its data type:

Fig. 72 Define data field - Array¶
Then create a new Host template
(or use an existing one):

Fig. 73 Define host template¶
Now add your formerly created data field to your template:

Fig. 74 Add field to template¶
That’s it, now you are ready to create your first corresponding host. Once you add your formerly created template, a new form field for your custom variable will show up:

Fig. 75 Create host with given field¶
Have a look at the config preview, it will show you how your
Array
-based custom variable will look like once deployed:

Fig. 76 Host config preview with Array¶
Data Fields example: SNMP¶
Ever wondered how to provide an easy to use SNMP configuration to your
users? That’s what we’re going to show in this example. Once completed,
all your Hosts inheriting a specific (or your “default”) Host Template
will provide an optional SNMP version
field.
In case you choose no version, nothing special will happen. Otherwise,
the host offers additional fields depending on the chosen version.
Community String
for SNMPv1
and SNMPv2c
, and five other
fields ranging from Authentication User
to Auth
and Priv
types and keys for SNMPv3
.
Your services should now be applied not only based on various Host
properties like Device Type
, Application
, Customer
or
similar - but also based on the fact whether credentials have been given
or not.
Prepare required Data Fields¶
As we already have learned, Fields
are what allows us to define
which custom variables can or should be defined following which rules.
We want SNMP version to be a drop-down, and that’s why we first define a
Data List
, followed by a Data Field
using that list:
Create a new Data List¶

Fig. 77 Create a new Data List¶
Fill the new list with SNMP versions¶

Fig. 78 Fill the new list with SNMP versions¶
Create a corresponding Data Field¶

Fig. 79 Create a Data Field for SNMP Versions¶
Next, please also create the following elements:
a list SNMPv3 Auth Types providing
MD5
andSHA
a list SNMPv3 Priv Types providing at least
AES
andDES
a
String
type fieldsnmp_community
labelled SNMP Communitya
String
type fieldsnmpv3_user
labelled SNMPv3 Usera
String
type fieldsnmpv3_auth
labelled SNMPv3 Auth (authentication key)a
String
type fieldsnmpv3_priv
labelled SNMPv3 Priv (encryption key)a
Data List
type fieldsnmpv3_authprot
labelled SNMPv3 Auth Typea
Data List
type fieldsnmpv3_privprot
labelled SNMPv3 Priv Type
Please do not forget to add meaningful descriptions, telling your users about in-house best practices.
Assign your shiny new Fields to a Template¶
I’m using my default Host Template for this, but one might also choose
to provide SNMP version
on Network Devices. Should Network Device be
a template? Or just an option in a Device Type
field? You see, the
possibilities are endless here.
This screenshot shows part of my assigned Fields:

Fig. 80 SNMP Fields on Default Host¶
While I kept SNMP Version
optional, all other fields are mandatory.
Use your Template¶
As soon as you choose your template, a new field is shown:

Fig. 81 Choose SNMP version¶
In case you change it to SNMPv2c
, a Community String
will be
required:

Fig. 82 Community String for SNMPv2c¶
Switch it to SNMPv3 to see completely different fields:

Fig. 83 Auth and Priv properties for SNMPv3¶
Once stored please check the rendered configuration. Switch the SNMP versions forth and back, and you should see that filtered fields will also remove the corresponding values from the object.