Customizing Asset Management Solution 7.1.x - Asset Subtypes and Warranty End Dates
In Asset Management v6 and still in v7.1.x, there are some key features that are missing. Two of those items are Asset Subtype and Warranty End Date. Maybe they took care of this in 7.5, but it isn’t out yet and it may take a while for the average person to get from point A to point B.
Out of the box with Asset Management, we can track when a warranty starts and how long it lasts, but we have to do math in any reporting to figure out the end date of that warranty. Why is this so difficult?
We can tell that an Asset is a computer, but how useful is that really? OK, it tells us that it isn’t a desk, but wouldn’t you really rather know if the computer was a server, laptop, desktop, tablet, low profile desktop, etc.? I would.
Do you care if a monitor is a flat panel or a CRT? You probably do. Do you know which ones are which based upon your asset data? Most probably don’t.
How cool would it be to use a simple SQL query to get a listing of all 4G cell phones in your organization? Knowing all of the model numbers of 4g phones for all vendors off the top of your head is just way, way too geeky, but if your Asset Management system had Asset Subtypes for your phones, you could select 3G or 4G when you entered the assets, and then you could easily report on them.
For maintenance contract purposes, do you care how many laptops have a warranty end date in the next 6 months? Yep.
Enough of the sales pitch. You are obviously interested or you wouldn't be reading this anymore. How do we actually customize our Asset Management system to include these key missing features? This documentation is written for 7.1.x, but the same principles apply to v6 if you are still running that version. I did the same customizations back then.
There are only a couple of things that we need to do to make this work.
- First, we need to create custom data classes for every asset type that we would like to have subtypes for. In my case, I have subtypes for every type of asset that we track. It is just too easy to add additional and useful asset information.
- Second, we need to associate these data classes to the appropriate resource types.
- Third, we need to create a new view so that reporting is simplified.
Step 1 – Creating Custom Data classes
In the console, go to Settings →All Settings. In the left pane, expand Notification Server →Resource and Data Class Settings→Data Classes. If you don’t have a folder for Custom Data Classes, create one. Proper organization is key to anything Altiris. If you start the folder name with an underscore, it will always be listed at the top. Under _Custom Data Classes create a folder for Assets.
Right-click on the Assets folder and select New Editable Data Class to bring up the following screen:
Give it an appropriate name. In my case, we chose to name all of these data classes ‘ODT <AssetType> Details’. Whatever you pick, make them all follow the same naming convention. Each data class get a table created in the database. In this case it would be dbo.inv_ODT_Computer_Details.
Uncheck the Multiple Rows check box.
Click the ‘Add a new attribute’ button. Name is Warranty End Date, Type is Date. Click OK.
Click the ‘Add a new attribute’ button. Name is Asset Subtype, Type is Static List. Click the Edit button that just appeared on the right side. This is where you get to put in whatever subtypes are available for the Asset Type that this is named for. In my case, I am working on subtypes for Computers, so my items in the Static List are ‘Blade, Desktop, Laptop, Server, and Tablet’. This is complete free form for you. Whatever you enter here will be available in drop down lists when editing/entering an asset.
Click Save Changes.
Go through and create these custom data classes for every type of asset that you want to have subtypes available for. It is easier to do all of them up front rather than go back and update this process down the road. By the time you go to update it, you will have forgotten how to do it and you will probably forget to update the view that we will create in a few minutes.
It is CRITICAL that you make the attributes the exact same for all of the data classes that you create. This will make creating the view much easier so you only to know 2 things rather than 200 things.
So now you spent the last hour creating custom data classes and coming up with all kinds of useful subtypes for all of the assets that you track and you are ready to move forward. Next we need to tie all of these Custom Data Classes to their respective Resource types.
In the left pane of the console, compress the Data Classes section and expand Resource Types→Asset Types→IT. You will find different asset types scattered around under the Asset Types portion of the tree, including any custom asset types that you may have created. Going with the same example of Computer, click on Computer in the left pane. Scroll down in the right pane and you will see all of the data classes that are tied to this asset type.
Click the’ Add data class’ button. If you started your Custom Data Class folder with an underscore, you will find it at the top of the list. Scroll around until you find the custom data class that you want to tie to the Computer resource type. Put a check mark in that data class and click the ‘Save Changes’ button.
You will now see the custom data class listed in the original list of associated resource types. Click the ‘Save changes’ button.
In this case, we just added the ‘ODT Computer Details’ custom data class to the Computer resource type.
Rinse and repeat to add every custom data class that you created to the respective resource type.
Now that you have gone through and associated all of these custom data classes to all of the appropriate resource types, how can we tell if the work was done properly? In the console, go to Manage→Computers. Pick a computer at random, right-click on it and select Edit. When the Edit Configuration Item screen comes up, scroll down and you will see a section with the name of your Custom Data Class. In my case, it is named ODT Computer Details. In this section, we have a standard date box for Warranty End Date and a drop down for Asset Subtype.
Go ahead and select a date and an asset Subtype to make sure that it can save the changes without error.
So now you can go through and start assigning these brand new subtypes to all of your assets. I set the subtype when I am creating my assets through CMDB rules. I never create any assets manually, always pointing to a .csv file for import.
You can also create CMDB rules for each asset resource type to set the asset subtype. You can run some SQL to get a listing of all of your laptops, based upon model numbers that you select, dump that to a CSV file and use that as a data source for a CMDB rule and within a few seconds, you just set the Asset Subtype for hundreds of assets. You may be able to highlight a bunch of assets, right-click them and select bulk edit and then update the Subtype from there. Bulk edit doesn’t work in my production environment for some reason and I haven’t had time to find out why yet. I am pretty sure that in v6 I was able to use bulk edit to change the Asset Subtype.
Once you get some data populated, you can look in SQL to find it.
Select * from dbo.Inv_ODT_Computer_Details
Now that we have all of our Asset Subtypes created and associated with the Resource Types, and we have set the Asset Subtype for a whole bunch of assets, the next step is to create a view so that we can easily use this data in SQL and reports. This view can also be used in IT Analytics reporting, and I may cover instructions for customizing that down the road.
The easiest way to create this view for me is to simply write a SQL query that shows all of the data. I hate having NULL data in the database just because there are times where you have to jump through a variety of hoops to deal with NULL properly because a NULL field isn’t the same as a blank field. Because of that hate, I use the ISNULL command all over the place in this view.
We are going to basically create a field that joins the contents of all of the ‘asset subtype’ fields for all of the custom data classes that we created. Since we didn’t use the same custom data class on more than once resource type, and the asset subtype is a drop down list, this will work fine. We also do the same thing for ‘warranty end date’.
The following query is my vAssetSubtype view:
SELECT vra.Guid AS _ResourceGuid, ISNULL(bd.[Asset Subtype], '') + ISNULL(cad.[Asset Subtype], '') + ISNULL(chd.[Asset Subtype], '') + ISNULL(ad.[Asset Subtype], '') + ISNULL(cd.[Asset Subtype], '') + ISNULL(cmcd.[Asset Subtype], '') + ISNULL(cd2.[Asset Subtype], '') + ISNULL(co.[Asset Subtype], '') + ISNULL(dd.[Asset Subtype], '') + ISNULL(dsd.[Asset Subtype], '') + ISNULL(ipd.[Asset Subtype], '') + ISNULL(kd.[Asset Subtype], '') + ISNULL(md.[Asset Subtype], '') + ISNULL(mcd.[Asset Subtype], '') + ISNULL(md2.[Asset Subtype], '') + ISNULL(nasd.[Asset Subtype], '') + ISNULL(nbdd.[Asset Subtype], '') + ISNULL(ndd.[Asset Subtype], '') + ISNULL(npd.[Asset Subtype], '') + ISNULL(pd.[Asset Subtype], '') + ISNULL(pd2.[Asset Subtype],'') + ISNULL(rd.[Asset Subtype], '') + ISNULL(sd.[Asset Subtype], '') + ISNULL(td.[Asset Subtype], '') + ISNULL(ud.[Asset Subtype], '') AS [Asset Subtype], ISNULL(bd.[Warranty End Date], '') + ISNULL(cad.[Warranty End Date], '') + ISNULL(chd.[Warranty End Date], '') + ISNULL(ad.[Warranty End Date], '') + ISNULL(cd.[Warranty End Date], '') + ISNULL(cmcd.[Warranty End Date], '') + ISNULL(cd2.[Warranty End Date], '') + ISNULL(co.[Warranty End Date], '') + ISNULL(dd.[Warranty End Date], '') + ISNULL(dsd.[Warranty End Date], '') + ISNULL(ipd.[Warranty End Date], '') + ISNULL(kd.[Warranty End Date], '') + ISNULL(md.[Warranty End Date], '') + ISNULL(mcd.[Warranty End Date], '') + ISNULL(md2.[Warranty End Date], '') + ISNULL(nasd.[Warranty End Date], '') + ISNULL(nbdd.[Warranty End Date], '') + ISNULL(ndd.[Warranty End Date], '') + ISNULL(npd.[Warranty End Date], '') + ISNULL(pd.[Warranty End Date], '') + ISNULL(pd2.[Warranty End Date], '') + ISNULL(rd.[Warranty End Date], '') + ISNULL(sd.[Warranty End Date], '') + ISNULL(td.[Warranty End Date], '') + ISNULL(ud.[Warranty End Date], '') AS [Warranty End Date] FROM dbo.vRM_Asset AS vra LEFT OUTER JOIN dbo.Inv_ODT_Briefcase_Details bd ON vra.Guid = bd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Calculator_Details cad ON vra.Guid = cad._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Chair_Details chd ON vra.Guid = chd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Aircard_Details AS ad ON vra.Guid = ad._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Cellphone_Details AS cd ON vra.Guid = cd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Chassis_Management_Controller_Details AS cmcd ON vra.Guid = cmcd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Computer_Details AS cd2 ON vra.Guid = cd2._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Copier_Details AS co ON vra.Guid = co._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Deskphone_Details AS dd ON vra.Guid = dd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Disk_Subsystem_Details AS dsd ON vra.Guid = dsd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_IP_Phone_Details AS ipd ON vra.Guid = ipd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_KVM_Details AS kd ON vra.Guid = kd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Mainframe_Details AS md ON vra.Guid = md._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Modular_Chassis_Details AS mcd ON vra.Guid = mcd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Monitor_Details AS md2 ON vra.Guid = md2._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Network_Attached_Storage_Details AS nasd ON vra.Guid = nasd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Network_Backup_Device_Details AS nbdd ON vra.Guid = nbdd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Network_Device_Details AS ndd ON vra.Guid = ndd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Network_Printer_Details AS npd ON vra.Guid = npd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Peripheral_Details AS pd ON vra.Guid = pd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Printer_Details AS pd2 ON vra.Guid = pd2._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Rack_Details AS rd ON vra.Guid = rd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Scanner_Details AS sd ON vra.Guid = sd._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_Tape_Drive_Details AS td ON vra.Guid = td._ResourceGuid LEFT OUTER JOIN dbo.Inv_ODT_UPS_Details AS ud ON vra.Guid = ud._ResourceGuid
As you can see, you just need a join to each table (each custom data class) and you need to add the Asset Subtype and Warranty End Date for each one. If you followed the advice to name all of the attributes for the custom data classes the same, this view will be very easy to create.
Now that you have written and tested the SQL for your View and verified that it brings back the data that you are expecting, go ahead and copy that SQL. In the left pane of the SQL Management Studio, expand your CMDB database and right-click on Views. Select New View. Click the Close button since we don’t need to manually join tables together.
In the 3rd section of the View page, you see the words SELECT FROM. Delete those two words and paste your previously verified SQL into this section. Hit the save button at the top. It will ask you for a name for this view. Call it vAssetSubtype and click the OK button. The tool will go ahead and fill in the rest of the sections of the view design for you. Go ahead and close this window within SQL.
Open up a new query window and run the following (selecting your database name, not mine):
Select * from Symantec_CMDB.dbo.vAssetSubtype vas
If you followed all of the directions properly and you set the asset subtype and warranty end date for some of your assets, this query will bring back data.
Let’s flash forward to the point that you have filled in all of the subtypes and warranty end dates for all of your assets. Let’s look at our questions from the beginning of this article and see how we would answer them.
How do we know how many CRT monitors we have? Easy enough, probably only one subtype like CRT.
select * from Symantec_CMDB.dbo.vAssetSubtype vas
where vas.[Asset Subtype] like '%CRT%'
How many 4G cell phones do I have? Slightly more complicated since we can easily have more than one asset type that has a subtype of 4G.
from Symantec_CMDB.dbo.vAsset va
left outer join Symantec_CMDB.dbo.vAssetSubtype vas on
va.[_ResourceGuid] = vas.[_ResourceGuid]
where va.[Asset Type] = 'cell phone'
and vas.[Asset Subtype] like '%4g%'
How many laptops have a warranty expiring in the next 6 months? Hardest part of this is dealing with dates. Once you understand how to do that, the rest is simple.
vas.[Warranty End Date],
from Symantec_CMDB.dbo.vAsset va
left outer join Symantec_CMDB.dbo.vAssetSubtype vas on
va.[_ResourceGuid] = vas.[_ResourceGuid]
where va.[Asset Type] = 'computer'
and vas.[Asset Subtype] like '%laptop%'
-- 6 months from today
and convert(date,vas.[Warranty End Date]) <= (convert(date,GETDATE() + 180))
and convert(date,vas.[Warranty End Date]) >= (convert(date,GETDATE()))
order by vas.[Warranty End Date]
Hopefully you were able to gain some knowledge about how to really make something useful out of Symantec’s Asset Management Solution. Once you understand how the enhancements are being made, this is a very simple process. The fact that the data is so easy to add to reports or queries by adding a join is a huge bonus.