Unable to generate

189 views
Skip to first unread message

Justin Counsell

unread,
Oct 14, 2020, 12:18:31 AM10/14/20
to Prometheus Users
[root@localhost generator]# ./generator generate
level=info ts=2020-10-14T04:12:44.442Z caller=net_snmp.go:142 msg="Loading MIBs" from=/root/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs
level=error ts=2020-10-14T04:12:44.712Z caller=main.go:130 msg="Error generating config netsnmp" err="error parsing yml config: yaml: unmarshal errors:\n  line 1: field fortigate-fortinet-mib not found in type main.Config"


mibs work perfectly fine if I use snmpwalk... soon as I try to build it cant find that module? fortigate_snmp does not exist... this came from logicmonitor.


Justin Counsell

unread,
Oct 14, 2020, 12:20:39 AM10/14/20
to Prometheus Users
where is this main.config file?

Justin Counsell

unread,
Oct 14, 2020, 12:23:18 AM10/14/20
to Prometheus Users
[root@localhost generator]# ./generator parse_errors
level=info ts=2020-10-14T04:22:00.098Z caller=net_snmp.go:142 msg="Loading MIBs" from=/root/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs

[root@localhost generator]#

lol no errors?

sabarish narayanan

unread,
Oct 14, 2020, 2:13:22 AM10/14/20
to Prometheus Users
It will be helpful to solve the problem if you upload the yml file as well. I am new to this stuff myself but the error seems to suggest that it is taking "fortigate-fortinet-mib" as a keyword. Have you added "modules: " in the begining of your generator.yml file?

Justin Counsell

unread,
Oct 14, 2020, 2:23:17 AM10/14/20
to Prometheus Users
exactly the same as the one found here - https://grafana.com/grafana/dashboards/7567

Justin Counsell

unread,
Oct 14, 2020, 2:23:51 AM10/14/20
to Prometheus Users
yes have added modules..

Brian Candler

unread,
Oct 14, 2020, 3:06:13 AM10/14/20
to Prometheus Users
Can you run "cat generator.yml" and paste the *exact* output here, without mangling the formatting? (Preferably, after pasting, select the text and change font to "Courier New").

The error message appears to be saying that the string "fortigate-fortinet-mib" appears in your YAML file.  But that string does not occur in the sample file that you linked to.

The overall structure of generator.yaml should be like this one: https://github.com/prometheus/snmp_exporter/blob/master/generator/generator.yml

Justin Counsell

unread,
Oct 14, 2020, 3:16:03 AM10/14/20
to Brian Candler, Prometheus Users
What your asking is near impossible on this webpage, the formatting is awful. But here goes:

modules:
fortigate_snmp:
walk:
    - ifXTable
    - fgVpn        
    - fgSystem        
    - fgIntf
    - fgInetProto
version: 3
max_repetitions: 25
timeout: 10s
auth:
    username: snpuser  # Required, no default. -u option to NetSNMP.                                                                                                                                        
    security_level: noauthNoPriv  # Defaults to noAuthNoPriv. -l option to NetSNMP.                                                                                                                                  
                                # Can be noAuthNoPriv, authNoPriv or authPriv.                                                                                                                                  
    #password: your_password  # Has no default. Also known as authKey, -A option to NetSNMP.                                                                                                                            
                # Required if security_level is authNoPriv or authPriv.                                                                                                                                        
    #auth_protocol: SHA  # MD5 or SHA, defaults to SHA. -a option to NetSNMP.                                                                                                                                      
                      # Used if security_level is authNoPriv or authPriv.

There is no fortigate_snmp in any fortigate MIBs that I can find?

--
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 prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/f2d7d21e-fb1c-41be-9c17-8e7a9e8e4c3co%40googlegroups.com.

Justin Counsell

unread,
Oct 14, 2020, 3:18:00 AM10/14/20
to Brian Candler, Prometheus Users
I have run this through a yaml formatting test with no issues. i'm not getting yaml formatting errors.

What im pretty sure that is a custom mib/module and written by someone else that's why it wont work. How it gets posted on grafana is incredible.


 
Justin Counsell
IT Administrator
justin@plasticwax.com
www.plasticwax.com  
This email may contain confidential and/or private information.
If you received this email in error please delete and notify sender.

sabarish narayanan

