cmdb location populating help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2017 11:57 AM
Hello everyone,
Been working with SN discovery now for about 3 months, so complete newbie here. In our discovery schedules we have locations set. Our expectation is that this location will be carried over to the CI's when they are discovered. However, this is only happening in some scenarios, but not in others. What seems to be happening is that the physical server itself has a location, but the software and other ci's found on the server don't have the location populated.
An example that I'm specifically working on is that I have a 2 node cluster where the cluster nodes are discovered and location is populated as expected. However, the SQL Instances, database, and cluster name aren't getting a location populated.
I've attempted to write a Business Rule that would do it based upon an article I found here: Change field that discovery updates for location? This does populate the cluster name, but doesn't do the SQL Instance or databases. In reviewing the discovery_device_history table that the article references, it does have a record for discovering the cluster name, but not the SQL Instance or Databases. I confirmed that instances and databases are being discovered though, so it doesn't seem like they are considered devices (which makes sense).
Now I realize that clustered and databases could be mutli-location systems depending upon the environment, so why would we want to tie location into it. That isn't how our environment is built, so for us it isn't a concern. Even if it was, we run discovery daily, so it would update on the move.
Given this, the only way I could foresee doing this would be to write a BR on the CI Relationships where the child get the parents location. However, that actual would be an issue in the event we did ever go to geo-clusters.
Anyone have any thoughts and/or experience with this and have a better solution? Basically, how to set the location of any CI to the location of the discovery scheduled it was found on?
Sincerely,
Nathan
- Labels:
-
Discovery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2017 01:43 AM
have you looked up updating the reconciliation rules in the CMDB? If you're using discovery, then your org is using the identification and reconciliation engine to uniquely identify and CI, and insert and update its records in the CMDB.
- Did you select Discovery as an authorized data source for updating the CI records, and
- have you selected location as an attribute?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2017 08:36 AM
Vivian,
I'm not familiar with reconciliation, but from what little I read I'm not seeing how it would help. Can you provide some additional information on it?
Thank you very much.
Sincerely,
Nathan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2018 05:43 AM
Hi Nathan,
am new to service now.please accept my apologies if there is anything wrong in the code.
i have the similar requirement,based on my understanding i have written the below code. but it is not giving the expected output. can any one please help me on this.
below are the requirement details and written code.
I have a requirement to update the location of the server in CMDB_CI_SERVER table w.r.to discovery schedule location.
We have OOB feature to update the location, but for some servers location is not updating, so we want to customize this.
1) Discovery schedule has location field with one value, the same should be updated for servers in CMDB_CI_SERVER table w.r.to their IP ranges.
2) For every discovery schedule we have defined some IP ranges .the server which is present in the above tables IP range will fall in the defined range.
I have written below business rule for this .script is executing fine, but location is not populating in the CMDB_CI_SERVER table.
Business rule:
function location(){
var sysID ='8d7eb7ed4f302e842967ef4f0310c789';
var serverip = new GlideRecord('cmdb_ci_server');
serverip.addQuery('sys_id',sysID);
serverip.Query();
while(serverip.next()){
var iprange = new GlideRecord('discovery_range_item');
var discsche = new GlideRecord('discovery_schedule');
if( serverip.getValue('ip_address') >= iprange.getValue('start_ip_address') && serverip.getValue('ip_address') <= iprange.getValue('end_ip_address') ){
answer = iprange.getValue('schedule');
gs.log('answer');
continue;
}
if( answer = discsche.getValue('name')){
answer2 = discsche.getValue('location');
continue;
}
if( answer2 != serverip.getValue('location')){
answer3 = answer2;
}
serverip.location= answer3;
serverip.update();
}
}
Thanks,
kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2018 03:36 AM
First, we didn't get it figured out. Rather we setup a discovery business rule as shown on the link in my original post. We then setup additional discovery business rules on the table we cared about that, on insert/update, if the location wasn't populated, then look in the [CI Relationships] table to find parents with location configured. If the parent has a location, and all of the parents have he same location, then update the CI location.
Next, regarding your code:
1) Can you describe in more depth what issue is occurring? You mention that you are having one, but don't specify what that is.
2) IP Address is a string, not a number. Not sure if there could be some issues with >= statement on a string of numbers. Sometimes those don't work as expected. Maybe add an ELSE statement after the if (server.ip.getvalue......) statement to see if it is returning FALSE for your specific case.
3) ALWAYS use VAR to declare variables. You aren't doing that for answer, answer2, and answer3 variables. Previous experience has shown me that not doing this can create weird results.
Hope that helps.
Nathan