I am configuring an http agent type item to monitor the number of active clients of the meraki firewall.
However, the query through meraki API returns a lot of information about connected clients as an example below.
{
"id": "kfdsfdab15",
"mac": "d0:00:66:9f:00:2f",
"description": "EST032-012",
"ip": "199.167.1.92",
"ip6": null,
"user": "CN=Joana Perca Leite,OU=Usuarios,OU=Filial - 02,OU=Empresa,DC=empresa,DC=local",
"firstSeen": "2020-01-14T06:52:03Z",
"lastSeen": "2020-01-28T16:22:08Z",
"manufacturer": "Dell",
"os": "Windows 10",
"recentDeviceSerial": "Q3PT-B7QZ-XV25",
"recentDeviceName": "FL02-FW-01",
"recentDeviceMac": "0c:8d:db:73:7e:a0",
"ssid": null,
"vlan": 0,
"switchport": null,
"usage": {
"sent": 45215,
"recv": 371069
},
"status": "Online"
I need to somehow filter this json output to count only the lines with the online status.
curl -s --location --request GET "https://api.meraki.com/api/v0/networks/N_94849505912731083/clients?t86400=&perPage=200&startingAfter=1" --header "X-Cisco-Meraki-API-Key: $apikey" | jq . | grep "Online" | wc -l
If I do the search via the command line with curl, as below, I can concatenate with grep to filter and wc -l to count, it's work fine, but how do I do it inside zabbix?
The query is working well in zabbix, I just couldn't make the filter to count.
However, the query through meraki API returns a lot of information about connected clients as an example below.
{
"id": "kfdsfdab15",
"mac": "d0:00:66:9f:00:2f",
"description": "EST032-012",
"ip": "199.167.1.92",
"ip6": null,
"user": "CN=Joana Perca Leite,OU=Usuarios,OU=Filial - 02,OU=Empresa,DC=empresa,DC=local",
"firstSeen": "2020-01-14T06:52:03Z",
"lastSeen": "2020-01-28T16:22:08Z",
"manufacturer": "Dell",
"os": "Windows 10",
"recentDeviceSerial": "Q3PT-B7QZ-XV25",
"recentDeviceName": "FL02-FW-01",
"recentDeviceMac": "0c:8d:db:73:7e:a0",
"ssid": null,
"vlan": 0,
"switchport": null,
"usage": {
"sent": 45215,
"recv": 371069
},
"status": "Online"
I need to somehow filter this json output to count only the lines with the online status.
curl -s --location --request GET "https://api.meraki.com/api/v0/networks/N_94849505912731083/clients?t86400=&perPage=200&startingAfter=1" --header "X-Cisco-Meraki-API-Key: $apikey" | jq . | grep "Online" | wc -l
If I do the search via the command line with curl, as below, I can concatenate with grep to filter and wc -l to count, it's work fine, but how do I do it inside zabbix?
The query is working well in zabbix, I just couldn't make the filter to count.
Comment