Support SNMPv3 Backend APIs & Telegraf configuration for the device metrics

Review Request #1142 — Created Nov. 6, 2025 and submitted

apoorva.sn
AMP
amp_3_7_2
AE-2203
mmiriam, ngurunathan, pmurugaiyan, pradeep, shuinvy

Problem

Support SNMPv3 Backend APIs & Telegraf configuration for the device metrics

Solution

Have added API's to support the SNMPV3 config for devices

Configure SNMpv3

curl --location 'https://192.168.162.162:8888/snmpv3/config' \
--header 'Accept: application/json, text/plain, /' \
--header 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' \
--header 'Origin: https://192.168.162.162:8888' \
--header 'Referer: https://192.168.162.162:8888/app/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-origin' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36' \
--header 'X-CSRFToken: GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6' \
--header 'sec-ch-ua: "Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'Cookie: csrf_token=GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6; csrftoken=GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6; current_user=array; django_language=en; hive_key=1; hive_sess=5f2fb8d2-39e7-482d-ba97-ac6c1c8e97aa' \
--data '{
"device_ip": "192.168.162.88",
"device_type": "ag",
"username": "snmpuser3",
"auth_pass": "authpass123",
"priv_pass": "privpass123",
"auth_protocol": "SHA",
"priv_protocol": "AES",
"sec_level": "authNoPriv"
}'

Response:

{
"message": "SNMPv3 configuration successful"
}

GET SNMPv3 Config for all devices

curl --location 'https://192.168.162.162:8888/snmpv3/config' \
--header 'Accept: application/json, text/plain, /' \
--header 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' \
--header 'Origin: https://192.168.162.162:8888' \
--header 'Referer: https://192.168.162.162:8888/app/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-origin' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36' \
--header 'X-CSRFToken: GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6' \
--header 'sec-ch-ua: "Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'Cookie: csrf_token=GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6; csrftoken=GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6; current_user=array; django_language=en; hive_key=1; hive_sess=5f2fb8d2-39e7-482d-ba97-ac6c1c8e97aa'

Response:

[
{
"username": "snmpuser2",
"priv_pass": "privpass123",
"auth_pass": "authpass123",
"device_ip": "192.168.162.160",
"enabled": true,
"sec_level": "authPriv",
"auth_protocol": "SHA",
"priv_protocol": "AES",
"device_type": "apv"
},
{
"username": "snmpuser3",
"priv_pass": "privpass123",
"device_ip": "192.168.162.88",
"auth_pass": "authpass123",
"enabled": true,
"sec_level": "authNoPriv",
"auth_protocol": "SHA",
"priv_protocol": "AES",
"device_type": "ag"
}

DELETE SNMPv3 Config for a specific device

curl --location --request DELETE 'https://192.168.162.162:8888/snmpv3/config?device_ip=192.168.162.166' \
--header 'Accept: application/json, text/plain, /' \
--header 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' \
--header 'Origin: https://192.168.162.162:8888' \
--header 'Referer: https://192.168.162.162:8888/app/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-origin' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36' \
--header 'X-CSRFToken: GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6' \
--header 'sec-ch-ua: "Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'Cookie: csrf_token=GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6; csrftoken=GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6; current_user=array; django_language=en; hive_key=1; hive_sess=5f2fb8d2-39e7-482d-ba97-ac6c1c8e97aa'

{
"message": "SNMPv3 device removed and Telegraf updated."
}

GET SNMPv3 Config for a specific device

curl --location 'https://192.168.162.162:8888/snmpv3/config?device_ip=192.168.162.166' \
--header 'Accept: application/json, text/plain, /' \
--header 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' \
--header 'Origin: https://192.168.162.162:8888' \
--header 'Referer: https://192.168.162.162:8888/app/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-origin' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36' \
--header 'X-CSRFToken: GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6' \
--header 'sec-ch-ua: "Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'Cookie: csrf_token=GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6; csrftoken=GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6; current_user=array; django_language=en; hive_key=1; hive_sess=5f2fb8d2-39e7-482d-ba97-ac6c1c8e97aa'

Response:

{
"error": "No SNMPv3 configuration found for device 192.168.162.166"
}

GET SNMPv3 Config for a specific device

curl --location 'https://192.168.162.162:8888/snmpv3/config?device_ip=192.168.162.160' \
--header 'Accept: application/json, text/plain, /' \
--header 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' \
--header 'Origin: https://192.168.162.162:8888' \
--header 'Referer: https://192.168.162.162:8888/app/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-origin' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36' \
--header 'X-CSRFToken: GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6' \
--header 'sec-ch-ua: "Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'Cookie: csrf_token=GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6; csrftoken=GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6; current_user=array; django_language=en; hive_key=1; hive_sess=5f2fb8d2-39e7-482d-ba97-ac6c1c8e97aa'

Response:

{
"username": "snmpuser2",
"priv_pass": "privpass123",
"auth_pass": "authpass123",
"device_ip": "192.168.162.160",
"enabled": true,
"sec_level": "authPriv",
"auth_protocol": "SHA",
"priv_protocol": "AES",
"device_type": "apv"
}

Enable/Disable the SNMP for a device

curl --location 'https://192.168.162.162:8888/snmpv3/toggle' \
--header 'Accept: application/json, text/plain, /' \
--header 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' \
--header 'Origin: https://192.168.162.162:8888' \
--header 'Referer: https://192.168.162.162:8888/app/' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: same-origin' \
--header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36' \
--header 'X-CSRFToken: GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6' \
--header 'sec-ch-ua: "Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"' \
--header 'sec-ch-ua-mobile: ?0' \
--header 'sec-ch-ua-platform: "macOS"' \
--header 'Cookie: csrf_token=GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6; csrftoken=GrfMXFMkuX1yZPrG2nJ5SwineYJvUdY6; current_user=array; django_language=en; hive_key=1; hive_sess=2c73626e-72c8-4e03-92e8-42b4b9d4cefd' \
--data '{
"device_ip": "192.168.162.160",
"enabled": true
}'

