- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2017 01:45 AM
Hi All,
I have a question around the impacted Services/Cis tab on the change request form.
We are expecting that this populates all the CIs that are downstream of the Configuration item that has been entered on the form. Does anyone know how this population works?
In our instance this is not working as we are expecting. An example CI below:
We have a CI of 1Answer 1Aces UAT_Strata Release, Diagram below:
We would expect that all the CIs in the highlighted box would then be put into the impacted Services/CIs tab.
As you can see below this is not happening - The only CI that is being populated is the one we have added to this field. I would like to know what populates this tab and what changes we need to make to get this to work as expected.
I have seen the following business rule which I think is currently being used to populate this, but not sure what changes need to be made to this:
function onAfter(current, previous) {
//current.update();
action.setRedirectURL(current);
removeAffectedServices();
addAffectedServices();
//checkAffectedServices();
function removeAffectedServices()
{
var m2m = new GlideRecord('task_cmdb_ci_service');
m2m.addQuery('task',current.sys_id);
m2m.addQuery('manually_added','false');
m2m.query();
m2m.deleteMultiple();
}
function addAffectedServices()
{
var ciu = new CIUtils2();
//Find all impacted business services
var services = ciu.cisAffectedByTask(current);
//var services = ciu.cisAffectedByTask(current, ["cmdb_ci_service", "cmdb_ci_windows_server"]);
//var services = ciu.cisAffectedByTask(current, ["ALL"]);
var m2m = new GlideRecord('task_cmdb_ci_service');
for (var i = 0; i < services.length; i++) {
m2m.initialize();
m2m.task = current.sys_id;
m2m.cmdb_ci_service = services[i];
m2m.manually_added = 'false';
m2m.insert();
}
}
/*function checkAffectedServices()
{
var ciu = new CIUtils2();
//Find all impacted business services
var services = ciu.cisAffectedByTask(current);
//var services = ciu.cisAffectedByTask(current, ["cmdb_ci_service", "cmdb_ci_windows_server"]);
//var services = ciu.cisAffectedByTask(current, ["ALL"]);
var m2m = new GlideRecord('cmdb_ci_service');
m2m.addQuery('sys_id','IN',services.toString() );
m2m.query();
while(m2m.next())
{
var service_name= m2m.name;
var owner= m2m.owned_by;
gs.eventQueue("incident.impact.notify",current,owner,service_name);//Triggers the event for generating email Notification.
}
}*/
}
Any help on this is greatly appreciated.
Thanks
Sam
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2018 08:54 AM
Your CMDB relationships appear to be backwards. Normally the business services are at the very top as the highest parent. The components that run a business service (applications, servers, databases, etc.) would then be children downstream of it. Any additional business services which consume your first service would be upstream parents of it. When changes are opened for one of those child infrastructure CIs I would expect the Impacted Services/CIs tab to show the upstream service CIs that depend on it. The way yours are defined it would be searching the wrong direction.
In our instance we do something similar to what you're wanting, but our relationships have the services at the top. And we want our Impacted Services/CIs tab to show ALL types of CIs impacted, not just services. We also want to include not just CIs impacted by the main CI on the change but by any affected CI in the change. We go to great lengths to keep this current because changes to the affected CIs list or to any of the relationships between any of those CIs or their downstream related CIs could change which CIs are impacted and such changes would not be detected simply by a modification of the cmdb_ci field on the change request itself. So we have a scheduled job that runs hourly. It looks at all open change requests and incidents and rebuilds the full Impacted Services/CIs list for all of them that have had an affected CI updated since our last job run. It also looks at each impacted CI to see if they have had any new child relationships added since our last job run. If it finds anything updated on those it rebuilds the entire Impacted Services/CIs list for that task. We opted to do this in a scheduled job since (a) its such an intensive query process, (b) it would be overkill and a performance hog to run it in a business rule, and (c) a business rule on change requests still wouldn't detect changes to affected CIs or downstream relationship changes.
In summary - reverse your relationships. If you want it more robust do a deeper check like we did.
On a related note, I have a new need to return a list of downstream CIs for a given service CI. This is not for something within our instance but an external monitoring system needs to know which CIs it should be on the lookout for events from to determine if they may impact a particular service. For example, an event on a particular server being down should indicate visually on their dashboard that Service ABC which depends on it may be experiencing problems. I'm looking for a way to make a single web service call, feed it a parameter of a particular CI, and have it return a full list of the downstream CIs that may impact it up to N number of levels (another parameter could specify the levels to dig). As best I can tell I'd need to create a new function to walk the tree in the opposite direction of cisAffectedByCI() and then call that in a scripted web service. I had really hoped there was a built-in way to do this, or that someone had crossed this bridge before.
Has anyone else done this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2017 08:30 AM
Hi Nerz,
Thanks for all the above. I will take a look through the blog. I'm new to JavaScript so trying to get my head around what the script is meant to do to understand if it is the script that is not doing what we want or if we have relationships etc setup incorrectly in the cmdb itself.
I fully appreciate your comments around adding too many records, but even if we could just show the next level of CIs it would be a help. I understand if we try to go down the full tree it could lead to a lot of CIs being added.
Thanks
Sam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2017 08:43 AM
We are expecting that this populates all the CIs that are downstream of the Configuration item that has been entered on the form.
Why?
I'd have thought it'd be the other way around - that a change in a CI possibly affects upstream CIs. But to say changing a CI definitely affects downstream CIs feels incorrect.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2017 01:25 AM
Morning Dave,
Thanks for your above comment, I'm not sure if it is my use of bad terminology or my understanding of what would happen, but in the below screenshot if a change was made to the Database instance it could then have an impact on any of the CIs below (my understanding of downstream) i.e. something wrong with the database could cause the environment to stop working and therefore all the services within the environment?
Any help on where my knowledge is lacking or misplaced is greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2017 02:25 AM
Sam Ogden wrote:
Morning Dave,
Thanks for your above comment, I'm not sure if it is my use of bad terminology or my understanding of what would happen, but in the below screenshot if a change was made to the Database instance it could then have an impact on any of the CIs below (my understanding of downstream) i.e. something wrong with the database could cause the environment to stop working and therefore all the services within the environment?
Any help on where my knowledge is lacking or misplaced is greatly appreciated.
Erm.. no, you're actually correct. But your diagram looks odd - the arrows suggest the CIs are dependent upon the services, not the other way around.
Mine looks like:
.. from here, you can see that changes in anything downstream (such as an email server) will affect the Business Service (email service) and therefore have a knock-on affect with OWA, Blackberry, etc.
The arrows depict dependency - a change in the email Business Service will affect upstream services (ones above it) but not downstream (those below).
Your diagram has services downstream and CIs upstream, for some reason. Can you hover over one of the links to see what the dependency type is? It looks like it claims that CDLSA36 depends on Swindon Live environment, rather than the environment depends on that database.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2017 03:37 AM
Hi Dave,
Thanks for all the detail above, the more I am looking into this the more I feel the CMDB relationships have not been implemented correctly - not something that I have been working on - I was just tasked with trying to understand the impacted services tab. I feel that the relationships are not correct which is leading to incorrect information being pulled through to the impacted services tab.
In regards to the CDLSA36 relationship:
Would this be more the correct relationship setup?
Apologies for the basic questions, but the cmdb is not my domain so I am trying to grasp where it is wrong so I can feed this back to the correct people so we can get this corrected.
Thanks for all you help
Sam