- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 08-26-2021 01:27 AM
Recently i found that when it comes to Citrix Netscaler discovery, sometimes the naming conventions for the CI is same for all the devices.
This happens when the Citrix Netscaler is not configured with proper name or left as default and during discovery, you may find different devices with same name.
A simple solution could be ask your concerned team to do the configuration or you can achieve it via
Pattern Pre/Post Script which runs after/before the pattern execution in discovery process.
Our idea is to concatenate the name with some meaningful attributes so that it can be recognized individually maybe serial,ip,mac,company,group,location....
Here we don't need to modify an existing script so that it does not impact our instance health upgrade points
We can achieve this via creating new Pattern Pre/Post Script .
----------------------------------------------------------------------------Steps------------------------------------------------------------------------------
1. In the instance navigate to Pattern Designer -> Pre Post processing
2. create new
3. Name:- <as per you choice>
Pattern/s:- Netscaler Load Balancer
When to execute:- 1. pre sensor
Script:-
var rtrn = {};
//parsing the json string to a json object
var payloadObj = JSON.parse(payload);
var payloadItems = payloadObj.items;
for(var i=0; i < payloadItems.length; i++)
{
if (payloadItems[i].className === 'cmdb_ci_lb_netscaler')
{ //Get location key under the class
var currentItem = payloadItems[i];
currentItem.values.name = currentItem.values.name+"@"+currentItem.values.ip_address ; //you can choose any attributes like serial_number,location or other attribute so that it can be meaningful
}
}
//you can return a message and a status, on top of the input variables that you MUST return.
//returning the payload as a Json String is mandatory in case of a pre sensor script, and optional in case of post sensor script.
//if you want to terminate the payload processing due to your business logic - you can set isSuccess to false.
rtrn = {'status':{
'message':'Enter your message here',
'isSuccess':true
},
'patternId':patternId,
'payload':JSON.stringify(payloadObj)
};
A screenshot for reference:-
Now after the discover, it would be something like this
Hope this article may help you .
Please leave your comments if you have any suggestions or any improvements that should i make.
- 521 Views