| 1 | { |
| 2 | "jsonSchema": { |
| 3 | "$schema": "http://json-schema.org/draft-07/schema#", |
| 4 | "title": "SNMP Device Discovery", |
| 5 | "description": "Discovers SNMP devices by scanning network subnets.", |
| 6 | "type": "object", |
| 7 | "properties": { |
| 8 | "discoverer": { |
| 9 | "title": "Discoverer", |
| 10 | "type": "object", |
| 11 | "properties": { |
| 12 | "snmp": { |
| 13 | "title": "SNMP", |
| 14 | "type": "object", |
| 15 | "properties": { |
| 16 | "rescan_interval": { |
| 17 | "title": "Rescan interval", |
| 18 | "description": "How often to scan networks for devices.", |
| 19 | "type": "string", |
| 20 | "pattern": "^[0-9]+(\\.[0-9]+)?(ms|s|m|h|d|w|mo|y)?$", |
| 21 | "default": "30m" |
| 22 | }, |
| 23 | "timeout": { |
| 24 | "title": "Timeout", |
| 25 | "description": "Timeout for SNMP device responses, in seconds.", |
| 26 | "type": "number", |
| 27 | "minimum": 0.1, |
| 28 | "default": 1 |
| 29 | }, |
| 30 | "device_cache_ttl": { |
| 31 | "title": "Device cache TTL", |
| 32 | "description": "How long to cache discovery results.", |
| 33 | "type": "string", |
| 34 | "pattern": "^[0-9]+(\\.[0-9]+)?(ms|s|m|h|d|w|mo|y)?$", |
| 35 | "default": "12h" |
| 36 | }, |
| 37 | "parallel_scans_per_network": { |
| 38 | "title": "Parallel scans", |
| 39 | "description": "Concurrent IPs to scan per subnet.", |
| 40 | "type": "integer", |
| 41 | "minimum": 1, |
| 42 | "maximum": 256, |
| 43 | "default": 32 |
| 44 | }, |
| 45 | "credentials": { |
| 46 | "title": "Credentials", |
| 47 | "description": "SNMP credentials for authentication.", |
| 48 | "type": "array", |
| 49 | "minItems": 1, |
| 50 | "items": { |
| 51 | "type": "object", |
| 52 | "properties": { |
| 53 | "name": { |
| 54 | "title": "Name", |
| 55 | "description": "Credential identifier (referenced by networks).", |
| 56 | "type": "string" |
| 57 | }, |
| 58 | "version": { |
| 59 | "title": "SNMP version", |
| 60 | "description": "SNMP protocol version.", |
| 61 | "type": "string", |
| 62 | "enum": [ |
| 63 | "1", |
| 64 | "2", |
| 65 | "2c", |
| 66 | "3" |
| 67 | ], |
| 68 | "default": "2c" |
| 69 | }, |
| 70 | "community": { |
| 71 | "title": "Community", |
| 72 | "description": "Community string (for SNMP v1/v2c).", |
| 73 | "type": "string", |
| 74 | "default": "public" |
| 75 | }, |
| 76 | "username": { |
| 77 | "title": "Username", |
| 78 | "description": "Username (for SNMPv3).", |
| 79 | "type": "string" |
| 80 | }, |
| 81 | "security_level": { |
| 82 | "title": "Security level", |
| 83 | "description": "Security level (for SNMPv3).", |
| 84 | "type": "string", |
| 85 | "enum": [ |
| 86 | "noAuthNoPriv", |
| 87 | "authNoPriv", |
| 88 | "authPriv" |
| 89 | ] |
| 90 | }, |
| 91 | "auth_protocol": { |
| 92 | "title": "Auth protocol", |
| 93 | "description": "Authentication protocol (for SNMPv3).", |
| 94 | "type": "string", |
| 95 | "enum": [ |
| 96 | "md5", |
| 97 | "sha", |
| 98 | "sha224", |
| 99 | "sha256", |
| 100 | "sha384", |
| 101 | "sha512" |
| 102 | ] |
| 103 | }, |
| 104 | "auth_password": { |
| 105 | "title": "Auth password", |
| 106 | "description": "Authentication passphrase (for SNMPv3).", |
| 107 | "type": "string" |
| 108 | }, |
| 109 | "priv_protocol": { |
| 110 | "title": "Privacy protocol", |
| 111 | "description": "Privacy protocol (for SNMPv3).", |
| 112 | "type": "string", |
| 113 | "enum": [ |
| 114 | "des", |
| 115 | "aes", |
| 116 | "aes192", |
| 117 | "aes256", |
| 118 | "aes192c", |
| 119 | "aes256c" |
| 120 | ] |
| 121 | }, |
| 122 | "priv_password": { |
| 123 | "title": "Privacy password", |
| 124 | "description": "Privacy passphrase (for SNMPv3).", |
| 125 | "type": "string" |
| 126 | } |
| 127 | }, |
| 128 | "required": [ |
| 129 | "name", |
| 130 | "version" |
| 131 | ] |
| 132 | } |
| 133 | }, |
| 134 | "networks": { |
| 135 | "title": "Networks", |
| 136 | "description": "Network subnets to scan.", |
| 137 | "type": "array", |
| 138 | "minItems": 1, |
| 139 | "items": { |
| 140 | "type": "object", |
| 141 | "properties": { |
| 142 | "subnet": { |
| 143 | "title": "Subnet", |
| 144 | "description": "IP range to scan (e.g., '192.168.1.0/24', '10.0.0.1-10.0.0.50').", |
| 145 | "type": "string" |
| 146 | }, |
| 147 | "credential": { |
| 148 | "title": "Credential", |
| 149 | "description": "Name of credential to use for this network.", |
| 150 | "type": "string" |
| 151 | } |
| 152 | }, |
| 153 | "required": [ |
| 154 | "subnet", |
| 155 | "credential" |
| 156 | ] |
| 157 | } |
| 158 | } |
| 159 | }, |
| 160 | "required": [ |
| 161 | "credentials", |
| 162 | "networks" |
| 163 | ] |
| 164 | } |
| 165 | }, |
| 166 | "required": [ |
| 167 | "snmp" |
| 168 | ] |
| 169 | }, |
| 170 | "services": { |
| 171 | "title": "Service rules", |
| 172 | "description": "- Match discovered SNMP devices and generate collector configurations.\n- Each rule specifies match criteria and a config template.\n- When a device matches, a data collection job is created.\n- The **default service rule** is sufficient for most cases. It creates an SNMP data collection job for each discovered device and handles both SNMPv2 and SNMPv3.", |
| 173 | "type": "array", |
| 174 | "minItems": 1, |
| 175 | "items": { |
| 176 | "type": "object", |
| 177 | "properties": { |
| 178 | "id": { |
| 179 | "title": "Rule ID", |
| 180 | "description": "Unique identifier for this rule. Used in logs to identify which rule matched a device.", |
| 181 | "type": "string", |
| 182 | "default": "snmp" |
| 183 | }, |
| 184 | "match": { |
| 185 | "title": "Match expression", |
| 186 | "description": "Go template expression that must evaluate to 'true' for the rule to match the discovered SNMP device.", |
| 187 | "type": "string", |
| 188 | "default": "{{ true }}" |
| 189 | }, |
| 190 | "config_template": { |
| 191 | "title": "Config template", |
| 192 | "description": "**Uses the same fields as match expression**. Go template that generates the data collection job configuration in YAML format. **Must include 'module' and 'name' fields**, plus any module-specific settings.", |
| 193 | "type": "string", |
| 194 | "default": "{{- if .SysInfo.Name }}\nname: {{ .SysInfo.Name }}-ip-{{ .IPAddress }}\n{{- else }}\nname: ip-{{ .IPAddress }}\n{{- end }}\nhostname: {{ .IPAddress }}\noptions:\n version: {{ .Credential.Version }}\n{{- if eq .Credential.Version \"1\" \"2\" \"2c\" }}\ncommunity: {{ .Credential.Community }}\n{{- else }}\nuser:\n name: {{ .Credential.UserName }}\n level: {{ .Credential.SecurityLevel }}\n auth_proto: {{ .Credential.AuthProtocol }}\n auth_key: {{ .Credential.AuthPassphrase }}\n priv_proto: {{ .Credential.PrivacyProtocol }}\n priv_key: {{ .Credential.PrivacyPassphrase }}\n{{- end }}" |
| 195 | } |
| 196 | }, |
| 197 | "required": [ |
| 198 | "id", |
| 199 | "match" |
| 200 | ] |
| 201 | } |
| 202 | } |
| 203 | }, |
| 204 | "required": [ |
| 205 | "discoverer", |
| 206 | "services" |
| 207 | ] |
| 208 | }, |
| 209 | "uiSchema": { |
| 210 | "uiOptions": { |
| 211 | "fullPage": true |
| 212 | }, |
| 213 | "ui:flavour": "tabs", |
| 214 | "ui:options": { |
| 215 | "tabs": [ |
| 216 | { |
| 217 | "title": "Base", |
| 218 | "fields": [ |
| 219 | "discoverer" |
| 220 | ] |
| 221 | }, |
| 222 | { |
| 223 | "title": "Services", |
| 224 | "fields": [ |
| 225 | "services" |
| 226 | ] |
| 227 | } |
| 228 | ] |
| 229 | }, |
| 230 | "discoverer": { |
| 231 | "snmp": { |
| 232 | "rescan_interval": { |
| 233 | "ui:placeholder": "30m", |
| 234 | "ui:help": "Examples: 30m, 1h, 2h" |
| 235 | }, |
| 236 | "timeout": { |
| 237 | "ui:placeholder": "1", |
| 238 | "ui:help": "Value in seconds. Examples: 1, 5, 0.5" |
| 239 | }, |
| 240 | "device_cache_ttl": { |
| 241 | "ui:placeholder": "12h", |
| 242 | "ui:help": "Examples: 12h, 24h, 1d, 1w" |
| 243 | }, |
| 244 | "credentials": { |
| 245 | "ui:listFlavour": "list", |
| 246 | "items": { |
| 247 | "community": { |
| 248 | "ui:widget": "password" |
| 249 | }, |
| 250 | "auth_password": { |
| 251 | "ui:widget": "password" |
| 252 | }, |
| 253 | "priv_password": { |
| 254 | "ui:widget": "password" |
| 255 | } |
| 256 | } |
| 257 | }, |
| 258 | "networks": { |
| 259 | "ui:listFlavour": "list", |
| 260 | "items": { |
| 261 | "subnet": { |
| 262 | "ui:placeholder": "192.168.1.0/24" |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | } |
| 267 | }, |
| 268 | "services": { |
| 269 | "ui:descriptionPosition": "top", |
| 270 | "ui:listFlavour": "list", |
| 271 | "items": { |
| 272 | "id": { |
| 273 | "ui:placeholder": "snmp", |
| 274 | "ui:help": "Use descriptive names like 'snmp', 'cisco-switches', 'hp-printers'" |
| 275 | }, |
| 276 | "match": { |
| 277 | "ui:widget": "textarea", |
| 278 | "ui:placeholder": "{{ true }}", |
| 279 | "ui:help": "| Field | Description |\n|-------|-------------|\n| `.IPAddress` | Device IP address |\n| `.SysInfo.Descr` | System description |\n| `.SysInfo.Contact` | System contact |\n| `.SysInfo.Name` | System name |\n| `.SysInfo.Location` | System location |\n| `.SysInfo.Organization` | Organization |\n| `.SysInfo.Vendor` | Device vendor |\n| `.SysInfo.Category` | Device category |\n| `.SysInfo.Model` | Device model |\n| `.Credential.Name` | Credential name |\n| `.Credential.Version` | SNMP version |\n\n**Functions:** eq, ne, glob, regexp, and, or, not" |
| 280 | }, |
| 281 | "config_template": { |
| 282 | "ui:widget": "textarea", |
| 283 | "ui:placeholder": "{{- if .SysInfo.Name }}\nname: {{ .SysInfo.Name }}-ip-{{ .IPAddress }}\n{{- else }}\nname: ip-{{ .IPAddress }}\n{{- end }}\nhostname: {{ .IPAddress }}\noptions:\n version: {{ .Credential.Version }}\n{{- if eq .Credential.Version \"1\" \"2\" \"2c\" }}\ncommunity: {{ .Credential.Community }}\n{{- else }}\nuser:\n name: {{ .Credential.UserName }}\n level: {{ .Credential.SecurityLevel }}\n auth_proto: {{ .Credential.AuthProtocol }}\n auth_key: {{ .Credential.AuthPassphrase }}\n priv_proto: {{ .Credential.PrivacyProtocol }}\n priv_key: {{ .Credential.PrivacyPassphrase }}\n{{- end }}" |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | } |
| 288 | } |