Anyone willing to assist with coding VDOM support

Hi All

Im not a coder by trade, So i was wondering if there is anyone out there who could assist me with adding the following support for Fortigate VDOMs for a Fortigate device.

Below is the command one would run to gather the VDOM information for a Fortigate

snmpbulkwalk -v2c -c somecommunitystring -OQUs -m FORTINET-FORTIGATE-MIB -M /opt/librenms/mibs:/opt/librenms/mibs/fortinet udp:10.251.2.254:161 fgVirtualDomain

Below is unformatted/ungrouped output

fgVdNumber.0 = 6
fgVdMaxVdoms.0 = 10
fgVdEnabled.0 = enabled
fgVdEntIndex.1 = 1
fgVdEntIndex.2 = 2
fgVdEntIndex.3 = 3
fgVdEntIndex.5 = 5
fgVdEntIndex.6 = 6
fgVdEntIndex.7 = 7
fgVdEntName.1 = root
fgVdEntName.2 = labournet
fgVdEntName.3 = uhc-www
fgVdEntName.5 = modo
fgVdEntName.6 = Cust-Srv1
fgVdEntName.7 = Peering
fgVdEntOpMode.1 = nat
fgVdEntOpMode.2 = nat
fgVdEntOpMode.3 = nat
fgVdEntOpMode.5 = nat
fgVdEntOpMode.6 = nat
fgVdEntOpMode.7 = nat
fgVdEntHaState.1 = master
fgVdEntHaState.2 = master
fgVdEntHaState.3 = master
fgVdEntHaState.5 = master
fgVdEntHaState.6 = master
fgVdEntHaState.7 = master
fgVdEntCpuUsage.1 = 0
fgVdEntCpuUsage.2 = 0
fgVdEntCpuUsage.3 = 0
fgVdEntCpuUsage.5 = 0
fgVdEntCpuUsage.6 = 0
fgVdEntCpuUsage.7 = 0
fgVdEntMemUsage.1 = 0
fgVdEntMemUsage.2 = 0
fgVdEntMemUsage.3 = 0
fgVdEntMemUsage.5 = 19
fgVdEntMemUsage.6 = 20
fgVdEntMemUsage.7 = 5
fgVdEntSesCount.1 = 219
fgVdEntSesCount.2 = 2
fgVdEntSesCount.3 = 72
fgVdEntSesCount.5 = 4526
fgVdEntSesCount.6 = 4016
fgVdEntSesCount.7 = 1228
fgVdEntSesRate.1 = 0
fgVdEntSesRate.2 = 0
fgVdEntSesRate.3 = 0
fgVdEntSesRate.5 = 8
fgVdEntSesRate.6 = 2
fgVdEntSesRate.7 = 10

Formatted/Grouped

Amount of vdoms configured - fgVdNumber.0 = 6
The maximum number of virtual domains allowed on the device as allowed by hardware and/or licensing - fgVdMaxVdoms.0 = 10
Whether virtual domains are enabled on this device - fgVdEnabled.0 = enabled

fgVdEntIndex.1 = 1
fgVdEntName.1 = root - The name of the virtual domain
fgVdEntOpMode.1 = nat - Operation mode of the virtual domain (NAT or Transparent)
fgVdEntHaState.1 = master - Operation mode of the virtual domain (NAT or Transparent)
fgVdEntCpuUsage.1 = 0- Percentage
fgVdEntMemUsage.1 = 5- Percentage
fgVdEntSesCount.1 = 219
fgVdEntSesRate.1 = 0 - Sessions per second

fgVdEntIndex.2 = 2
fgVdEntName.2 = labournet - The name of the virtual domain
fgVdEntOpMode.2 = nat - Operation mode of the virtual domain (NAT or Transparent)
fgVdEntHaState.2 = master - Operation mode of the virtual domain (NAT or Transparent)
fgVdEntCpuUsage.2 = 0- Percentage
fgVdEntMemUsage.2 = 5- Percentage
fgVdEntSesCount.2 = 2
fgVdEntSesRate.2 = 0 - Sessions per second

fgVdEntIndex.3 = 3
fgVdEntName.3 = uhc-www - The name of the virtual domain
fgVdEntOpMode.3 = nat - Operation mode of the virtual domain (NAT or Transparent)
fgVdEntHaState.3 = master - Operation mode of the virtual domain (NAT or Transparent)
fgVdEntCpuUsage.3 = 0- Percentage
fgVdEntMemUsage.3 = 5- Percentage
fgVdEntSesCount.3 = 72
fgVdEntSesRate.3 = 0 - Sessions per second

