Import a device with API in snmp v3

Hello all,

I’m new on LibreNMS and I just have a little problem with the API to import devices in snmpv3

I check the documentation here : http://docs.librenms.org/API/API-Docs/#api-route-11

I can list all the devices with the API but i can’t import device in snmpv3.

I tried that :
curl --insecure --negotiate -u: -H ‘X-Auth-Token: a7d7262eea9fef294ddcebeb437baaaa’ ‘https://librenms.fr/api/v0/devices’ -X POST -d ‘{“hostname”: “10.0.0.1”, “version”: “v3”, “authlevel”: “AuthPriv”, “authname”: “USER_v3”, “authpass”: “AUTH_SHA”, “authalgo”: “SHA”, “cryptopass”: “password_AES”, “cryptoalgo”: “AES”}’ -vvv

ad i have that response :
[…]
{
“status”: “error”,
“message”: “Could not connect, please check the snmp details and snmp reachability”

  • Closing connection 0
    }

when i add the same device in the web interface, it works :wink:

Any suggestion with the CLI?

Thanks all

I’ve just had the same problem, and it’s got to do with the “authlevel” key:

“authlevel”: “AuthPriv”

After ripping the code apart I discovered that this is case sensitive… so “authlevel”: “authPriv” will work, i.e. make it needs to be camel-cased with a lowercase “a”.

2 Likes

Thank :slight_smile: . It just need to be change in the docs :
https://docs.librenms.org/#API/Devices/#add_device