Skip to main content

Hi,

I would like to monitor the number of dialup VPN on a Fortigate with a hardcoded value in the Centreon configuration that will be modified over the time.

Ideally, I would like to have a warning when we have more than this number, and a critical when we have less.

The current plugin Fortigate does not return dialup vpn information as those one seem stored in differents OID than standard site 2 site VPN. Here are the some additionnal information: https://docs.fortinet.com/document/fortigate/6.4.0/new-features/32869/snmp-polling-extensions-to-support-new-oids-6-4-2

 

So, I ran an snmpwalk on this OID: 1.3.6.1.4.1.12356.101.12.4.1.1.16 I can find some interesting values:

p...]

.1.3.6.1.4.1.12356.101.12.4.1.1.16.1 = STRING: "DialUpX_0"
.1.3.6.1.4.1.12356.101.12.4.1.1.16.2 = STRING: "DialUpX_1"
.1.3.6.1.4.1.12356.101.12.4.1.1.16.3 = STRING: "DialUpY_1"
.1.3.6.1.4.1.12356.101.12.4.1.1.16.4 = STRING: "DialUpY_4"
.1.3.6.1.4.1.12356.101.12.4.1.1.16.5 = STRING: "DialUpZ_3"
b...]

So my idea is to first catch all the value for DialUpY which is working great with the following:

#/usr/lib/centreon/plugins/centreon_generic_snmp.pl --plugin=apps::protocols::snmp::plugin --hostname=<ip> --snmp-version='3' --snmp-username="user"  --authpassphrase="authpass" --authprotocol="SHA"  --privpassphrase="privpass" --privprotocol="AES" --mode=string-value  --oid-table='1.3.6.1.4.1.12356.101.12.4.1.1.16' --filter-table-value="DialUpY"

OK: 11 value(s)

 

Then, I would like to write a regex allowing me to hardcode a number. Let’s say 10. In that case I will have a warning because I have 11 values. 

Is it the right way to proceed (maybe another generic plugin?) ? Anyone know how to write such a regexp to stay with standard plugin ? 

 

Thanks for reading

 

NB1: maybe I can also play with the “map” feature because I have, for each entrie under 1.3.6.1.4.1.12356.101.12.4.1.1.16 a numeric value of 2 under 1.3.6.1.4.1.12356.101.12.4.1.1.17, … :

2...]

.1.3.6.1.4.1.12356.101.12.4.1.1.17.1 = INTEGER: 2
.1.3.6.1.4.1.12356.101.12.4.1.1.17.2 = INTEGER: 2
.1.3.6.1.4.1.12356.101.12.4.1.1.17.3 = INTEGER: 2
.1.3.6.1.4.1.12356.101.12.4.1.1.17.4 = INTEGER: 2
.1.3.6.1.4.1.12356.101.12.4.1.1.17.5 = INTEGER: 2

1...]

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I discovered the collection mode which seems perfect for this needs. Here is my json file as an example if anyone needs the same

 

{
        "snmp": {
                "tables":
                        {
                                "name": "fgVpn2DialupEntry",
                                "oid": ".1.3.6.1.4.1.12356.101.12.4.1.1",
                                "used_instance": "\\.(\\d+)$",
                                "entries": i
                                        { "name": "fgVpn2DialupPhase1Name", "oid": ".1.3.6.1.4.1.12356.101.12.4.1.1.16"}
                                ]
                        }
                ]
        },
        "selection":
                {
                        "name": "myfilter",
                        "functions":
                                {
                                        "type": "count",
                                        "src": "%(snmp.tables.fgVpn2DialupEntry)",
                                        "filter": "%(src.fgVpn2DialupPhase1Name) =~ m/DialUpY_/",
                                        "save": "%(countDialUp)"
                                }
                        ],
                        "perfdatas":
                                {
                                        "nlabel": "DialUpY",
                                        "value": "%(countDialUp)",
                                        "min": 0
                                }
                        ],
                        "warning": "defined(%(constants.warning)) and %(constants.warning) lt %(countDialUp)",
                        "critical": "defined(%(constants.critical)) and %(constants.critical) gt %(countDialUp)",
                        "formatting": {
                                "printf_msg": "Number of DialUpY Users connected is %d",
                                "printf_var": b
                                        "%(countDialUp)"
                                ],
                                "display_ok": true
                        }
                }
        ],
        "formatting": {
                "custom_message_global": "Number of connected DialUpY Users is expected (%(constants.warning))",
                "separator": "-"
        }
}

 

Then I’ve the appropriate results (except for the formatting when everything is OK but i don’t care)

 

$:/usr/lib/centreon/plugins/centreon_generic_snmp.pl --plugin=apps::protocols::snmp::plugin --mode=collection --hostname='<ip>' --snmp-community='public' --snmp-version=3 --snmp-username="user"  --authpassphrase="auth" --authprotocol="SHA" --privpassphrase="priv" --privprotocol="AES" --config='/etc/centreon-engine/collection-config/forti-dialup-collection.json' --filter-selection='' --verbose --constant='warning=10' --constant='critical=10'
 

→ this produces a warning when we have 11 users connected

→ this produces a critical when we have 9 users connected

→ this produces an OK when we have 10 users connected

 

 

 

 

 

 

 

 

 

 


Reply