これを使う
grafana.com
generator.yml
↑ の generator.yml は古い書き方で現在の generator では使えない。
こうする ↓
modules: edgemax: walk: - ifHCInOctets - ifHCOutOctets - ssCpuIdle - memTotalFree - memTotalReal - hrSystemUptime lookups: - source_indexes: [ifIndex] lookup: 1.3.6.1.2.1.31.1.1.1.1 drop_source_indexes: false
snmp.yml
生成したやつ
# WARNING: This file was auto-generated using snmp_exporter generator, manual changes will be lost. edgemax: walk: - 1.3.6.1.2.1.31.1.1.1.1 - 1.3.6.1.2.1.31.1.1.1.10 - 1.3.6.1.2.1.31.1.1.1.6 get: - 1.3.6.1.2.1.25.1.1.0 - 1.3.6.1.4.1.2021.11.11.0 - 1.3.6.1.4.1.2021.4.11.0 - 1.3.6.1.4.1.2021.4.5.0 metrics: - name: hrSystemUptime oid: 1.3.6.1.2.1.25.1.1 type: gauge help: The amount of time since this host was last initialized - 1.3.6.1.2.1.25.1.1 - name: ifHCOutOctets oid: 1.3.6.1.2.1.31.1.1.1.10 type: counter help: The total number of octets transmitted out of the interface, including framing characters - 1.3.6.1.2.1.31.1.1.1.10 indexes: - labelname: ifIndex type: gauge lookups: - labels: - ifIndex labelname: ifName oid: 1.3.6.1.2.1.31.1.1.1.1 type: DisplayString - name: ifHCInOctets oid: 1.3.6.1.2.1.31.1.1.1.6 type: counter help: The total number of octets received on the interface, including framing characters - 1.3.6.1.2.1.31.1.1.1.6 indexes: - labelname: ifIndex type: gauge lookups: - labels: - ifIndex labelname: ifName oid: 1.3.6.1.2.1.31.1.1.1.1 type: DisplayString - name: ssCpuIdle oid: 1.3.6.1.4.1.2021.11.11 type: gauge help: The percentage of processor time spent idle, calculated over the last minute - 1.3.6.1.4.1.2021.11.11 - name: memTotalFree oid: 1.3.6.1.4.1.2021.4.11 type: gauge help: The total amount of memory free or available for use on this host - 1.3.6.1.4.1.2021.4.11 - name: memTotalReal oid: 1.3.6.1.4.1.2021.4.5 type: gauge help: The total amount of real/physical memory installed on this host. - 1.3.6.1.4.1.2021.4.5 luis@ubuntu ~/snmp_exporter-master/generator $ vi [ruby-2.6.3p62] luis@ubuntu ~/snmp_exporter-master/generator $ cat generator.yml [ruby-2.6.3p62] modules: edgemax: walk: - ifHCInOctets - ifHCOutOctets - ssCpuIdle - memTotalFree - memTotalReal - hrSystemUptime lookups: - source_indexes: [ifIndex] lookup: 1.3.6.1.2.1.31.1.1.1.1 drop_source_indexes: false luis@ubuntu ~/snmp_exporter-master/generator $ cat snmp.yml [ruby-2.6.3p62] # WARNING: This file was auto-generated using snmp_exporter generator, manual changes will be lost. edgemax: walk: - 1.3.6.1.2.1.31.1.1.1.1 - 1.3.6.1.2.1.31.1.1.1.10 - 1.3.6.1.2.1.31.1.1.1.6 get: - 1.3.6.1.2.1.25.1.1.0 - 1.3.6.1.4.1.2021.11.11.0 - 1.3.6.1.4.1.2021.4.11.0 - 1.3.6.1.4.1.2021.4.5.0 metrics: - name: hrSystemUptime oid: 1.3.6.1.2.1.25.1.1 type: gauge help: The amount of time since this host was last initialized - 1.3.6.1.2.1.25.1.1 - name: ifHCOutOctets oid: 1.3.6.1.2.1.31.1.1.1.10 type: counter help: The total number of octets transmitted out of the interface, including framing characters - 1.3.6.1.2.1.31.1.1.1.10 indexes: - labelname: ifIndex type: gauge lookups: - labels: - ifIndex labelname: ifName oid: 1.3.6.1.2.1.31.1.1.1.1 type: DisplayString - name: ifHCInOctets oid: 1.3.6.1.2.1.31.1.1.1.6 type: counter help: The total number of octets received on the interface, including framing characters - 1.3.6.1.2.1.31.1.1.1.6 indexes: - labelname: ifIndex type: gauge lookups: - labels: - ifIndex labelname: ifName oid: 1.3.6.1.2.1.31.1.1.1.1 type: DisplayString - name: ssCpuIdle oid: 1.3.6.1.4.1.2021.11.11 type: gauge help: The percentage of processor time spent idle, calculated over the last minute - 1.3.6.1.4.1.2021.11.11 - name: memTotalFree oid: 1.3.6.1.4.1.2021.4.11 type: gauge help: The total amount of memory free or available for use on this host - 1.3.6.1.4.1.2021.4.11 - name: memTotalReal oid: 1.3.6.1.4.1.2021.4.5 type: gauge help: The total amount of real/physical memory installed on this host. - 1.3.6.1.4.1.2021.4.5
使うモジュールを edgemax へ
- job_name: 'snmp' static_configs: - targets: - 192.168.20.1 metrics_path: /snmp params: module: [edgemax] relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 127.0.0.1:9116
確認