The Problem I'm trying to solve
We needed to update the SAP GUI application, I don't have that many machines under my SMA, nevertheless, sending a 320mb MI to 720 machines on a shared 100mbps WAN with an office with almost 400 people is kinda hard.
I ended up deploying normally (with a lot of baby sitting), but that gave me an idea.
SAP GUI is a critical application to a lot of users, but not everyone. And because I'm deploying it to everyone, I had to alert, ask the user to restart the machine, etc, to well... everyone, even those that don't even use it.
What if, I could meter SAP GUI usage and deploy first to my heavy users, with the alerts and all, and on a second wave deploy silently to the other machines?
How to Solve the problem
I ended up making a SQL query returning the machines based on the metering data, then is just as easy as creating a new label! Se the steps below:
Go to Home > Label Management > Smart Labels > Choose Action > Create New > Device Smart Label
Just leave the default search criteria, we won't be using it.
Give the new label a name and save
Now find and open that label in Home > Label Management > Smart Label
Click on Edit SQL and paste the following query:
SELECT MACHINE.NAME AS SYSTEM_NAME,
MACHINE.SYSTEM_DESCRIPTION,
MACHINE.IP,
MACHINE.MAC,
MACHINE.ID as TOPIC_ID,
MAX(SAM_METER_DATA.SECONDS_USED) AS "SECONDS USED",
MAX(SAM_METER_DATA.END) AS "LAST ACCESS"
FROM MACHINE
LEFT JOIN SAM_METER_DATA
ON MACHINE.ID = SAM_METER_DATA.MACHINE_ID
WHERE SAM_METER_DATA.TITLED_APPLICATION_ID = "APP20020"
GROUP BY TOPIC_ID
HAVING MAX(SAM_METER_DATA.SECONDS_USED) < 1000
OR MAX(SAM_METER_DATA.END) < now() - INTERVAL 10 DAY
Change the APP ID with the ID that you are metering
WHERE SAM_METER_DATA.TITLED_APPLICATION_ID = "APP20020"
You can get this ID by going to Inventory > Software Catalog. Find and open the Software information and look at the URL:
[...]sam_detail_titled.php?ID=APP20020&IS_MOBILE=0[...]
The filtering criteria is going to be up to you, I'm filtering for machines that have more than 1000 seconds used OR had the software opened in the last 10 days, just change the numbers, delete one or the other, change the OR to an AND, etc. Whatever fits your specific case better.
GROUP BY TOPIC_ID
HAVING MAX(SAM_METER_DATA.SECONDS_USED) < 1000
OR MAX(SAM_METER_DATA.END) < now() - INTERVAL 10 DAY
That's it! Now you can use that label to deploy or patch metered software by use!
Comments