Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Counter and add information with processor (jq and starklak) #541

Open
pperesbr opened this issue Nov 1, 2024 · 2 comments
Open

Counter and add information with processor (jq and starklak) #541

pperesbr opened this issue Nov 1, 2024 · 2 comments

Comments

@pperesbr
Copy link

pperesbr commented Nov 1, 2024

Hello,

I'm subscribing to a Huawei device where it brings me all the arps learned.

Basically the json body is this:

[ { "source": "200.204.204.13:57400", "timestamp": 1730481585529741000, "time": "2024-11-01T17:19:45.529741Z", "updates": [ { "Path": "huawei-arp:arp/query-entries/query-entry[ip-addr=10.58.229.118][ni-name=GERENCIA-ACESSO]/pe-vlan", "values": { "huawei-arp:arp/query-entries/query-entry/pe-vlan": 8 } }, { "Path": "huawei-arp:arp/query-entries/query-entry[ip-addr=10.225.192.2][ni-name=SIP-RESIDENTIAL-BER-S]/pe-vlan", "values": { "huawei-arp:arp/query-entries/query-entry/pe-vlan": 3004 } }, { "Path": "huawei-arp:arp/query-entries/query-entry[ip-addr=10.225.192.3][ni-name=SIP-RESIDENTIAL-BER-S]/pe-vlan", "values": { "huawei-arp:arp/query-entries/query-entry/pe-vlan": 3004 } }, { "Path": "huawei-arp:arp/query-entries/query-entry[ip-addr=10.225.192.4][ni-name=SIP-RESIDENTIAL-BER-S]/pe-vlan", "values": { "huawei-arp:arp/query-entries/query-entry/pe-vlan": 3004 } }, { "Path": "huawei-arp:arp/query-entries/query-entry[ip-addr=10.225.192.5][ni-name=SIP-RESIDENTIAL-BER-S]/pe-vlan", "values": { "huawei-arp:arp/query-entries/query-entry/pe-vlan": 3004 } }, }, }, ]

What I need to do, instead of recording each record of this, the ideal would be to record in Prometheus the total number of MACs per VLAN, and also say whether a VLAN is from a specific device.

What is the best way to do this, via processors with jq to be able to add the total number of entries per VLAN, and starlak to be able to lookup the VLANs, or for example by throwing a Kafka queue so that I can move it to another app to do this?

Tks

Pauo

@karimra
Copy link
Collaborator

karimra commented Nov 4, 2024

Hi, You can use starlark, you need to make sure you handle entries being deleted.
But I think the easiest way to do it is in Prometheus using promql, there is no need for complicated manipulations within gnmic.

@pperesbr
Copy link
Author

pperesbr commented Nov 4, 2024

Okay,

The question is whether I need to save all the JSON entries in Prometheus, like in this case, where I receive all the MACs and in the end I want to show the total number of MACs per VLAN in Grafana. I'm thinking about storage, I only need the value count, and I also need to add some labels, like VLAN 3000 is from the Developers department, like a lookup, I'm thinking about putting it in NATs and consuming and saving the custom data using NATS.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants