1<a id="Fields-example-SNMP"></a>Data Fields example: SNMP
2=========================
3
4Ever wondered how to provide an easy to use SNMP configuration to your users?
5That's what we're going to show in this example. Once completed, all your Hosts
6inheriting a specific (or your "default") Host Template will provide an optional
7`SNMP version` field.
8
9In case you choose no version, nothing special will happen. Otherwise, the host
10offers additional fields depending on the chosen version. `Community String` for
11`SNMPv1` and `SNMPv2c`, and five other fields ranging from `Authentication User`
12to `Auth` and `Priv` types and keys for `SNMPv3`.
13
14Your services should now be applied not only based on various Host properties
15like `Device Type`, `Application`, `Customer` or similar - but also based on
16the fact whether credentials have been given or not.
17
18
19Prepare required Data Fields
20----------------------------
21
22As we already have learned, `Fields` are what allows us to define which custom
23variables can or should be defined following which rules. We want SNMP version
24to be a drop-down, and that's why we first define a `Data List`, followed by
25a `Data Field` using that list:
26
27### Create a new Data List
28
29![Create a new Data List](screenshot/director/16_fields_snmp/161_snmp_versions_create_list.png)
30
31### Fill the new list with SNMP versions
32
33![Fill the new list with SNMP versions](screenshot/director/16_fields_snmp/162_snmp_versions_fill_list.png)
34
35### Create a corresponding Data Field
36
37![Create a Data Field for SNMP Versions](screenshot/director/16_fields_snmp/163_snmp_version_create_field.png)
38
39Next, please also create the following elements:
40
41* a list *SNMPv3 Auth Types* providing `MD5` and `SHA`
42* a list *SNMPv3 Priv Types* providing at least `AES` and `DES`
43* a `String` type field `snmp_community` labelled *SNMP Community*
44* a `String` type field `snmpv3_user` labelled *SNMPv3 User*
45* a `String` type field `snmpv3_auth` labelled *SNMPv3 Auth* (authentication key)
46* a `String` type field `snmpv3_priv` labelled *SNMPv3 Priv* (encryption key)
47* a `Data List` type field `snmpv3_authprot` labelled *SNMPv3 Auth Type*
48* a `Data List` type field `snmpv3_privprot` labelled *SNMPv3 Priv Type*
49
50Please do not forget to add meaningful descriptions, telling your users about
51in-house best practices.
52
53
54Assign your shiny new Fields to a Template
55------------------------------------------
56
57I'm using my default Host Template for this, but one might also choose to provide
58`SNMP version` on Network Devices. Should Network Device be a template? Or just
59an option in a `Device Type` field? You see, the possibilities are endless here.
60
61This screenshot shows part of my assigned Fields:
62
63![SNMP Fields on Default Host](screenshot/director/16_fields_snmp/164_snmp_fields_on_template.png)
64
65While I kept `SNMP Version` optional, all other fields are mandatory.
66
67
68Use your Template
69-----------------
70
71As soon as you choose your template, a new field is shown:
72
73![Choose SNMP version](screenshot/director/16_fields_snmp/165_host_snmp_choose.png)
74
75In case you change it to `SNMPv2c`, a `Community String` will be required:
76
77![Community String for SNMPv2c](screenshot/director/16_fields_snmp/166_host_snmp_v2c.png)
78
79Switch it to SNMPv3 to see completely different fields:
80
81![Auth and Priv properties for SNMPv3](screenshot/director/16_fields_snmp/167_host_snmp_v3.png)
82
83Once stored please check the rendered configuration. Switch the SNMP versions
84forth and back, and you should see that filtered fields will also remove the
85corresponding values from the object.
86
87
88Assign Services based on those properties
89-----------------------------------------
90
91You should design your Commands to use that set of properties. Change the example
92slightly to fit ITL Commands in case you're using those (snmpv3_*_type VS _alg).
93
94Your Cisco Health checks assigned to all:
95
96* routers or switches
97* manifactured by Cisco
98* with SNMP credentials, regardless of which version
99
100...might then look as follows:
101
102![Assign SNMP-based checks](screenshot/director/16_fields_snmp/168_assign_snmp_check.png)
103
104Have fun!
105