Response:

{
"message": "Device polling status updated successfully"
}


Description From Last Updated

Can we integrate the SNMPv3 as part of the device registration itself. we are already having an option to enable …

pmurugaiyanpmurugaiyan

can we remove the telegraf API? This should be a internal behaviour.

pmurugaiyanpmurugaiyan

404?

pmurugaiyanpmurugaiyan

{ "message": "No SNMPv3 configuration found for the device 192.168.162.166", "status": false } can we change response like this, a …

pmurugaiyanpmurugaiyan

Why CPU and Memory stats, config syntax validation should be sufficient right!

pmurugaiyanpmurugaiyan
apoorva.sn
shuinvy
  1. Ship It!
  2. 
      
pmurugaiyan
  1. 
      
  2. Can we integrate the SNMPv3 as part of the device registration itself.

    we are already having an option to enable or disable the Monitoring, we can continue using it.

    In the edit device config page, we can show the SNMP config along with other device config. Update also can follow the same.

  3. 
      
apoorva.sn
apoorva.sn
pmurugaiyan
  1. 
      
  2. can we remove the telegraf API? This should be a internal behaviour.

    1. yes if the device id is not in the configured list or No devices configured we send 404-Not Found

    2. 404 is Page not found. It should be 200 with empty device.

    3. 404 is Resource not found, so sending that here when the queried device_ip is not found.
      A 200 with an empty payload would imply the resource exists but has no data.

    4. https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/404

    5. Yes, the definition in the MDN link confirms this —
      “The HTTP 404 Not Found status code indicates that the server cannot find the requested resource.”

    6. The requested resource is the endpoint, not the data.

    7. If you want to represent the data, you can use 204. 404 status code is not meant for this.

    8. a 404 Not Found is appropriate when a specific resource doesn't exist.
      In this context, a GET request for /snmpv3_config?device_ip=... is asking for a specific SNMPv3 device configuration entity. For this I have retained 404.
      When no devices exist sending 200 response with empty list

  3. {
    "message": "No SNMPv3 configuration found for the device 192.168.162.166",
    "status": false
    }

    can we change response like this, a boolean to represent the status and a user friendly message to decribe the status.

    1. We already are sending status code as part of the Http Response. So sending status seperately wont be consistent with all the Http Response I am sending now.

    2. status key helps in parsing, we can't parse the string to know the status of SNMPv3

    3. We are sending the status as Http Response status. Maintaining another status parameter would be redundant

    4. Im taking about the SNMPv3 status, the status shouldn't be an error. Its enabled/disabled, with the descriptive message.

    5. But if the device itself is not found. how would we show the SNMP configuration and status for that ?
      When SNMPv3 is configured, the API returns the configuration with an enabled flag (true or false)
      If in case the device SNMP is disabled it is shown as below:
      https://192.168.162.162:8888/snmpv3/config?device_ip=192.168.162.160
      {
      "username": "snmpuser2",
      "priv_pass": "privpass123",
      "device_ip": "192.168.162.160",
      "auth_pass": "authpass123",
      "enabled": false,
      "sec_level": "authPriv",
      "auth_protocol": "SHA",
      "priv_protocol": "AES",
      "device_type": "apv"
      }

      https://192.168.162.162:8888/snmpv3/config

      [
      {
      "username": "snmpuser2",
      "priv_pass": "privpass123",
      "device_ip": "192.168.162.160",
      "auth_pass": "authpass123",
      "enabled": false,
      "sec_level": "authPriv",
      "auth_protocol": "SHA",
      "priv_protocol": "AES",
      "device_type": "apv"
      },
      {
      "username": "snmpuser3",
      "priv_pass": "privpass123",
      "auth_pass": "authpass123",
      "device_ip": "192.168.162.88",
      "enabled": true,
      "sec_level": "authNoPriv",
      "auth_protocol": "SHA",
      "priv_protocol": "AES",
      "device_type": "ag"
      }
      ]

  4. Why CPU and Memory stats, config syntax validation should be sufficient right!

  5. 
      
apoorva.sn
pmurugaiyan
  1. Ship It!
  2. 
      
shuinvy
  1. Ship It!
  2. 
      
apoorva.sn
apoorva.sn
apoorva.sn
Review request changed

Status: Closed (submitted)

Loading...