Jump to content

Alert When Agent Is Online 1.0.4

   (7 reviews)

1 Screenshot

About This File

The Internal Monitor "Notify When Agent is Online" watches machines with the "Notify When Online" computer EDF configured. It will send an alert as soon as it finds that the agent is offline. (The offline notice is skipped if the agent was already offline when notifications were first enabled.) When the agent comes online again another alert email will be sent and the EDF will be reset.

This monitor can be used to notify when a lost computer comes online, or when that machine that is only online in the office every few weeks is back.

To enable notifications for an agent, you simply put your email address into the "Notify When Online" EDF. You can enter multiple addresses separated by ";". The contents of the agent's "Comments" will be included in the email also. (Helpful to remember why you wanted to be alerted, or what instructions should be followed after receiving the alert.)

When the agent returns online, the Network Inventory and System Info are refreshed. The recovery email will include the following details:
The last check in was at @AgentCheckIn@.
Public IP Detected: %RouterAddress%
Internal IP: %LocalAddress%
System Uptime: %uptime%
Last Logged in User: %lastuser%

This bundle includes a Script+EDF XML, and a SQL file with the Internal Monitor.
To import the Script and EDF, select Tools -> Import -> XML Expansion. After import the script should appear in the "\Autofix Actions" folder.
To import the Internal Monitor, select Tools -> Import -> SQL File. The monitor should be imported AFTER the script bundle has already been added.
After importing, verify that a valid Alert Template is selected for the monitor. The Alert Template MUST have the "Run Script" action enabled without any script specified in the template. (The script is set on the monitor)

Read the Script Notes for advanced control over the number of times a notification will be triggered.


What's New in Version 1.0.4   See changelog

Released

  • 1.04
    • Update to handle if someone uses commas instead of ; because why not?
  • 1.03
    • Added support for multiple email addresses with single, repeated, or persistent alerting controllable on a per address basis.
    • Optimized the agent recovery data gathering process to be quicker.
    • Removed dependency on v_extradatacomputers table to prevent a "Build and View" error when the table is out of date. Added a call to rebuild the v_extradatacomputers table in the SQL import file to insure the new EDF is available right away.
    • Changed the SQL statement to update the monitor if it already exists instead of creating a second monitor.
  • Like 4
  • Thanks 9

User Feedback

Recommended Comments

Darren,

 

Would you please clarify what the name of the Alert Template Name this script would default the monitor to, or what it should be set as? On my internal monitor it appears to be using an Alert Template in the configuration called 'Veeam warning events'. 

 

Thanks,

Matt

Link to comment
Share on other sites

Hey Matt,

I can assist here, as I had a similar issue.

