You will probably need to have a good understanding of SNMP and MIBs in
order create new generator configs. Unfortunately, the Synology MIBs have a
large number of mistakes, making it even harder to work with.

I created a simple example of how to use the generator based on what I
found in the SYNOLOGY-RAID-MIB.

https://github.com/SuperQ/tools/tree/master/snmp_exporter/Synology

I corrected as many of the errors as I could, but Synology didn't format
the raidStatus as an ENUM.

On Fri, Aug 21, 2020 at 3:46 PM Mario Pranjic <[email protected]>
wrote:

> Hi Ben,
>
> Community string was wrong. I fixed that. Now I can tell snmp_exporter can
> communicate properly.
>
> I can get in Prometheus: sysUpTime{instance="192.168.10.187",job="snmp"}
> And value is read from the device (incrementing on refresh too).
>
> But as for mibs, I still can't use mibs as described in the Synology snmp
> guide.
>
> https://global.download.synology.com/download/Document/Software/DeveloperGuide/Firmware/DSM/All/enu/Synology_DiskStation_MIB_Guide.pdf
>
> There is still a step missing in the snmp_exporter role in regards to mibs
> and/or proper snmp.yml generation.
>
> Best regards,
>
> Mario.
>
> fre. 21. aug. 2020 kl. 15:28 skrev Ben Kochie <[email protected]>:
>
>> The SNMP exporter uses UDP for transport, so telnet to 161 isn't going to
>> help much. I've seen very few devices implement RFC 3430.
>>
>> There are usually two problems people run into.
>> * The community string is wrong (defaults to "public")
>> * The device has a management IP control and won't allow traffic.
>>
>> SNMP implementations generally don't reject incorrect authentication,
>> rather they simply drop the packets. So it can be hard to diagnose.
>>
>> On Fri, Aug 21, 2020 at 2:52 PM Mario Pranjic <[email protected]>
>> wrote:
>>
>>> Hi Ben,
>>>
>>> I ran another VM and used roles:
>>> -  https://github.com/cloudalchemy/ansible-snmp-exporter
>>> -  https://github.com/cloudalchemy/ansible-prometheus
>>>
>>> along with Grafana. Prometheus, node.exporter and Grafana work as
>>> intended (as before).
>>>
>>> However, when I try to enable snmp_exporter:
>>>   - job_name: snmp
>>>     metrics_path: /snmp
>>>     params:
>>>       module:
>>>       - if_mib
>>>     relabel_configs:
>>>     - source_labels:
>>>       - __address__
>>>       target_label: __param_target
>>>     - source_labels:
>>>       - __param_target
>>>       target_label: instance
>>>     - replacement: 127.0.0.1:9116
>>>       target_label: __address__
>>>     static_configs:
>>>     - targets:
>>>       - 192.168.10.187
>>>
>>> I get error in syslog:
>>> Aug 21 14:43:23 monnew snmp_exporter[363]: level=info
>>> ts=2020-08-21T12:43:23.189Z caller=collector.go:224 module=if_mib
>>> target=192.168.10.187 msg="Error scraping target" err="scrape canceled
>>> (possible timeout) getting target 192.168.10.187"
>>>
>>> snmp is enabled on device on 192.168.10.187. I tried snmp version 2c and
>>> 3 but the error message is the same. I can connect on that IP:port from
>>> prometheus/snmp_exporter node:
>>> root@monnew:~# telnet 192.168.10.187 161
>>> Trying 192.168.10.187...
>>> Connected to 192.168.10.187.
>>> Escape character is '^]'.
>>>
>>>
>>> Port 9116 is opened on localhost on prometheus/snmp_exporter node:
>>> root@monnew:/etc/snmp_exporter# netstat -na|grep 9116
>>> tcp        0      0 127.0.0.1:35274         127.0.0.1:9116
>>>  ESTABLISHED
>>> tcp6       0      0 :::9116                 :::*
>>>  LISTEN
>>> tcp6       0      0 127.0.0.1:9116          127.0.0.1:35274
>>> ESTABLISHED
>>> root@monnew:/etc/snmp_exporter# telnet 127.0.0.1 9116
>>> Trying 127.0.0.1...
>>> Connected to 127.0.0.1.
>>> Escape character is '^]'.
>>>
>>> What I am missing here is that generator thing. I didn't install
>>> any  mibs in this case, and, from what I see in Ansible role, no mibs or
>>> generator has been set/run.
>>>
>>> Instead, snmp.yml file is being pulled from remote location:
>>> "https://raw.githubusercontent.com/prometheus/snmp_exporter/v{{
>>> snmp_exporter_version }}/snmp.yml"
>>>
>>> Could you shed some light here, because I am obviously missing some step
>>> along the way.
>>>
>>> Thanks in advance!
>>>
>>> Best regards,
>>>
>>> Mario.
>>>
>>>
>>> fre. 21. aug. 2020 kl. 11:05 skrev Mario Pranjic <
>>> [email protected]>:
>>>
>>>> Hm.
>>>>
>>>> I wrote the roles myself for Prometheus and Grafana but I used debian
>>>> packages for Prometheus and external repository for Grafana.
>>>>
>>>> I am fully aware Debian often has older versions of packages (sometimes
>>>> pretty old). To be able to use prometheus repository (as Grafana provides
>>>> one), would make our lives a lot easier. :)
>>>>
>>>> I will look into these and see if things are better with newer versions.
>>>>
>>>> Thanks for the tip!
>>>>
>>>> Best regards,
>>>>
>>>> Mario.
>>>>
>>>> fre. 21. aug. 2020 kl. 10:42 skrev Ben Kochie <[email protected]>:
>>>>
>>>>> I highly recommend against using the Debian packages, as they are
>>>>> extremely out of date.
>>>>>
>>>>> If you're using Ansible, you can use these high quality roles.
>>>>>
>>>>> https://github.com/cloudalchemy
>>>>>
>>>>> For example, https://github.com/cloudalchemy/ansible-prometheus
>>>>>
>>>>> We are planning an official Deb repo, but it's not ready yet.
>>>>>
>>>>> For the generator, it's going to be one thing you do need to build,
>>>>> because it needs to be compiled with a distro specific net-snmp dev 
>>>>> package.
>>>>>
>>>>> On Fri, Aug 21, 2020, 10:37 Mario Pranjic <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Hi Ben,
>>>>>> I use versions available in Debian repository:
>>>>>> ii  prometheus                              2.7.1+ds-3+b11
>>>>>>      amd64        Monitoring system and time series database
>>>>>> ii  prometheus-alertmanager                 0.15.3+ds-3+b1
>>>>>>      amd64        Handle and deliver alerts created by Prometheus
>>>>>> ii  prometheus-node-exporter                0.17.0+ds-3+b11
>>>>>>     amd64        Prometheus exporter for machine metrics
>>>>>> ii  prometheus-snmp-exporter                0.14.0+ds-1+b10
>>>>>>     amd64        Prometheus exporter for SNMP-enabled devices
>>>>>>
>>>>>> I try building as little as possible since all provisioning is
>>>>>> handled by Ansible at the end.
>>>>>>
>>>>>> If there is prometheus external repository for Debian, that could be
>>>>>> worth checking, but I didn't find one.
>>>>>>
>>>>>>
>>>>>> fre. 21. aug. 2020 kl. 10:25 skrev Ben Kochie <[email protected]>:
>>>>>>
>>>>>>> What version is this, it's likely out of date. I would recommend
>>>>>>> building from source.
>>>>>>>
>>>>>>> On Thu, Aug 20, 2020, 21:11 Mario Polario <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I am trying to set-up prometheus-snmp-exporter to collect data from
>>>>>>>> my Synology NAS.
>>>>>>>> I downloaded mibs (Synology mibs included) to /usr/share/snmp/mibs.
>>>>>>>>
>>>>>>>> When running prometheus-snmp-generator I get an error:
>>>>>>>>
>>>>>>>> root@monitoring:/etc/prometheus# prometheus-snmp-generator generate
>>>>>>>>
>>>>>>>> INFO[0000] Loading MIBs from
>>>>>>>> $HOME/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp
>>>>>>>> source="net_snmp.go:136"
>>>>>>>> WARN[0000] NetSNMP reported 2 parse errors
>>>>>>>>  source="main.go:103"
>>>>>>>> FATA[0000] Error parsing yml config: Invalid metric type override
>>>>>>>> 'EnumAsInfo'  source="main.go:44"
>>>>>>>>
>>>>>>>>
>>>>>>>> I tried removing all from generator.yml except Synology module, but
>>>>>>>> no change.
>>>>>>>>
>>>>>>>> I was following instructions noted
>>>>>>>> in /usr/share/doc/prometheus-snmp-exporter/README.Debian but I can't 
>>>>>>>> seem
>>>>>>>> to generate snmp.yml file.
>>>>>>>>
>>>>>>>> Any help in understanding what I did wrong is more than welcomed.
>>>>>>>>
>>>>>>>> Thanks in advance!
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>>
>>>>>>>> Mario.
>>>>>>>>
>>>>>>>> --
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "Prometheus Users" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>> send an email to [email protected].
>>>>>>>> To view this discussion on the web visit
>>>>>>>> https://groups.google.com/d/msgid/prometheus-users/b8f2f195-efc1-4c48-b85b-88a8687964bfn%40googlegroups.com
>>>>>>>> <https://groups.google.com/d/msgid/prometheus-users/b8f2f195-efc1-4c48-b85b-88a8687964bfn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>>
>>>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CABbyFmo7PwEQPpSFvJgqF2AQ-JPYOmx6pYWVdmhiRiu8OvetMA%40mail.gmail.com.

Reply via email to