What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Advanced EXE/Script Sensor PhantomJS command line parameters

Votes:

0

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

command-line custom-sensor parameters

Created on May 16, 2019 8:36:46 AM



7 Replies

Votes:

0

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.

Created on May 16, 2019 12:58:03 PM by  Arne Seifert [Paessler Support]



Votes:

0

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

Created on May 16, 2019 1:46:37 PM



Votes:

0

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".

Created on May 17, 2019 1:00:08 PM by  Arne Seifert [Paessler Support]



Votes:

0

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

Created on May 21, 2019 1:43:54 PM



Votes:

0

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.

Created on May 22, 2019 12:03:50 PM by  Arne Seifert [Paessler Support]



Votes:

0

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

Created on May 22, 2019 5:39:34 PM



Votes:

0

Dear Benjamin,

thank you for the follow-up!

Created on May 23, 2019 3:39:26 PM by  Arne Seifert [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.