/build/static/layout/Breadcrumb_cap_w.png

Patches in a Label Report

I have a great report that runs once a week and shows me a list of devices and displays the missing patch counts for each.   Unfortunately this reports on all patches and not the patches I've got setup in a smart label.  How can I modify this existing script to only display the count of missing patches that are in a specific patch label label.    Thanks for any assistance....  Here is the script:

SELECT M.NAME AS MACHINE_NAME,
USER_NAME,
OS_NAME AS OS_Name,
SUM(MS.STATUS='PATCHED') AS PATCHED,
SUM(MS.STATUS='NOTPATCHED') AS NOT_PATCHED,
ROUND((SUM(MS.STATUS='PATCHED')/(SUM(MS.STATUS='PATCHED')
+SUM(MS.STATUS='NOTPATCHED')))*100,0) AS PERCENT_PATCHED
FROM PATCHLINK_MACHINE_STATUS MS
JOIN KBSYS.PATCHLINK_PATCH PP ON (PP.UID = MS.PATCHUID)
JOIN PATCHLINK_PATCH_STATUS PPS ON (PPS.PATCHUID = PP.UID)
JOIN MACHINE M ON (M.ID = MS.MACHINE_ID)
JOIN MACHINE_LABEL_JT ML ON (M.ID = ML.MACHINE_ID)
JOIN LABEL L ON (ML.LABEL_ID = L.ID)
WHERE PP.IMPACTID = 'Recommended'
AND PPS.STATUS = 0
AND PP.IS_SUPERCEDED = 0
GROUP BY M.NAME
ORDER BY NOT_Patched DESC, M.NAME

1 Comment   [ + ] Show comment
  • I like this report. I'd love to see it isolated to specific Labels for reporting on as well. That way you can have several for different areas that you need reports on. - DaveMT 6 years ago

Answers (1)

Posted by: chucksteel 6 years ago
Red Belt
2
Here is what I came up with:
SELECT M.NAME AS MACHINE_NAME,
USER_NAME, 
OS_NAME AS OS_Name,
SUM(MS.STATUS='PATCHED') AS PATCHED,
SUM(MS.STATUS='NOTPATCHED') AS NOT_PATCHED,
ROUND((SUM(MS.STATUS='PATCHED')/(SUM(MS.STATUS='PATCHED')
+SUM(MS.STATUS='NOTPATCHED')))*100,0) AS PERCENT_PATCHED
FROM PATCHLINK_MACHINE_STATUS MS
JOIN KBSYS.PATCHLINK_PATCH PP ON (PP.UID = MS.PATCHUID)
JOIN PATCHLINK_PATCH_STATUS PPS ON (PPS.PATCHUID = PP.UID)
JOIN MACHINE M ON (M.ID = MS.MACHINE_ID)
JOIN MACHINE_LABEL_JT ML ON (M.ID = ML.MACHINE_ID)
JOIN LABEL L ON (ML.LABEL_ID = L.ID)
JOIN PATCHLINK_PATCH_LABEL_JT on PATCHLINK_PATCH_LABEL_JT.PATCHUID = MS.PATCHUID
JOIN LABEL PATCHLABEL on PATCHLABEL.ID = PATCHLINK_PATCH_LABEL_JT.LABEL_ID
WHERE PP.IMPACTID = 'Recommended'
AND PPS.STATUS = 0
AND PP.IS_SUPERCEDED = 0
AND PATCHLABEL.NAME = "Just these patches"
GROUP BY M.NAME
ORDER BY NOT_Patched DESC, M.NAME

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