fgVdEntIndex.5 = 5 - Internal virtual domain index used to uniquely identify rows in this table. This index is also used by other tables referencing a virtual domain.
fgVdEntName.5 = modo - The name of the virtual domain
fgVdEntOpMode.5 = nat - Operation mode of the virtual domain (NAT or Transparent)
fgVdEntHaState.5 = master - Can be master, backup or standalone
fgVdEntCpuUsage.5 = 0 - Percentage
fgVdEntMemUsage.5 = 5 - Percentage
fgVdEntSesCount.5 = 4526
fgVdEntSesRate.5 = 8 - Sessions per second

fgVdEntIndex.6 = 6 - Internal virtual domain index used to uniquely identify rows in this table. This index is also used by other tables referencing a virtual domain.
fgVdEntName.6 = Cust-Srv1 - The name of the virtual domain
fgVdEntOpMode.6 = nat - Operation mode of the virtual domain (NAT or Transparent)
fgVdEntHaState.6 = master - Operation mode of the virtual domain (NAT or Transparent)
fgVdEntCpuUsage.6 = 0- Percentage
fgVdEntMemUsage.6 = 5- Percentage
fgVdEntSesCount.6 = 4016
fgVdEntSesRate.6 = 2 - Sessions per second

fgVdEntIndex.7 = 7 - Internal virtual domain index used to uniquely identify rows in this table. This index is also used by other tables referencing a virtual domain.
fgVdEntName.7 = Peering - The name of the virtual domain
fgVdEntOpMode.7 = nat - Operation mode of the virtual domain (NAT or Transparent)
fgVdEntHaState.7 = master - Operation mode of the virtual domain (NAT or Transparent)
fgVdEntCpuUsage.7 = 0 - Percentage
fgVdEntMemUsage.7 = 5 - Percentage
fgVdEntSesCount.7 = 1228 - ActiveNumber of sessions
fgVdEntSesRate.7 = 10 - Sessions per second

FgVdEntry ::= SEQUENCE {
fgVdEntIndex FgVdIndex,
fgVdEntName DisplayString,
fgVdEntOpMode FgOpMode,
fgVdEntHaState FgHaState,
fgVdEntCpuUsage Gauge32,
fgVdEntMemUsage Gauge32,
fgVdEntSesCount Gauge32,
fgVdEntSesRate Gauge32
}

This information can be displays in the same manner as virtual machines are displayed for VMware below is an example

So if anyone is willing to work with me on this and help me with the coding drop me a PM

Thanks

Do I need to edit the following /includes/definitions/discovery)/fortigate.yaml in someway with the reference to the above?

For what you want (a new tab in device overview with all that data) must be coded.

If you add in the yaml you reference, and you can, you will see it as sensors (Health tab)

Thanks for the infomation I now a little bit more info on how the yaml work.

With regards to the new tab in device view i think i found the php script that does it for the VM machines is it includes/html/pages/vminfo.inc.php, if so I could copy this page and adjust it for the VDOMS?

Thanks

So after some scratching around to find some with the virtual machine template i want to use I have come across the following files that will need to be copied and updated.

librenms/resources/views/layouts/menu.blade.php
resources/lang/it.json
resources/lang/zh-TW.json
resources/lang/de.json
resources/lang/fr.json
includes/html/pages/vminfo.inc.php
includes/polling/os/vmware.inc.php
app/Http/Controllers/Device/Tabs/VmInfoController.php
includes/html/pages/device/vm.inc.php
includes/discovery/vmware-vminfo.inc.php
2018_07_03_091314_create_vminfo_table.php

This comes a bit complicated:

resources/lang/it.json
resources/lang/zh-TW.json
resources/lang/de.json
resources/lang/fr.json

Those files are auto-generated when new language options are set.

The VMWare tab are probably binded to a module, so it will only show when that info is discovered.

Do you mean the virtual machine tab when you say VMWare tab as shown below

Yeah sorry, the virtual machines one I mean

Thanks

With regards to the below
The VMWare tab are probably binded to a module, so it will only show when that info is discovered.

This is fine as it should only be displayed when it is discovered

This is going to be tough as I have no idea what links to what and how.

If some one is can or is going to do this Im available to be thaught.

We have bumped into this issue too. I would not put vdoms into any separate tabs, but treat them as VRF’s instead. Since they are essentially separate routing domains and have their own rib. Fortigates do also support vrf’s within vdoms so that complicates it a bit though.

What you need to do with the VDOMs is to use them in addition of the regular snmp community when polling, to be able to read bgp sessions from within the vdom.

With fortigates you then use communityname-vdomname when polling the device.

So you need to make a list of VDOMs, then loop through those when polling to get the data you normally would be missing if only polling the root VDOM.

This topic was automatically closed 730 days after the last reply. New replies are no longer allowed.