Here is the scenario, I have synthetic script for user login transaction created using selenium and configured it in Jenkins tool. Jenkins executes this script every 10 minutes and if user login transaction fails , it sends an email alert to the team saying script failed which means users are unable to login to the application.

Once I receive email I would manually login to the application server and restart it to fix the login failures.

Now I want to automate this process. Is it possible to send this email alert from Jenkins to PRTG so that upon receiving this email alert PRTG would restart the windows application server automatically?


Article Comments

Hi there,

You can for example use the IMAP Sensor and enable Process Email Content to filter for the mail of interest. Enable the Sensor Behavior > Set to error > If... to set the sensor into an error state as soon as the email arrives.

Afterwards, you will need to create a script to restart the service on the remote machine. Please have a look at This Article for some ideas and examples.

Finally, create a new notification and choose the script for the Execute EXE/Script option and add a new State Trigger to the IMAP sensor.

Best regards


Jul, 2015 - Permalink

Hello ,

Thanks for the reply. I understand that using IMAP sensor I can let the PRTG know to look for specific email with specific subject if they match it should restart the target remote server by using the script. So here how do I send Jenkins alert email to PRTG ? Do you have any detail steps to achieve this. Appreciate your reply


Jul, 2015 - Permalink

Hello Felix

Thanks for the reply. I'm newbie to PRTG and would like to implement this tool in our network. Could you let me know the step by step how to achieve this. I understand that first we need to create a IMAP sensor for the email account. I'm using gmail to receive the alerts emails. Once I set up IMAP sensor then I have to set up notification and choose the script for the Execute EXE/Script option . Sounds like I understood but when trying to set up I'm confused.


Jul, 2015 - Permalink

Hi,

What exactly did you already configure? Does the IMAP sensor work and did you enable the Sensor Behavior > Set to error > If... option?


Jul, 2015 - Permalink

Yes, I successfully configured IMAP sensor and it's working . I created a restart vb script and placed inside EXE folder and configured this restart script under notification trigger section. but when the status becomes down ,the restart vb script is not getting triggered.

In the notification settings I have given target restart machine credentials as well. PRTG core server and target Machine sever both are windows 2012 R2.

I believe custom restart script is the culprit here. Could you provide me a custom restart script I will adapt it to our requirements and use it.


Jul, 2015 - Permalink

Hi,

So you already managed to perform most of the required steps. The next step will be to execute the script manually from your PRTG host. If this works, check the

Logs > System Events > Notifications log files and see if the script is triggered successfully. You might also enter credentials for an administrative user in the notification settings, as the default System Account might not have sufficient rights to execute the script.

Best regards


Jul, 2015 - Permalink

I have given 2 notifcation triggers 1) to send an email 2) restart the server.

In the notification logs , I see " Cannot connect to MX servers for address *@gmail.com.


Jul, 2015 - Permalink

Hi, I am kind of confused as I would not expect Cannot connect to MX servers at this point, please check if the option Execute EXE/Script is enabled and that the Send Email option is not marked. Did you already try to execute the script manually?


Jul, 2015 - Permalink

we got it fixed. Thanks for your inputs.


Jul, 2015 - Permalink