CMDB: Automate standby for continuity CIs

automator-logo

Prerequisites if you like to try it:

  • You already have an ITPR demo account. If not, you can easily request one with demo data.
  • You already signed up for a techwork automator demo account. If not, goto the registration blog post.

Business case:

Maintaining CIs accurately in the CMDB could be of vital importance if something goes wrong in order to get a Service Instance up and running again. For important CIs  you probably have standby CIs. Because of that ITRP provides the status “Standby for Continuity” and the relationship type “Continuity”.

Whenever an important CI changes the status from “In Production” to “Being Repaired” or a similar status the CMDB needs to be updated:

  • The linked CI with the relationship type “Continuity” needs to change the status from “Standby for Continuity” to “In Production”.
  • Other CIs and relationship types might also need updates.

To do this efficiently without too many manual steps we developed a 10 liner in the automator to do that.

[code language=”javascript”]

mergeAudit(ci);

if (ci.audit_is_changed_status && (ci.audit_old_status == "in_production" && ci.audit_new_status == ‘being_repaired’)) {
for($item of ci.ci_relations) {
if ($item.relation_type == ‘continuity’ && $item.ci.status == ‘standby_for_continuity’) {
update(‘cis’, $item.ci.id, {
status: ‘in_production’
});
}
}
}

[/code]

The code with comments:

[code language=”javascript”]
//get the audit for the updated ci
mergeAudit(ci);

//did the status change from "In production" to "Being repaired"
if (ci.audit_is_changed_status && (ci.audit_old_status == "in_production" && ci.audit_new_status == ‘being_repaired’)) {
for($item of ci.ci_relations) {
//change all linked items with the relationship type "Continuity" and the status "Standby for Continuity" to "In Production"
if ($item.relation_type == ‘continuity’ && $item.ci.status == ‘standby_for_continuity’) {
update(‘cis’, $item.ci.id, {
status: ‘in_production’
});
}
}
}
[/code]

Conclusion

Such short scripts make it easier to keep the CMDB up to date because it reduces manual error-prone steps and make working with ITRP even easier.

k.konwalin@techwork.at

 

Leave a Reply