/build/static/layout/Breadcrumb_cap_w.png

KACE SMA - Updating Asset Status to Active using Custom Ticket Rule

Howdy,

Recently I found myself needing to do a good bit of cleanup in the asset management section of the SMA. I found myself wanting to find a solution to automatically update the asset fields from "In Stock" to "Active" once a computer has been online. I ended up making a custom ticket rule to do this. Figured I would share the SQL here since this site was one of the sources I used to make it.


This rule updates the devices asset status to active (493) if the agent has been online in the past 24 hours.


SELECT SQL

SELECT 

    ASSET.ID AS ASSET_ID,

    ASSET_STATUS.NAME AS ASSET_STATUS,

    SC.CONNECT_TIME

FROM

    MACHINE

        LEFT JOIN

    ASSET ON ASSET.MAPPED_ID = MACHINE.ID

        AND ASSET.ASSET_TYPE_ID = 5

        LEFT JOIN

    ASSET_STATUS ON ASSET_STATUS.ID = ASSET.ASSET_STATUS_ID

        LEFT JOIN

    KBSYS.KUID_ORGANIZATION KUID_ORG ON KUID_ORG.KUID = MACHINE.KUID

        LEFT JOIN

    KBSYS.SMMP_CONNECTION SC ON MACHINE.KUID = SC.KUID

        AND SUBSTRING(SCHEMA(), 4) = KUID_ORG.ORGANIZATION_ID

WHERE

    (((TIMESTAMP(SC.CONNECT_TIME) <= NOW()

        AND TIMESTAMP(SC.CONNECT_TIME) > DATE_SUB(NOW(), INTERVAL 24 HOUR))))

ORDER BY ASSET_ID


UPDATE SQL

UPDATE ASSET

LEFT JOIN MACHINE ON ASSET.MAPPED_ID = MACHINE.ID

    AND ASSET.ASSET_TYPE_ID = 5

LEFT JOIN KBSYS.KUID_ORGANIZATION KUID_ORG ON KUID_ORG.KUID = MACHINE.KUID

LEFT JOIN KBSYS.SMMP_CONNECTION SC ON MACHINE.KUID = SC.KUID

    AND SUBSTRING(SCHEMA(), 4) = KUID_ORG.ORGANIZATION_ID

SET ASSET.ASSET_STATUS_ID = '493'

WHERE TIMESTAMP(SC.CONNECT_TIME) <= NOW()

    AND TIMESTAMP(SC.CONNECT_TIME) > DATE_SUB(NOW(), INTERVAL 24 HOUR);





I recommend that anyone who chooses to use this script to test it out in a test environment if possible and to make sure to backup your assets/database prior to implementing it.
Hope it helps.



0 Comments   [ + ] Show comments

Answers (1)

Posted by: Hobbsy 8 months ago
Red Belt
0

Nice one Frank, thanks for posting I’m sure that will be useful to a lot of people and it’s also good to know that the need for asset stuff in KACE that I’ve been talking about for years is still needed by organisations like yours ;o)

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
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