Habitat Announce Maintenance Tool

Detailed descriptions and imagery explaining each tool available inside Habitat. Feel free to post feature requests under each tools forum post if you would like to see something added or changed in the tools.
chris10385
Posts: 19
Joined: Tue May 23, 2023 4:10 pm

Re: Habitat Announce Maintenance Tool

Post by chris10385 »

I updated Habitat to 1.0.1.34 and still don't get anything to return on this SQL query. I tried to send the announcement at 8am but it didnt go out and no script was scheduled. We recently migrated to the cloud... Think maybe a server restart might help?
sql 5.png
sql 5.png (101.08 KiB) Viewed 77578 times

chris10385
Posts: 19
Joined: Tue May 23, 2023 4:10 pm

Re: Habitat Announce Maintenance Tool

Post by chris10385 »

Same result after having CW restart our server. I even tried to change the Day "Number" of the week tried 1-7 and all came back with no result.
Attachments
sql 6.png
sql 6.png (99.81 KiB) Viewed 77576 times

User avatar
Cubert
Posts: 2450
Joined: Tue Dec 29, 2015 7:57 pm
8
Contact:

Re: Habitat Announce Maintenance Tool

Post by Cubert »

Chris,

Lets see if you have all the pieces set.

#1 Make sure settings are all valid and set here in main control

Screenshot 2023-05-30 091515.png
Screenshot 2023-05-30 091515.png (114.04 KiB) Viewed 77564 times



#2 Make sure EDF for client is enabled

Screenshot 2023-05-30 091651.png
Screenshot 2023-05-30 091651.png (32.3 KiB) Viewed 77564 times


#3 Make sure you have a patch policy with a Microsoft Update policy applied.

Screenshot 2023-05-30 091824.png
Screenshot 2023-05-30 091824.png (86.45 KiB) Viewed 77564 times


#4 Make sure we have members assigned to policy

Screenshot 2023-05-30 092041.png
Screenshot 2023-05-30 092041.png (174.53 KiB) Viewed 77564 times


#5 Test your SQL query.
In my case Friday is day "6" and my policy name is Patch Install - Workstations

Screenshot 2023-05-30 092256.png
Screenshot 2023-05-30 092256.png (72.58 KiB) Viewed 77564 times

User avatar
Cubert
Posts: 2450
Joined: Tue Dec 29, 2015 7:57 pm
8
Contact:

Re: Habitat Announce Maintenance Tool

Post by Cubert »

Now just for clarifications.

We do a little math to create the day value passed to SQL query.

Every day we run a function where we test for current day value, then query to see if the "same day" setting is set in master config.

If Same Day setting is checked then we take Day value as provided by function (what ever today is). If Same Day is unchecked then we take todays value and add a 1 to it. If that value turns to 8 we change it to 0. This creates a revolving 0-7 and is always 1 day ahead of today.

This allows you to announce on the day of patching if patching starts after user starts day. Otherwise if Patching is set for 12AM + then you need to announce the day before the patching service fires off.

In our example above patching windows starts at 3AM on Friday.

If we run "Same Day" the the user gets announcement at 12 PM on Friday that Patching happened at 3 AM. You need to notify on Thursday at noon for Friday morning at 3am. In this case you would uncheck same day as you want it to announce the day before(on Thursday).

The Query above should work only on Fridays because we set Same Day checkbox. This means as we have it currently all users of JanusTechInc will get notified after the update takes place. (This should be corrected) I placed this here for the example so unchecking Same Day would be the correct way to use this tool in the case I have above.

chris10385
Posts: 19
Joined: Tue May 23, 2023 4:10 pm

Re: Habitat Announce Maintenance Tool

Post by chris10385 »

