Jump to content
chainboost

Custom script that bases its action if the agent status is online or offline. How can I achieve this?

Recommended Posts

We have a monitor that checks if a device has had contact with Automate. If it doesn't have contact after 24 hours it will trigger a script.

This script will update an extra data field on the player to 'Offline' and then send us an e-mail. Because this monitor runs every hour and some players are offline for longer we came up with a way to eliminate double e-mails from the same player by getting the value from the extra data field.

I'm stuck now at the part where I need to check if the agent status is offline or online. I can't seem to find a variable for it or some other way to get the information I want.

I'm no SQL hero but could I perhaps use this: 'Computer.LabTech.IsOnline' with some sort of SQL statement to get the value of offline or online and if so, can someone show me how?

 

Edited by chainboost
Add tags

Share this post


Link to post
Share on other sites

@chainboost you'll need to use the LastContactTime from the Computers table by and compare it to current time to see if it contacted labtech within the last 5 minutes (which is the standard legacy method for checking a computer is online). Alternatively you can use the heartbeat which is how the newer online/offline checks are done.

Share this post


Link to post
Share on other sites
20 hours ago, MGreen said:

@chainboost you'll need to use the LastContactTime from the Computers table by and compare it to current time to see if it contacted labtech within the last 5 minutes (which is the standard legacy method for checking a computer is online). Alternatively you can use the heartbeat which is how the newer online/offline checks are done.

@MGreen Thank you for replying!

Is there some sort of cheat sheet / overview of how I should structure the SQL statement and how ConnectWise calls them?

Share this post


Link to post
Share on other sites

you can look at the existing offline internal monitors which uses the exact sql query to check for if an agent is online or offline. You will need to learn SQL and fast if you're going to be a successful Automate Admin. Its a significant part of the power and flexibility of Automate.

Share this post


Link to post
Share on other sites
On 10/18/2019 at 6:40 PM, MGreen said:

you can look at the existing offline internal monitors which uses the exact sql query to check for if an agent is online or offline. You will need to learn SQL and fast if you're going to be a successful Automate Admin. Its a significant part of the power and flexibility of Automate.

Thank you for this! Will look at it!

Share this post


Link to post
Share on other sites
On 10/21/2019 at 4:53 PM, DarrenWhite99 said:

I have a scriptlet in this bundle that does just that. 

 

Looks cool, will take a look at it, thnx!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...