Asset Management Suite

 View Only

Reporting Asset Status and Other Associations 

May 04, 2009 03:38 PM

Reporting associations can be very challenging especially since you have to figure out what the resource type guid is for the two sides of the relationship you are trying to report. Well, there is a wonderful report with a HUGE number of examples of relationships called the Resource Management Metadata report.

Here is an example where you can get the code needed to add an asset's status to a report:

  1. Open the Altiris Console and select the View pull-down menu and select Reports.
  2. In the left pane, select Reports > Asset and Inventory > Inventory > Windows > Inventory Agent > Resource Management Metadata.
  3. In the right pane, click Run this report.
  4. Select Computer and double-click.
  5. Double-click on Asset's Status.
  6. Hover over the one line of the report and notice the query.
  7. Click the Copy icon (the one with the arrow on a clipboard).
  8. Open Notepad by going to Start > Run and typing Notepad. Click OK.
  9. Paste in the code you copied (Edit > Paste or Ctrl+V).
  10. If you would like you can reformat the code by breaking it up to separate lines.

    /* and */ indicate the beginning and ending of a comment. Comments can span lines.

    You can remove extra spaces and add new lines as you wish.

  11. Delete the words "Sample Query" at the top of the page.
  12. Select all of the code and copy it (Edit > Copy or Ctrl+C). (Note: Leave the notepad window open)
  13. Return to the Altiris Console and right-click on the new Student Reports folder you created earlier under Asset and Inventory in the left pane.
  14. Select New > Report.
  15. Name the report Computer Status Report.
  16. Select Enter SQL Directly.
  17. Paste the code into the window by right-clicking and selecting Paste. The code should look something like the following (spacing and line breaks don't matter):
    /* Asset's Status Association sample query. */ 
    SELECT parent.[Name] AS [Asset] , rt.[Name] AS [Resource Type], ISNULL(child.[Name], 'Active') AS [Asset's Status] 
    FROM vResourceEx parent 
    INNER JOIN ResourceType rt ON parent.[ResourceTypeGuid] = rt.[Guid] 
    LEFT OUTER JOIN ResourceAssociation ra ON parent.[Guid] = ra.[ParentResourceGuid]
    AND ra.[ResourceAssociationTypeGuid] = '3028166f-c0d6-41d8-9cb7-f64852e0fd01' 
    LEFT OUTER JOIN vResourceEx child ON ra.[ChildResourceGuid] = child.[Guid] 
    /* Limit results to all resources with 'Asset' as a base resource type */ 
    WHERE parent.[ResourceTypeGuid] IN 
    	(SELECT ResourceTypeGuid FROM ResourceTypeHierarchy rth INNER JOIN 
    	ResourceType rt ON rth.[BaseResourceTypeGuid] = rt.[Guid] 
    	WHERE rt.[Name] = 'Asset')
    
  18. Click Test.
  19. If your code is correct, the Test Report window will open and display Asset, Report Type and Asset Status. If your code is not correct and the report window does not come up, scroll down to read the error message.
  20. Click Finish to save your report.
  21. Click Run this report

Now you may want to take this code to add to another report. You can modify the report you created with the sample code or you can take parts of the code to another report. For example, you can add Location to a report, whether it is one you wrote or one that came with the system.

This report will be very useful if you are trying to locate a machine where you only know its MAC address. You are going to copy the sample code for Location and add the table and field for MAC Address to that code. You will then take the modified code and create a new report with it.

  1. In the left pane, select Reports > Asset and Inventory > Inventory > Windows > Resource Management Metadata.
  2. In the right pane, click Run this report.
  3. Select Computer and double-click.
  4. Double-click on Location.
  5. Click the Copy icon (arrow on a clipboard).
  6. Open Notepad and paste in the code you copied (Edit > Paste or Ctrl+V).
  7. If you would like you can reformat the code by breaking it up to separate lines. /* and */ indicate the beginning and ending of a comment. Comments can span lines.
  8. Delete the words "Sample Query" at the top of the page.
  9. Make the changes as shown in bold below (the fourth line starts with a comma)
     /* Location Association sample query. */ 
    SELECT parent.[Name] AS [Asset] , rt.[Name] AS [Resource Type] , 
    ISNULL(child.[Name], 'No Association') AS [Location], tcpip.[MAC Address]
     FROM vResourceEx parent 
    INNER JOIN ResourceType rt 
     ON parent.[ResourceTypeGuid] = rt.[Guid] 
    LEFT OUTER JOIN ResourceAssociation ra 
     ON parent.[Guid] = ra.[ParentResourceGuid] 
    AND ra.[ResourceAssociationTypeGuid] = '05de450f-39ea-4aae-8c5f-77817889c27c' 
    LEFT OUTER JOIN vResourceEx child
      ON ra.[ChildResourceGuid] = child.[Guid] 
    INNER JOIN Inv_AeX_AC_TCPIP tcpip 
      ON parent.[Guid] = tcpip.[_ResourceGuid] 
    /* Limit results to all resources with 'Asset' as a base resource type */ 
    WHERE parent.[ResourceTypeGuid] IN
           (SELECT ResourceTypeGuid 
            FROM ResourceTypeHierarchy rth 
            INNER JOIN ResourceType rt ON rth.[BaseResourceTypeGuid] = rt.[Guid] 
            WHERE rt.[Name] = 'Asset')
    
  10. Select all of the code and Copy it (Ctrl+C). Note: Leave Notepad open; you will need this code again in exercise 3.
  11. Right-click on New Asset and Inventory > Student Reports and select New > Report.
  12. Name the new report: Computers with MAC Address and Location.
  13. Click the Enter SQL Directly button.
  14. Paste the code into the box (Ctrl+V).
  15. Click the Test button.
  16. If the report runs, click Close. If the report does not appear, scroll down and read the error. Correct the error and try again. (Note: You may need to delete the words "Sample Query" on the first line of code.)
  17. Click Finish.
  18. Click Run this report.
  19. Click on the MAC Address header to sort the report by that column's data. This would make it easier to locate a MAC address you were looking for.

Statistics
0 Favorited
0 Views
1 Files
0 Shares
0 Downloads
Attachment(s)
jpg file
Resource Management Metadata Report.jpg   146 KB   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Related Entries and Links

No Related Resource entered.