Hi Cubert. I tried again and getting the same result. I also tried the query with and without the {} infront and back of the group name and day number. I set patching for our test group for tonight at 11pm and chose the same day option.
hab 1.png
hab 1.png (32.71 KiB) Viewed 77560 times
hab 2.png
hab 2.png (80.56 KiB) Viewed 77560 times
hab 3.png
hab 3.png (178.8 KiB) Viewed 77560 times
hab 4.png
hab 4.png (125.39 KiB) Viewed 77560 times
hab 5.png
hab 5.png (80.36 KiB) Viewed 77560 times
hab 6.png
hab 6.png (83.92 KiB) Viewed 77560 times
hab 7.png
hab 7.png (84.2 KiB) Viewed 77560 times
hab 8.png
hab 8.png (83.89 KiB) Viewed 77560 times
hab 9.png
hab 9.png (27.3 KiB) Viewed 77560 times
hab 10.png
hab 10.png (24.19 KiB) Viewed 77560 times

User avatar
Cubert
Posts: 2450
Joined: Tue Dec 29, 2015 7:57 pm
8
Contact:

Re: Habitat Announce Maintenance Tool

Post by Cubert »

What do you get if you remove "and b.day='0' " from your SQL Query?

User avatar
Cubert
Posts: 2450
Joined: Tue Dec 29, 2015 7:57 pm
8
Contact:

Re: Habitat Announce Maintenance Tool

Post by Cubert »

For some reason you are not matching the query. There are only 2 matches done, day and name.
Screenshot 2023-05-30 125943.png
Screenshot 2023-05-30 125943.png (73.41 KiB) Viewed 77554 times


Try this query, does it return your agent ID's

Code: Select all

SELECT *  FROM v_dv_patchgroupassignment a LEFT JOIN installsoftwarepolicies b on a.PatchingGroupInstallPolicy = b.Name

User avatar
Cubert
Posts: 2450
Joined: Tue Dec 29, 2015 7:57 pm
8
Contact:

Re: Habitat Announce Maintenance Tool

Post by Cubert »

Post the query return data from that last query I posted.

What I am looking for is these 2 columns, Is there any data in theses columns for any of the agent IDs in your DoC group?


Screenshot 2023-05-30 130624.png
Screenshot 2023-05-30 130624.png (40.24 KiB) Viewed 77552 times

User avatar
Cubert
Posts: 2450
Joined: Tue Dec 29, 2015 7:57 pm
8
Contact:

Re: Habitat Announce Maintenance Tool

Post by Cubert »

Also lets look at the name your using.

Patch Install - Test Workstations (DoD)

Try modifying the SQL QUERY to look for name "LIKE" and see if you maybe get a different name. I.E an extra space or some char that was unexpected.

Code: Select all

SELECT a.ComputerID, b.day, b.starttime, b.CustomAction  FROM v_dv_patchgroupassignment a 
LEFT JOIN installsoftwarepolicies b on a.PatchingGroupInstallPolicy = b.Name 
WHERE PatchingGroupName LIKE '%Workstations%(DoD)%'  
and ComputerID IN (Select a.ComputerID FROM computers a 
WHERE a.LastContact > date_add(now(),interval -5 minute) and a.OS LIKE '%Windows%' 
and a.OS NOT LIKE '%Server%' and a.ClientID IN (SELECT ID FROM extrafielddata 
WHERE ExtraFieldID = (SELECT ID FROM extrafield WHERE `Name` = 'Enable Habitat Announce Maintenance') 
and `Value` = '1'))

chris10385
Posts: 19
Joined: Tue May 23, 2023 4:10 pm

Re: Habitat Announce Maintenance Tool

Post by chris10385 »

Cubert wrote: Tue May 30, 2023 5:07 pm Post the query return data from that last query I posted.

What I am looking for is these 2 columns, Is there any data in theses columns for any of the agent IDs in your DoC group?



Screenshot 2023-05-30 130624.png
I changed it from the 30th of the month to the 31st of the month (today) and re-ran the query and the day column still shows 8.
hab sql 2.png
hab sql 2.png (79.46 KiB) Viewed 77536 times

Post Reply

Return to “Habitat Documentation Forum”