cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
493
Views
0
Helpful
2
Replies
Highlighted
Beginner

Prime Infrastructure Connection Issue with API

Hi ,

     I have an issue with API of Cisco Prime Infrastructure.

     I will try to explain at my best the problem I have :

     First of all , I need to monitor all devices that are connected to the Prime infrastructure in proactive.

     For that I have a script, this will run every 5 minutes to get information.

     The first Section connect to the API and get all devices with status Unreachable.

     The Second section connect to the API and get all new events that contain "is down" into description

     The Third section connect to the API and get all new events that contain "is up" into description.

     This means I have 3 connections every 5 minutes to the API.

     if in the events section they have more than 100 new events, then to know how many connection will be made we need to take the number of new events divided by 100.

     Ex.: 450 new events will make 5 connections.

     When I start the script everything goes well. But after 30 minutes when I try to connect to the API, I receive this error :

     The remote server returned an error: (401) Unauthorized

Is anyone can help me with this issue?

Thanks you for help in advance

Everyone's tags (2)
2 REPLIES 2
Highlighted
Beginner

Re: Prime Infrastructure Connection Issue with API

Hi

you need to add a connection close to your http request.  This not well explained in the Cisco docs.

And you only run into this issue when you issue a lot of requests one after the other, because you are creating new sessions each time.

add this to your http request header

'Connection':'Close'

regards

Arne

Highlighted
Beginner

Re: Prime Infrastructure Connection Issue with API

Hi Arne,

     Thanks you for your help.

     I just change my request by HttpWebRequest in Asp.net

     And I add KeepAlive = false

And now everything work fine.

Thanks you

Content for Community-Ad
Cisco Community July 2020 Spotlight Award Winners
This widget could not be displayed.