unread,
Oct 14, 2020, 3:23:03 AM10/14/20
to Prometheus Users
If it's exactly the same as  the one in https://grafana.com/grafana/dashboards/7567, then it won't work because that's not the complete file. Also that doesn't have "fortigate-fortinet-mib" in it.
If you have added "modules:", before it then there may be some indenting issue. But I think without the generator.yml file it will be very difficult to guess the issue.

sabarish narayanan

unread,
Oct 14, 2020, 3:26:35 AM10/14/20
to Prometheus Users
Check the indentation of "modules:", " fortigate_snmp:" and "walk:" try the following,

modules:
  fortigate_snmp:
    walk:
      - ifXTable
      - fgSystem
      - fgVpn
      - fgIntf
      - fgInetProto

    version3
    max_repetitions25
    timeout10s
    auth:
.
.
.

This worked for me. I am using the exact dashboard you mentioned.

sabarish narayanan

unread,
Oct 14, 2020, 3:31:10 AM10/14/20
to Prometheus Users
I downloaded these three mibs FORTINET-CORE-MIB.txt, FORTINET-FORTIGATE-MIB.txt and FORTINET-FORTIMANAGER-MIB.txt.

Brian Candler

unread,
Oct 14, 2020, 3:31:51 AM10/14/20
to Prometheus Users
You need to indent "fortigate_snmp" under "modules", and "walk" and the other keys under "fortigate_snmp".  Like the following (aside: I don't have any problem with formatting in the Google Groups web interface, but I'm using the "classic" view)

modules:
  fortigate_snmp:
    walk:
      - ifXTable
      - fgVpn        
      - fgSystem        
      - fgIntf
      - fgInetProto
    version: 3
    max_repetitions: 25
    timeout: 10s
    auth:
      username: snmpuser
      security_level: noauthNoPriv
      password: your_password                                                                                                                                              




There is no fortigate_snmp in any fortigate MIBs that I can find?


That's correct.  This is a label which prometheus' snmp_exporter gives to the MIB (or collection of MIBs).  You can choose whatever label you like, but you need to give the same label when scraping, e.g. target=X.X.X.X&mib=fortigate_snmp

Justin Counsell

unread,
Oct 14, 2020, 3:34:50 AM10/14/20
to sabarish narayanan, Prometheus Users
Holy moley it worked. Thank you so much everyone.

Sorry off topic but,  Could anyone recommend a text editor for writing yaml that will help me to not run into these formatting issues?

--
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 prometheus-use...@googlegroups.com.

Brian Candler

unread,
Oct 14, 2020, 3:37:05 AM10/14/20
to Prometheus Users
On Wednesday, 14 October 2020 08:18:00 UTC+1, Justin Counsell wrote:
I have run this through a yaml formatting test with no issues. i'm not getting yaml formatting errors.

That's because

modules:
fortigate_snmp:
walk:
   ...

is syntactically valid yaml: it's an object with three keys. But it's not semantically valid to the generator, which doesn't expect to see top-level keys "fortigate_snmp" or "walk".

If you think of it as JSON, it's like the difference between

{
  "modules":null,
  "fortigate_snmp":null,
  "walk": {...}
}

and

{
  "modules": {
    "fortigate_snmp": {
      "walk: {...}
    }
  }
}

The first is not understood by the generator, the second is.

sabarish narayanan

unread,
Oct 14, 2020, 5:41:11 AM10/14/20
to Prometheus Users
I use visual studio code with notepad++ keymap.
To unsubscribe from this group and stop receiving emails from it, send an email to promethe...@googlegroups.com.

Justin Counsell

unread,
Oct 14, 2020, 9:25:23 PM10/14/20
to Prometheus Users
So the snmp exporter seems to work but doesnt want to communicate wit the fortigate. I get "server returned HTTP status 400 Bad Request."

But if I use the SNMP exporter page on port 9116 then enter the IP and module it works just fine and can see the OIDs respond with data.

Any ideas? 

Justin Counsell

unread,
Oct 14, 2020, 10:00:01 PM10/14/20
to Prometheus Users
this link works 


but the exporter uses the below link. which does not work.. anyway I can get it it to use the top link instead?


Ben Kochie

unread,
Oct 15, 2020, 12:57:42 AM10/15/20
to Justin Counsell, Prometheus Users
One url has a typo, "modules" is incorrect. It is "module", not plural.

--
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 prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/0f354736-2871-434f-9cb3-38680decb0acn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages