Here's the approach I recommend:

1. modify the header line of the ubiquiti_unifi section so it looks like 
this:

ubiquiti_unifi: &ubiquiti_unifi

(i.e. add "&ubiquiti_unifi" to the end of that line)

2. at the very end of the file, put:

ubiquiti_unifi_1:
  <<: *ubiquiti_unifi
  version: 2
  auth:
    community: unifi

3. Restart snmp_exporter, and then invoke it with with 
module=ubiquiti_unifi_1 instead of ubiquiti_unifi.

(This uses a YAML trick to make a new entry which copies an existing entry, 
and then overrides some settings. It's especially useful if there are 
multiple community strings in use)

On Saturday, 25 June 2022 at 18:15:21 UTC+1 [email protected] wrote:

> I think you might be on to something, Brian.  I looked in my snmp.yml file 
> and found no reference at all to the community string. I tried adding 
>
> community: 
>   - unifi 
>
> to the top of the file immediately following ubiquiti_unifi: but when 
> restarting the snmp service, it fails stating msg="Error parsing config 
> file" err="yaml: unmarshal errors:\n  line 2: field community not found in 
> type config.plain".
>
> On Saturday, June 25, 2022 at 11:54:37 AM UTC-4 Brian Candler wrote:
>
>> And if that's not it, it's probably that the community string is wrong.  
>> The supplied snmp.yml uses "public" as the community string; if you need 
>> something else, you need to modify snmp.yml or generate a completely new 
>> one from generator.yml
>>
>> On Saturday, 25 June 2022 at 15:43:02 UTC+1 [email protected] wrote:
>>
>>> Your target IPs don't match.
>>>
>>> On Sat, Jun 25, 2022 at 4:41 PM 'John Fox' via Prometheus Users <
>>> [email protected]> wrote:
>>>
>>>> Hello all!
>>>>
>>>> I've been pulling my hair out trying to get snmp_exporter to crawl my 
>>>> Unifi devices. The error that it comes back with is:
>>>>
>>>> An error has occurred while serving metrics: error collecting metric 
>>>> Desc{fqName: "snmp_error", help: "Error scraping target", constLabels: {}, 
>>>> variableLabels: []}: error getting target 192.168.8.1: request timeout 
>>>> (after 3 retries)
>>>>
>>>> Yet I can snmpwalk without issue - for example:  snmpwalk -v 2c -c 
>>>> unifi -On 192.168.8.17 1.3.6.1.2.1.1.3.0 - returning:
>>>>
>>>> .1.3.6.1.2.1.1.3.0 = Timeticks: (9931546) 1 day, 3:35:15.46
>>>>
>>>> I'm not really sure what to make of this issue or how to solve it. When 
>>>> I see a timeout message, I thought to increase the scrape and timeout 
>>>> parameters to 5m, however that just results in an Error 500 message in 
>>>> Prometheus after about 2 minutes.
>>>>
>>>> Wondering what I'm doing wrong here.
>>>>
>>>> -- 
>>>> 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/9d0dc146-cd37-4a7c-8051-e92ba3d47530n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/prometheus-users/9d0dc146-cd37-4a7c-8051-e92ba3d47530n%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/73aa7833-70f9-4c64-95c1-0ae80f7fe24dn%40googlegroups.com.

Reply via email to