Hi,

I have a question about passing parameters to PRTG. I want to access some data from the webpage of our company and write it in the form of channels with some values in PRTG. To enter the webpage, I have to login with my username and password. Now, I have passed them directly in the PhantomJS script, but I would like to pass them as parameters to PRTG, because then can anybody in my company access the Sensor with their own username and password. How can I do that? I tried it as follows: In my script, I defined the username and password as system.args[] and then tried to write it directly into the Parameters of the PRTG Sensor but it didn't work. I found something about placeholders but I don't understand it.

Best regards, Benjamin


Article Comments

Dear bciboci,

the input field for the program parameters allows placeholders which are documented here. This allows to take content of the parent device's credentials.

A PRTG user with write access can change the password, but not see it. You could use for example the Linux password if it is not used by sensors on the device, just to pass it to your script.

Please note someone with physical access to the probe could still install tools which read the parameters used by programs.


May, 2019 - Permalink

Hi,

thanks for the reply! Could you maybe give me an example how should I do this? Because I don't understand where do I have to write th\ placeholder and where the actual username and/or password. For now, the line that I have in the parametars is something like this: "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\Sensor2.js" Should it be "C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\Sensor2.js %linuxuser %linuxpassword" ?

Best Regards, Benjamin


May, 2019 - Permalink

Dear bciboci,

the Exe/Script sensor has a field "EXE/Script" where you select the script file from the list.

This setting is followed by the field "Parameters" where you can provide the parameter list for the script. For this field, placeholders like %linuxpassword get resolved by PRTG.

The %linuxpassword content is entered in the sensor's parent device, section "Credentials for Linux/Solaris/Mac OS (SSH/WBEM) Systems".


May, 2019 - Permalink

Hi, this is not actually what I need. What I need is the following: Suppouse I want to login to the webpage of my company and take a screenshot. I must do a login with my username and my password. But the programm should be accessible in the company. So, I won't use the username and password in my script, instead I will define system.args in the script, and then pass them in the command line like this: C:\Phantomjs\phantomjs-2.1.1-windows\My examples>phantomjs MyExample.js username password Here, username corresponds to system.args[1] and password to system.args[2] in my script. And PhantomJS recognizes this as username and password needed for the login. So, basically I would like to do the same in PRTG. And my question is, if it's possible to pass these argumens (username and password) in the field "Parameters".

Best regards, Benjamin


May, 2019 - Permalink

Dear bciboci,

the parameters field allows to enter strings. Further handling of that is the responsibly of the program called. The PRTG field is used like the command line (after you input the name of the executable file). So yes, you an enter parameters.

Is the question about using data entered into a PRTG device object, using a placeholder? Those are resolved to the corresponding content before the script is run with the parameters.


May, 2019 - Permalink

Hi, thanks for the reply and for the help! I had an error in my code (I forgot to write something), so now it's working just fine!

Best regards, Benjamin


May, 2019 - Permalink

Dear Benjamin,

thank you for the follow-up!


May, 2019 - Permalink