PluginsOCSInventory-NG / lastpublicip

Retrieve last public from agent based on ipinfo.io website
GNU General Public License v2.0
1 stars 8 forks source link

output is not a valid XML document #6

Open jorensanbar opened 8 months ago

jorensanbar commented 8 months ago

ERROR *** EXECUTABLE PLUGIN => Executable plugin <C:\Program Files\OCS Inventory Agent\plugins\lastpublic.ps1> output is not a valid XML document.

AGENT => Running OCS Inventory Agent Version 2.10.1.0 AGENT => Using OCS Inventory FrameWork Version 2.10.1.0

XML Document:

Invoke-RestMethod : { "status": 429, "error": { "title": "Rate limit exceeded", "message": "You've hit the daily limit for the unauthenticated API. Create an API access token by signing up to get 50k req/month." }}En C:\Program Files\OCS Inventory Agent\plugins\lastpublic.ps1: 5 Car cter: 11+ $myjson = Invoke-RestMethod -Uri https://www.ipinfo.io/json+ ~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc eption + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

gillesdubois commented 8 months ago

Hi,

We use https://www.ipinfo.io/json to get the public IP. It seems there is a API call limit that you have reached for your IP.

How many agents are using this script ?

Regards, Gilles DUBOIS.

jorensanbar commented 8 months ago

Hello!

Only 1 agent, since it is the first configuration we made of OCS.

But we already detected what the error is.

If the WWW is included in the URI, then the IP output is made from Google servers, so this is the IP Limit Reached. imagen

For the local ISP exit to be used, the URI does not have to contain the WWW:

imagen

With just that small change, there is no more crash and 429 error.