GraphGists

ACME’s Network Dependency Graph

Network Dependency Graph

Database Setup

Below you will find the full Cypher script for creating ACME’s Network Dependency Graph in Neo4j. This simple script is the full setup of the data set that we will later perform analysis on.

ACME’s Network Inventory

The query below generates a data table that gives a quick overview of ACME’s network infrastructure.

MATCH 	(n)
RETURN 	labels(n)[0] as type,
		count(*) as count,
		collect(n.host) as names

Find direct dependencies of all public websites

The query below queries the data model to find all business web applications that are on the public facing internet for ACME.

MATCH 		(website)-[:DEPENDS_ON]->(downstream)
WHERE		website.system = "INTERNET"
RETURN 		website.host as Host,
			collect(downstream.host) as Dependencies
ORDER BY 	Host

Find direct dependencies of all internal websites

The query below queries the data model to find all business websites that are on the private intranet for ACME.

MATCH 		(website)-[:DEPENDS_ON]->(downstream)
WHERE		website.system = "INTRANET"
RETURN 		website.host as Host,
			collect(downstream.host) as Dependencies
ORDER BY 	Host

Find the most depended-upon component

The query below finds the most heavily relied upon component within ACME’s network infrastructure. As expected, the most depended upon component is the SAN (Storage Area Network).

MATCH 		(n)<-[:DEPENDS_ON*]-(dependent)
RETURN 		n.host as Host,
			count(DISTINCT dependent) AS Dependents
ORDER BY 	Dependents DESC
LIMIT 		1

Find dependency chain for business critical components: CRM

The query below finds the path of dependent components from left to right for ACME’s CRM application. If ACME’s CRM (Customer Relationship Management) application goes down it will cause significant impacts to its business. If any one of the components to the right of the CRM hostname fails, the CRM application will fail.

MATCH 		(dependency)<-[:DEPENDS_ON*]-(dependent)
WITH 		dependency, count(DISTINCT dependent) AS Dependents
ORDER BY 	Dependents DESC
LIMIT		1
WITH		dependency
MATCH 		p=(resource)-[:DEPENDS_ON*]->(dependency)
WHERE		resource.system = "CRM"
RETURN		"[" + head(nodes(p)).host + "]" +
			reduce(s = "", n in tail(nodes(p)) | s + " -> " + "[" + n.host + "]") as Chain

Find dependency chain for business critical components: ERP

The query below finds the path of dependent components from left to right for ACME’s ERP (Enterprise Resource Planning) application. The ERP application represents an array of business resources dedicated to supporting ongoing business activities at ACME, including finance and supply chain management. If ACME’s ERP application goes down it will cause significant impacts to its business. If any one of the components to the right of the ERP hostname fails, then the ERP application will fail. This failure will cause revenue impacts since ACME’s business relies on this system to conduct business.

MATCH 		(dependency)<-[:DEPENDS_ON*]-(dependent)
WITH 		dependency, count(DISTINCT dependent) AS Dependents
ORDER BY 	Dependents DESC
LIMIT		1
WITH		dependency
MATCH 		p=(resource)-[:DEPENDS_ON*]->(dependency)
WHERE		resource.system = "ERP"
RETURN		"[" + head(nodes(p)).host + "]" +
			reduce(s = "", n in tail(nodes(p)) | s + " -> " + "[" + n.host + "]") as Chain

Find dependency chain for business critical components: Data Warehouse

The query below finds the path of dependent components from left to right for ACME’s DW (Data Warehouse) application. The DW application represents an array of business intelligence resources dedicated to supporting time-sensitive analytical processes at ACME. If ACME’s DW application goes down it will cause significant impacts to the business operations at ACME on the technical side. If any one of the components to the right of the DW hostname fails, then the DW application will fail. This failure will cause public facing websites like the eCommerce application to not reflect the latest available data from ACME’s ERP application.

MATCH 		(dependency)<-[:DEPENDS_ON*]-(dependent)
WITH 		dependency, count(DISTINCT dependent) AS Dependents
ORDER BY 	Dependents DESC
LIMIT		1
WITH		dependency
MATCH 		p=(resource)-[:DEPENDS_ON*]->(dependency)
WHERE		resource.system = "DW"
RETURN		"[" + head(nodes(p)).host + "]" +
			reduce(s = "", n in tail(nodes(p)) | s + " -> " + "[" + n.host + "]") as Chain

Find the impact of the removal of a network component : Hardware Server

The query below finds the applications depending on ACME’s HARDWARE-SERVER-3. In case a network administrator wants to plan an intervention on the server, he has to know what will be the applications impacted. This way he can warn the applications users.

MATCH (application:Application)-[:DEPENDS_ON*]->(server)
WHERE       server.host = "HARDWARE-SERVER-3"
RETURN  application.type as Type,
        application.host as Host