I had to create an alert template that was able to run scripts only (called it 'Run Script' as per Darren's suggestion).

This alert template then allows the script defined in the monitor to run, which fixed up our issues. 

There were also some slight modifications made to the original monitor to make it more 'live' rather than waiting on a table to rebuild.

Right now my monitor's configuration is this in the event you want to change it and test results. This is working well for us.

Identity Field: computers.name,(SELECT v_extradatacomputers.`Notify When Online` FROM v_extradatacomputers WHERE v_extradatacomputers.ComputerID=Computers.ComputerID) AS `Notify`

Additional Condition: Computers.ComputerID IN (SELECT extrafielddata.ID FROM extrafielddata WHERE ExtraFieldID IN (SELECT ID FROM extrafield WHERE `Name`='Notify When Online' AND Form=1) AND Value LIKE '%@%')

Link to comment
Share on other sites

I am trying to get this monitor configured correctly. We have version Automate v12 and I'm not sure if the Identity Field or the additional conditions need to be any different because of it. When I try to build and view the query it errors out.

Do you happen to know if this works out of the box with v12? It errors out when I leave the IF and AC the default or if I change them to the one suggested by "Jacobsa".

here is what I got:

 

Table to check: computer

Field to check: LastContact

Check condition: LessThan

Result: date_add(now(),interval -7 minute)

Identity Field: computers.name,(SELECT v_extradatacomputers.`Notify When Online` FROM v_extradatacomputers WHERE v_extradatacomputers.ComputerID=Computers.ComputerID) AS `Notify`

Additional Conditions: Computers.ComputerID IN (SELECT v_extradatacomputers.ComputerID FROM v_extradatacomputers WHERE v_extradatacomputers.`Notify When Online` LIKE '%@%')

 

Thanks,

Cory

Link to comment
Share on other sites

Hi Cgegg

I am in the same position as yourself, when I try to "Build and View Query" I get an SQL error also, I have checked the syntax multiple times against Jacobsa post but it does not seem to work.  Can you advise if you did get this working in the end?

Thank you

Lee

Link to comment
Share on other sites

leebaxter,

When I first created the monitor it was not working, but I just left it over night and the next day the monitor was working correctly. I'm not sure which function refreshed to get it working but I would imaging if you Refresh Searches, Do Group Refresh and restart the database agent it will probably start working. I was a little impatient when I originally posted.

Hope this helps.

Thanks,

Cory

Link to comment
Share on other sites

Hi Cory

Thank you for that, I have been doing a bit more digging this afternoon and it seems we have one of the views missing, I pasted in the SQL query into MySQL yog to get a more concise error and it came back with this, 

Query: v_extradatacomputers

Error Code: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'v_extradatacomputers' at line 1

After checking the views in the database we seem to have the view missing v_extradatacomputers in our database! so I am currently following up to see how to restore this.

Lee

Link to comment
Share on other sites

12 hours ago, leebaxter said:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'v_extradatacomputers' at line 1

After checking the views in the database we seem to have the view missing v_extradatacomputers in our database! so I am currently following up to see how to restore this.

The v_extradatacomputers reference is actually to a table, not a view. It is refreshed about twice an hour but is only rebuilt daily or perhaps weekly, meaning that new EDFs may take some time to appear there. 

#To rebuild the table (drop and rebuild the complete structure with all current computer EDFs as columns), run:
call v_ExtraData(1,'computers');

#To refresh the table (update the values for existing columns in the table), run:
call v_ExtraDataRefresh(1,'computers');

However, I have posted an update that no longer uses this table (avoids the build and view error, and is works immediately on live values) and also calls v_ExtraData for you to ensure the table is built correctly. The script should be the same, just download the new file and import the .SQL. It will automatically update the existing monitor for you!

 

Link to comment
Share on other sites

Hi Darren

Thank you very much for this update, I have updated the components and it seems to be working as expected.  Thank you very much for putting in the time to update it, it is very much appreciated.  This helps us hugely when our agents go offline for a long period of time and we can then use this to notify us if it comes back online while we are contacting the customers to find out whats happened to the machine.

Top marks!

Lee

  • Thanks 1
Link to comment
Share on other sites

Hi Michael

If you go to the System>General>Import, you have options to import "SQL File" and "XML Expansion", the .zip file contains both files to be imported.  If you do not have these then your permissions on your user account may need extra permissions added.

Hope that helps you.

Lee

Link to comment
Share on other sites

Hello all, I actually used this as a great way to do PC management in having this alert me when a user powers on a spare machine which can help me assign the proper contacts to which machine, I have it going to my dispatch board which we then have a procedure to take the spare out of a spare location and put it in the right location. I am using the no check-in within X days to help me determine if a machine may be a spare. I removed several lines to only alert if the machine powers on and not to create "white noise" on the dispatch board. Great learning experience working on it though. - Let me know if you wish to learn more on how I did it, I will attach a flowchart (draw.io) if you wish to look at my thinking process

Monitor flow(1).xml

Link to comment
Share on other sites

Hi There,

I notice that after a computer comes 'online' and trips the monitor and alert, the Extra Data Field gets blanked out. How would I go about changing this so we continue to get alerted if a computer comes online? (Example is if a computer comes online rarely and only for a few minutes, if we miss it the first time we'd like to continue getting alerted).

Thanks for any help you can provide.

Link to comment
Share on other sites

1 hour ago, 365Geek said:

I notice that after a computer comes 'online' and trips the monitor and alert, the Extra Data Field gets blanked out. How would I go about changing this so we continue to get alerted if a computer comes online? (Example is if a computer comes online rarely and only for a few minutes, if we miss it the first time we'd like to continue getting alerted).

From the description:
Read the Script Notes for advanced control over the number of times a notification will be triggered.

Let me know if the script notes don't explain it correctly.

Link to comment
Share on other sites

I seem to be having issues with this internal monitor. I put my email into the EDR, but I do not receive any emails. It also does not clear my email after a reboot, It stays in the EDR. I'm not sure why this is happening, but so far nothing happens when I reboot the machine. Any clue anyone? Could anyone provide a screen shot of a custom alert template I could use. I set one up, but I am not sure if its setup correctly.

Link to comment
Share on other sites

On 7/10/2018 at 4:22 PM, DarrenWhite99 said:

From the description:
Read the Script Notes for advanced control over the number of times a notification will be triggered.

Let me know if the script notes don't explain it correctly.

Hey Darren,

 

Trying to figure this out myself and not sure what field to change. Can you please clarify what needs to be adjusted? I just want to increase it so if it emails 3 times than it clears itself. Thank you. So far, the script has been running fine otherwise.

Link to comment
Share on other sites

2 hours ago, droth1187 said:

Trying to figure this out myself and not sure what field to change. Can you please clarify what needs to be adjusted? I just want to increase it so if it emails 3 times than it clears itself. Thank you. So far, the script has been running fine otherwise.

Change nothing in the monitor. The function is entirely controlled by the Extra Data Field where you put your address in.

Per the Script Notes:

Multiple email addresses are supported and must be separated by ";".
Email addresses will be removed once the recovery notification has been sent as follows:
Email addresses ending with "!" will have one "!" character removed each time the agent recovers. This can be used to preserve the notification for multiple offline/online cycles.
Email addresses ending with "*" will not be removed, so the agent status will be tracked indefinitely.
Email addresses without a trailing "!" or "*" will be removed after a single notification.

So, to email yourself three times, you would enter your email address as "email@domain.com!!".
The first time it emails, it will update the address to be "email@domain.com!".
The second time it emails, it will update the address to be "email@domain.com".
The third time it emails, it will remove the address "email@domain.com".

This can be done independently with multiple addresses on a single agent, so you could enter:
"email1time@domain.com;email2extratimes@domain.com!!;emailcontinously@domain.com*"
It will loop over each address to send the recovery email and then will remove the address (if no ! or * found), trim off one "!" (if you used !), or leave the address as is (if you used *).

Link to comment
Share on other sites

Hi Darren,

Thank you for your work on this monitor. It was my first time setting up a new monitor and after some false starts I got it running.

You mentioned in the description that the contents of the agent's comments can be emailed.

Where would I enter a comment against an agent?

Thanks,

Kevin

 

Link to comment
Share on other sites

Hi @DarrenWhite99

Thanks for this script, if we wanted to run a script when the device became online instead of sending the email (or in addition), how would we go about that?

Would I just put the call to my script after line 56 in the Else section?

 

The reason we are wanting to do this is we are having problems getting AntiVirus onto certain PC's (ones without domains), and these PC's always seem to be off. We like this script, but when we get the Online email, we'd like to run our install AV scrips.

Thanks again,

Steve.

Edited by EssentialSteve
Link to comment
Share on other sites

Getting this error when opening the script, thoughts? I would try and edit but it won't load the script because of this.

image.png.2df15fc80a671e3d5b6a033a298c271d.png

Link to comment
Share on other sites

On 1/10/2020 at 7:50 PM, ptomis said:

Getting this error when opening the script, thoughts? I would try and edit but it won't load the script because of this.

image.png.2df15fc80a671e3d5b6a033a298c271d.png

Trying to import this for the first time and getting this as well. Was hoping that someone would be able to point me in the right direction for this. This would be my first time importing a Script/SQL query 

Thanks to @DarrenWhite99 for making the script and any that help me going forward. 

 

Edit:  I didn't realize that there was a different place for this question with an answer: 

 

Edited by envmatt
Link to comment
Share on other sites

This is a nice feature. I had it working but seem to be missing something now. The history tab of the monitor shows "Ignored: No Alert Action set." when my test PC came back online. My alert template is a new one I created just for this, and its only action is script for warning and error, with no script selected. I don't understand how the script is called. I see no reference to it in the monitor. I was hoping someone can shed some light on this.

Link to comment
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
Add a comment...

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