bashclub / checkmk-opnsense-agent

75 stars 19 forks source link

Parsing of section statgrab_net failed #21

Closed sourceforge807 closed 1 year ago

sourceforge807 commented 1 year ago

Hi,

i have the following problem with client: In check mk it results in an errormessage "Parsing of section statgrab_net failed" when i have vlans in opnsense with the naming "vlan0.10", "vlan0.12" and so on. The othe interfaces ("lan", "wan") in checkmk where shown as vanished services. Without these named vlans it is all ok.

Referenced to /cmk/base/plugins/agent_based/inventory_statgrab_net.py line 20 there is a split wich will crash with output of the check.

Relevant agent output:

<<<statgrab_net>>> vtnet0.mtu 1500 vtnet0.ipackets 850605 vtnet0.ierror 0 vtnet0.idrop 0 vtnet0.rx 111443544 vtnet0.opackets 722513 vtnet0.oerror 0 [...] vlan0.10.mtu 1500 vlan0.10.ipackets 6838 vlan0.10.ierror 0 vlan0.10.idrop 0 vlan0.10.rx 191548 vlan0.10.opackets 215 vlan0.10.oerror 0 [...]

The naming "vlan0.XX" where made in opnsense: interfaces -> other -> VLAN -> Edit vlan0.XX -> device

Thanks a lot!

Setsua commented 1 year ago

Interfaces aren't visible in checkmk.

checkmk version: 2.1.0p25 agent version: 0.99.2

[root@OPNsense ~]# /usr/bin/netstat -i -b -d -n -W -f link
Name       Mtu Network            Address              Ipkts Ierrs Idrop     Ibytes    Opkts Oerrs     Obytes  Coll  Drop
igc0      1500 <Link#1>           aa:bb:cc:11:22:33 75184337     0     0 98298281886 49062740     0 17215226957     0     0
igc1      1500 <Link#2>           aa:bb:cc:11:22:33 31075168     0     0 2172642511 66459418     0 92608725366     0  1033
igc2      1500 <Link#3>           aa:bb:cc:11:22:33 20522795     0     0 16530136328 11024261     0 6648523619     0     0
igc3*     1500 <Link#4>           aa:bb:cc:11:22:33        0     0     0          0        0     0          0     0     0
lo0      16384 <Link#5>           lo0                  45528     0     0    8016768    45528     0    8016768     0     0
enc0*     1536 <Link#6>           enc0                     0     0     0          0        0     0          0     0     0
pflog0*  33160 <Link#7>           pflog0                   0     0     0          0  1065553     0   75302523     0     0
pfsync0*  1500 <Link#8>           pfsync0                  0     0     0          0        0     0          0     0     0
vlan0.20  1500 <Link#9>           aa:bb:cc:11:22:33        0     0     0          0        1     1         42     0     0
vlan0.30  1500 <Link#10>          aa:bb:cc:11:22:33        0     0     0          0        1     1         42     0     0
vlan0.40  1500 <Link#11>          aa:bb:cc:11:22:33    28842     0     0    5643954    49795     1   48604978     0     0
vlan0.50  1500 <Link#12>          aa:bb:cc:11:22:33   478043     0     0   89660493   741741     2  715774608     0     0
vlan0.7   1500 <Link#13>          aa:bb:cc:11:22:33 75180749     0     0 97996973505 49046489     0 17013002403     0     0
pppoe0    1492 <Link#14>          pppoe0            75175319     0     0 96342811991 49041059     0 15933936085     0     0
Setsua commented 1 year ago

The solution for me was to rename my vlan interfaces so they don't have a dot in its name. vlan0.20 -> vlan020 Don't forget to BACKUP your config. Be careful. The assignment had to be deleted.

The easiest solution is propably to download the config and rename the vlan interfaces and import it again.

thorstenspille commented 1 year ago

Please check testing branch, should be fixed with https://github.com/bashclub/check-opnsense/commit/e1c5d1a121059f61eaab5db6954f778e59b41693