i have to parse an isis database and i have pb to capture some metrics.
My templates is :
Value Required LSPID (.*\.\d+\-00)
Value OVERLOAD_BIT ([0,1])
Value HOSTNAME (.*)
Value IPADD (\d+\.\d+\.\d+\.\d+)
Value List CONNECTED_METRIC (\d+)
Value List LSPID_PEER (.*)
Value List SUBNET_METRIC (\d+)
Value List SUBNET (\d+\.\d+\.\d+\.\d+\/\d+)
Start
^${LSPID}.*[0,1]/[0,1]/${OVERLOAD_BIT}
^\s+Hostname:\s+${HOSTNAME}
^\s+IP\s+Address:\s+${IPADD} -> Metrics
Metrics
^\s+Metric:\s+${CONNECTED_METRIC}\s+IS-Extended\s+${LSPID_PEER}
^\s+Metric:\s+${SUBNET_METRIC}\s+IP\s+${SUBNET} -> Record Start
My datas to parse are :
ROUTER_A.00-00 0x00020850 0xE97D 1122 0/0/0
Area Address: 49.0001
NLPID: 0xCC
Hostname: ROUTER_A
IP Address: 172.17.32.2
Metric: 1000 IS-Extended ROUTER_D.00
Metric: 100 IS-Extended ROUTER_E.00
Metric: 100 IS-Extended ROUTER_F.00
Metric: 1 IP 172.17.32.2/32
Metric: 1 IP 172.25.9.142/32
ROUTER_B.00-00 0x00064747 0x27E9 1183 0/0/0
Area Address: 49
NLPID: 0xCC
Hostname: ROUTER_B
Metric: 1000000 IS-Extended ROUTER_G.00
Metric: 1000000 IS-Extended ROUTER_H.00
IP Address: 192.168.12.51
Metric: 0 IP 172.25.92.155/32
Metric: 0 IP 192.168.12.51/32
ROUTER_C.00-00 0x0006B0C0 0x4632 1113 0/0/1
Area Address: 49.0001
NLPID: 0xCC
Hostname: ROUTER_C
Router ID: 192.168.128.131
IP Address: 172.25.92.62
Metric: 10000 IS-Extended ROUTER_I.00
Metric: 50000 IS-Extended ROUTER_J.00
Metric: 1 IP 172.25.92.62/32
Metric: 1 IP 192.168.128.131/32
ROUTER_K.00-00 0x00020850 0xE97D 1122 0/0/0
Area Address: 49.0001
NLPID: 0xCC
Hostname: ROUTER_K
IP Address: 172.17.72.2
Metric: 1000 IS-Extended ROUTER_D.00
Metric: 100 IS-Extended ROUTER_E.00
Metric: 100 IS-Extended ROUTER_F.00
And i have this result :
['ROUTER_A.00-00', '0', 'ROUTER_A', '172.17.32.2', ['1000', '100', '100'], ['ROUTER_D.00', 'ROUTER_E.00', 'ROUTER_F.00'], ['1'], ['172.17.32.2/32']]
['ROUTER_B.00-00', '0', 'ROUTER_B', '192.168.12.51', ['1000000', '1000000'], ['ROUTER_G.00', 'ROUTER_H.00'], ['0'], ['172.25.92.155/32']]
['ROUTER_C.00-00', '1', 'ROUTER_C', '172.25.92.62', ['10000', '50000'], ['ROUTER_I.00', 'ROUTER_J.00'], ['1'], ['172.25.92.62/32']]
['ROUTER_K.00-00', '0', 'ROUTER_K', '172.17.72.2', ['1000', '100', '100'], ['ROUTER_D.00', 'ROUTER_E.00', 'ROUTER_F.00'], [], []]
We can see that only the first "ip metric" are parsed (no parse for ip address 172.25.9.142/32 by example). Could you help me to find what is wrong ?
I made a workaround : i have edited the data file and inserted a tag that i match in fsm template.
So now i have this template and it's working fine but if someone has the solution to avoid to edit the source file it will be smarter than this workaround:
Value Required LSPID (.*\.\d+\-00)
Value OVERLOAD_BIT ([0,1])
Value HOSTNAME (.*)
Value IPADD (\d+\.\d+\.\d+\.\d+)
Value List CONNECTED_METRIC (\d+)
Value List LSPID_PEER (.*)
Value List SUBNET_METRIC (\d+)
Value List SUBNET (\d+\.\d+\.\d+\.\d+\/\d+)
Value END_LSPID (END_LSPID)
Start
^${LSPID}.*[0,1]/[0,1]/${OVERLOAD_BIT}
^\s+Hostname:\s+${HOSTNAME}
^\s+IP\s+Address:\s+${IPADD} -> Metrics
Metrics
^\s+Metric:\s+${CONNECTED_METRIC}\s+IS-Extended\s+${LSPID_PEER}
^\s+Metric:\s+${SUBNET_METRIC}\s+IP\s+${SUBNET}
^${END_LSPID} -> Record Start
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.