01/09/2018 949 views
I am writing SQL to update our asset records using the fields from the inventory. I have read posts here that it has to go into the HelpDesk custom rules section of KACE. Why? That does not make sense to me since the information from the Inventory and Asset tables are inherently independent from the help desk system. It could be that I just do not have a full understanding of how all three are linked together. I wonder if I am just missing some important information. It seems to me that I would rather have a rule for when a device checks into KACE that a rule to update the asset information should run. Would someone have some clarifying information as to why it is done this way and if there is any documentation on how to properly set up the rule as well, I would be most grateful. I have my SQL statement and have tried to create it according to what I have read, but it fails to work every time I run it. It returns 0 rows if I put it in the select field and I get an error message if I up it in the update section. So I am definitely missing some knowledge.
Answer Summary:
0 Comments   [ + ] Show comments


Answer Chosen by the Author

The (<TICKET_IDS>) is a variable array that is built from the select statement, so if in the select statement you select tickets then in your update statement, the version that is actually run by your KACE box, you would see (<1,2,3,6,7>) as the selected ticket IDs are added into the Array. IN your case I would suggest that you are careful about updating within inventory as that may screw with the agent updates. But this works fine for Asset records, so if your select statement selects Assets that match a criteria i.e. updated within the last 24 hours, then the array will contain the asset ids

set FIELD_10011= 

So your SQL may need to look something like the above
Answered 01/10/2018 by: Hobbsy
Red Belt

  • Thank you. I understand this now.

All Answers

> I have read posts here that it has to go into the HelpDesk custom rules section of KACE. Why?
I'll let you in on the dirty little secret of Custom Ticket Rules: they offer root access to the SQL database, which is extremely powerful and extremely dangerous. So it doesn't matter if your "ticket rule" has nothing to do with tickets: it's essentially if/then with unrestricted database access.

> I would rather have a rule for when a device checks into KACE
The way I would do this in a CTR is say "select all the devices whose last sync was less than 15 minutes ago" and run it every 15 minutes. Then use the device IDs (which is called "<TICKET_IDS>") in the where clause of your asset UPDATE or INSERT statement.
Answered 01/09/2018 by: JasonEgg
Red Belt

  • Here is the statement that I was using. How do I incorporate Ticket_IDs into the Where clause?

    set FIELD_10011=
    (select MACHINE.OS_NAME from MACHINE
    • Since I don't know exactly what you're doing I can't speak to your code, but here's the structure you're going for:
      UPDATE [table or tables]
      SET [the changes to make]
      WHERE MACHINE.ID in (<TICKET_IDS>) [AND any other criteria]

      "<TICKET_IDS>" will be replaced by the values in the column titled "ID" from the SELECT statement of the CTR. I strongly advise using a test instance of KACE before implementation: A bad CTR could be catastrophic. You should be able to run a small virtual test instance if you've bought a K1 (SMA) appliance; talk to support for details.
      • My apologies, I don't understand. The TICKET_IDS is throwing me off. I will see if I can find someone here who can assist me. Thank you for the information.

Don't be a Stranger!

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

Sign up! or login