Skip to tutorial content
Rate module Not yet rated

Adding Connection Logic Where Required

4 min read
On this page

In this lesson, you will learn:

  • When a connection section is worth adding
  • How it finds a dependency
  • The archiver’s link to snwr-db-01

πŸ” Quick look back: Last time: Populating Attributes and Relationships. You learned how the pattern fills the CI and its Runs on link.

1 The Problem: The Archiver’s Database Isn’t Linked

The archiver stores its index in PostgreSQL on snwr-db-01. If snwr-db-01 goes down:

  • The archiver stops.
  • Nothing in the CMDB shows that.

🎯 The problem: The archiver’s database dependency isn’t linked.

πŸ‘‰ The fix: Add a connection section that reads db_host and links to snwr-db-01.

Flow from archiver to database.
Figure 1. The archiver’s connection section.

2 When to add one

  • A key dependency affects impact, like a database.
  • The connection details are easy to read, like a config value.
  • Someone will use the link.

3 How it works

The connection section uses a value, like db_host, to find or create the target and link to it. Keep it simple: one reliable source for the target.

4 Project Clear View: How We Implemented It

πŸ“ Situation: Mei wanted to see that the archiver depends on snwr-db-01.

🧭 Decision: Add a connection section from db_host.

πŸ› οΈ Steps we took:

  1. Added a connection section using the db_host variable.
  2. Pointed it at the PostgreSQL CI on snwr-db-01.
  3. Tested in Debug on snwrdev.
  4. Checked the link in the CMDB.

βœ… What we verified:

  • The archiver shows a link to PostgreSQL on snwr-db-01.
  • Mei can see the dependency.

πŸ“ Evidence: The connection section, part of the archiver pattern.

5 Quick recap

  • Add connection logic for key dependencies.
  • Use one reliable value, like a config setting.
  • Check the link appears in the CMDB.
  • Only add links someone will use.

6 Check yourself

Think of your answer first. Then tap to check.

1 Which value did the connection section use? Show answer

db_host from archiver.conf.

2 What does the archiver depend on? Show answer

PostgreSQL on snwr-db-01.

3 Who needed this link? Show answer

Mei, for change impact.

Nice work! The archiver’s dependency is visible. πŸŽ‰
Next up: Debugging and Validating the Pattern

Was this lesson helpful?

Have a question or doubt?

Ask here and get help from instructors and fellow learners.

0 / 300

Only logged-in learners can post.