Jump to content

Triggering Automation workflows on startup and schedule


simong

Recommended Posts

Hi All

I wanted to share my experience with workflows, in the hope that someone else can benefit, or if there is a better way to do things I am all ears!

In the sales/onboarding process I noticed how amazing and powerful the automation engine was, yet restrictive it was that I wasn't able to trigger an automation workflow myself (on schedule, or other action like restart). Also the management of Tags wasn't available from tasks/scripts. I needed a way to bring those two elements together.

I 'wrote' a program using Visual Studio that does nothing other than waits a period of time, and then stops. Code is attached.

I am creating a scheduled task that runs on every server, and ~2 minutes after start-up it runs this application.  This task is deployed via powershell/Tasks. The application does nothing for 20 seconds and then stops.  Pulseway is configured to look for that process, and it triggers the workflow. 

For me this was a missing piece in using the application for the following use cases:

  • Rebooting Servers over night.
    1. Our customer's trade from 18-21 hours a day.
    2. We need the ability to schedule reboots in the early hours of the morning.
    3. We created a Tag called 'Reboot Tomorrow'.
    4. There is a Task running at 6am which will reboot any servers that have this tag.
    5. Once the server has been restarted, this automation runs and removes the Tag (so it doesn't reboot the next morning)
  •  Trigger a Task that will update customer config
    1. We are a software vendor that use Pulseway at ~50 sites.
    2. Every site is nearly identical, and within the Database there are config items that we need to use to report/filter on. 
      • e.g. Customer name/ active Third Party integrations /etc
    3. We use a powershell script to query that relevant Data, write it to a custom property.
    4. Using that custom property as a filter we can now Enable/Disable Tags which flow into scopes/policies/etc.
    5. being able to Trigger this action on a schedule means we know all the Tags/data is up to date.

I know there will be more use cases as I continue to roll out Pulseway. We have installed on ~80 of our 250 devices that we manage. 

If you do this yourself, don't set the process timeout too low. I found when it was set to 5 seconds Pulseway didn't send the notification reliably (I assume there is a polling interval < 5 seconds). 

I am sure there is a better way to write that program (this was my first attempt). Especially using Timers rather than sleep, and also to take the timeout as an argument rather than hard coded.

I hope this information is useful to at lease someone!! If you have any ideas on how else this could be utilised please let me know, I am at the very start of my Pulseway journey.

Cheers

Simon

waitprogram.png

Edited by simong
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...