Greetings,
I am trying to automate some vRNi tasks like monitoring state of services.
Something similar to: show-service-status from CLI
But I am trying to do this using the REST API, something like : /api/ni/entieis/services
I am first trying to authenticate using a curl command:
url -d 'username=user_name@local&password=Secret_pwd&domain={domain_type=local}&submit=Login' --dump-header headershttps://$vrni_ip/api/ni/auth-token
Any tips and direction will be greatly appreciated :- )
OaO
Hi,
Have a look at the public API Documentation that's built into the platform. It provides you with an overview and examples of all available API calls, including authentication:
You'll see that you're using the wrong endpoint, as it's /api/ni/auth/token instead of auth-token, plus that you should provide the credentials in the body, not parameters.
Also, if you're into PowerShell, I'd encourage you to look into PowervRNI (link below), it has a lot of cmdlets already using the API, so you don't have to bother.
Last also, be aware that the /api/ni/entities/services does not what you what it to do. It lists the tcp/udp/etc services that are in vRNI used for microsegmentation planning, it's not the status of the services within vRNI. There's currently no API call to get the status of the vRNI services.
Hi,
Have a look at the public API Documentation that's built into the platform. It provides you with an overview and examples of all available API calls, including authentication:
You'll see that you're using the wrong endpoint, as it's /api/ni/auth/token instead of auth-token, plus that you should provide the credentials in the body, not parameters.
Also, if you're into PowerShell, I'd encourage you to look into PowervRNI (link below), it has a lot of cmdlets already using the API, so you don't have to bother.
Last also, be aware that the /api/ni/entities/services does not what you what it to do. It lists the tcp/udp/etc services that are in vRNI used for microsegmentation planning, it's not the status of the services within vRNI. There's currently no API call to get the status of the vRNI services.
Thank you @smitmartijn for pointing me in the right direction. I will take a close look at the API documentation and PowervRNI. I will explore using ssh to query service status.
Regards, Oscar.
i built something to monitor this via SSH and send an email if the services are "not running"
Check out https://vman.ch/monitoring-vrni-services-using-a-powershell-script-and-posh-ssh/