Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error C# GetDynamicsSensorParamters pythonscript #376

Open
2 tasks done
sebastien-salle opened this issue Jan 4, 2024 · 20 comments
Open
2 tasks done

Error C# GetDynamicsSensorParamters pythonscript #376

sebastien-salle opened this issue Jan 4, 2024 · 20 comments
Labels
question Questions raised by people who don't know how to program or read the wiki :P

Comments

@sebastien-salle
Copy link

What's going on?

Hello

I have an error when I try to retrieve the dynamic parameters of the sensor Advanced Python script.

erreur python

Do you have an idea ?

Thanks

Due Dilligance

  • It wasn't covered by the wiki, I swear!
  • I have tried doing some basic research on this issue but haven't been able to come up with anything. Please help!
@sebastien-salle sebastien-salle added the question Questions raised by people who don't know how to program or read the wiki :P label Jan 4, 2024
@lordmilko
Copy link
Owner

If you use the GetSensorTypes method, do you see the pythonscript sensor listed?

@sebastien-salle
Copy link
Author

I tried also but I have the same problem

@lordmilko
Copy link
Owner

What does that mean? What happens when you call the GetSensorTypes method?

@sebastien-salle
Copy link
Author

image

Exactly the same error

@sebastien-salle
Copy link
Author

sorry GetSensorType is functional I misread the answer

@lordmilko
Copy link
Owner

You are calling GetSensorTargets. If you call GetSensorTypes it will list all available types, and we'll be able to see if the pythonscript sensor type is in the list

@sebastien-salle
Copy link
Author

yes i see pythonscript with GetSensorTypes

@lordmilko
Copy link
Owner

Can you enable request and response logging and provide the resulting output?

There will be a lot of output, you may need to obfuscate any personal information such as your server address, username and passhash

@sebastien-salle
Copy link
Author

image
i have an error with logverbose

@lordmilko
Copy link
Owner

There was a typo on the wiki article; there should be a += after LogVerbose

@sebastien-salle
Copy link
Author

Exception levée : 'System.InvalidOperationException' dans PrtgAPI.dll
Une exception non gérée du type 'System.InvalidOperationException' s'est produite dans PrtgAPI.dll
Cannot process query for sensor type 'pythonscript': sensor type 'pythonscript' is not valid.

@sebastien-salle
Copy link
Author

I looked pythonscript is present

@lordmilko
Copy link
Owner

I can't see any reason this would be failing

What happens when you ask for the parameters of a different sensor type, such as exexml?

@sebastien-salle
Copy link
Author

same error

@lordmilko
Copy link
Owner

PrtgAPI is source link enabled. Are you able to change the following two settings to enable SourceLink and then try stepping into the call to GetDynamicSensorParameters?

image

image

@lordmilko
Copy link
Owner

lordmilko commented Jan 4, 2024

If sourcelink works, you should find the exception is thrown inside RequestParser.ValidateAddSensorQueryTarget, where you'll be able to inspect the contents of the types parameter, and compare it against parameters.OriginalType. There should be at least one type in the types list whose Id is pythonscript. There could be some weird formatting or something that is throwing things off

@sebastien-salle
Copy link
Author

image

@lordmilko
Copy link
Owner

Yes, that's where the exception is thrown. We should be able to work backwards from here to see why it failed to find a matching sensor type. If you inspect the types parameter, do any of the items have an Id whose value is pythonscript?

@sebastien-salle
Copy link
Author

yes with var types = client.GetSensorTypes().Where(t => t.Id.Contains("python") || t.Name.Contains("python")); pythonscript exist and tthe equivalent command in powershell works

@lordmilko
Copy link
Owner

We need to look at what's happening inside of PrtgAPI to understand why this isn't working. Thus, we need to inspect the types parameter that was passed to the ValidateAddSensorQueryTarget method as per the screenshot above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions raised by people who don't know how to program or read the wiki :P
Projects
None yet
Development

No branches or pull requests

2 participants