This repository has been archived by the owner on Sep 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aac7c77
commit 3e8d876
Showing
9 changed files
with
421 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Perform 2018 - Sample 4 | ||
|
||
This example is an extension of [Sample 3](../../perform-topology-api/03-topology-processes). | ||
|
||
Processes involved in ongoing (and for simplicity reasons also resolved) problems are colored in red. | ||
The Dynatrace Problem API publishes the necessary REST calls that allow for querying for the problem feed, problem details and eventually the events containing the entities involved in the problem. | ||
|
||
To use this example with your own Dynatrace environment, just replace the placeholder with your own environment id and API key. |
114 changes: 114 additions & 0 deletions
114
perform-problem-api/04-problem-processes/problem-process-map.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<html> | ||
<head> | ||
<script src="https://rawgit.com/Linkurious/linkurious.js/develop/dist/sigma.min.js"></script> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> | ||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/sigma.js/1.1.0/plugins/sigma.layout.forceAtlas2.min.js"></script> | ||
<script> | ||
var YOUR_ENV_ID = 'ENTER YOUR ENVIRONMENT ID HERE', | ||
YOUR_API_TOKEN = 'ENTER YOUR API TOKEN HERE', | ||
CLUSTER = 'live.dynatrace.com', | ||
i, | ||
s, | ||
g = { | ||
nodes: [], | ||
edges: [] | ||
}; | ||
|
||
nodeIds = {}; | ||
erronous_nodeIds = {}; | ||
|
||
function init() { | ||
$.ajax({ | ||
url: "https://" + YOUR_ENV_ID + "." + CLUSTER + "/api/v1/problem/feed/?relativeTime=day", | ||
type: 'get', | ||
headers: { 'Authorization': ' Api-Token ' + YOUR_API_TOKEN }, | ||
success: function(data) { | ||
for (var i = 0; i < data.result.problems.length; i++) { | ||
var problem = data.result.problems[i]; | ||
$.ajax({ | ||
url: "https://" + YOUR_ENV_ID + "." + CLUSTER + "/api/v1/problem/details/" + problem.id, | ||
type: 'get', | ||
headers: { 'Authorization': ' Api-Token ' + YOUR_API_TOKEN }, | ||
success: function(detail_data) { | ||
if (detail_data == undefined) return; | ||
if (!detail_data.result == undefined) return; | ||
if (!detail_data.result.rankedEvent == undefined) return; | ||
for (var j = 0; j < detail_data.result.rankedEvents.length; j++) { | ||
var rankedEvent = detail_data.result.rankedEvents[j]; | ||
if (rankedEvent.entityId != undefined) { | ||
erronous_nodeIds[rankedEvent.entityId] = true; | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
$.ajax({ | ||
url: "https://" + YOUR_ENV_ID + "." + CLUSTER + "/api/v1/entity/infrastructure/processes", | ||
type: 'get', | ||
headers: { 'Authorization': ' Api-Token ' + YOUR_API_TOKEN }, | ||
success: function(service_data) { | ||
var i = 0; | ||
// two passes, first one to create all service nodes | ||
service_data.forEach(function(entry) { | ||
//console.log(entry); | ||
var node = { | ||
id: entry.entityId, | ||
label: entry.displayName, | ||
x: Math.random(), | ||
y: Math.random(), | ||
size: 200, | ||
color: '#666' | ||
}; | ||
if (erronous_nodeIds[entry.entityId]) | ||
node.color = '#FF0000'; | ||
g.nodes.push(node); | ||
nodeIds[entry.entityId] = true; | ||
}); | ||
// second one to add only edges to existing service nodes | ||
service_data.forEach(function(entry) { | ||
var callRel = entry.toRelationships.isNetworkClientOf; | ||
if(callRel) { | ||
callRel.forEach(function(toId) { | ||
if(nodeIds[toId]) { | ||
g.edges.push({ | ||
id: 'e' + i, | ||
source: entry.entityId, | ||
target: toId, | ||
size: 100, | ||
color: '#ccc' | ||
}); | ||
i++; | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
// instantiate sigma | ||
s = new sigma({ | ||
graph: g, | ||
container: 'graph-container' | ||
}); | ||
|
||
// Start the ForceAtlas2 algorithm: | ||
s.startForceAtlas2({worker: true, barnesHutOptimize: false}); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
</script> | ||
</head> | ||
<body onload="init();"> | ||
<div id="container"> | ||
<style> | ||
#graph-container { | ||
top: 0; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
position: absolute; | ||
} | ||
</style> | ||
<div id="graph-container"></div> | ||
</div> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Perform 2018 - Sample 1 | ||
|
||
This example is a slightly modified version of the [topology-smartscape](https://github.com/Dynatrace/dynatrace-api/tree/master/topology-smartscape) example. | ||
|
||
It represents a base solution that is able to visualize a service map. The required data is getting queried from via Dynatrace Topology and Smartscape API via REST Calls. | ||
Visualization is taken care of by Sigma.js. | ||
|
||
Clicking on one of the nodes creates an alert box. | ||
|
||
To use this example with your own Dynatrace environment, just replace the placeholder with your own environment id and API key. |
89 changes: 89 additions & 0 deletions
89
perform-topology-api/01-topology-services/service-map.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<html> | ||
<head> | ||
<script src="https://rawgit.com/Linkurious/linkurious.js/develop/dist/sigma.min.js"></script> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> | ||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/sigma.js/1.1.0/plugins/sigma.layout.forceAtlas2.min.js"></script> | ||
<script> | ||
var YOUR_ENV_ID = 'ENTER YOUR ENVIRONMENT ID HERE', | ||
YOUR_API_TOKEN = 'ENTER YOUR API TOKEN HERE', | ||
CLUSTER = 'live.dynatrace.com', | ||
i, | ||
s, | ||
g = { | ||
nodes: [], | ||
edges: [] | ||
}; | ||
|
||
nodeIds = {}; | ||
|
||
function init() { | ||
$.ajax({ | ||
url: "https://" + YOUR_ENV_ID + "." + CLUSTER + "/api/v1/entity/services", | ||
type: 'get', | ||
headers: { 'Authorization': ' Api-Token ' + YOUR_API_TOKEN }, | ||
success: function(service_data) { | ||
var i = 0; | ||
// two passes, first one to create all service nodes | ||
service_data.forEach(function(entry) { | ||
//console.log(entry); | ||
var node = { | ||
id: entry.entityId, | ||
label: entry.displayName, | ||
x: Math.random(), | ||
y: Math.random(), | ||
size: 200, | ||
color: '#666' | ||
}; | ||
g.nodes.push(node); | ||
nodeIds[entry.entityId] = true; | ||
}); | ||
// second one to add only edges to existing service nodes | ||
service_data.forEach(function(entry) { | ||
var callRel = entry.toRelationships.calls; | ||
if(callRel) { | ||
callRel.forEach(function(toId) { | ||
if(nodeIds[toId]) { | ||
g.edges.push({ | ||
id: 'e' + i, | ||
source: entry.entityId, | ||
target: toId, | ||
size: 100, | ||
color: '#ccc' | ||
}); | ||
i++; | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
// instantiate sigma | ||
s = new sigma({ | ||
graph: g, | ||
container: 'graph-container' | ||
}); | ||
|
||
s.bind('clickNode', function(e) { | ||
alert(e.data.node.id + " clicked"); | ||
}); | ||
|
||
// Start the ForceAtlas2 algorithm: | ||
s.startForceAtlas2({worker: true, barnesHutOptimize: false}); | ||
} | ||
}); | ||
} | ||
</script> | ||
</head> | ||
<body onload="init();"> | ||
<div id="container"> | ||
<style> | ||
#graph-container { | ||
top: 0; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
position: absolute; | ||
} | ||
</style> | ||
<div id="graph-container"></div> | ||
</div> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Perform 2018 - Sample 2 | ||
|
||
This example extends [Sample 1](../01-topology-services) by adding a custom tag to the service represented by a node when clicked. | ||
|
||
Adding a custom tag to an entity is possible by sending a POST request via REST call to the Dynatrace Topology and Smartscape API. | ||
|
||
To use this example with your own Dynatrace environment, just replace the placeholder with your own environment id and API key. |
95 changes: 95 additions & 0 deletions
95
perform-topology-api/02-topology-service-tagging/service-tagging.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<html> | ||
<head> | ||
<script src="https://rawgit.com/Linkurious/linkurious.js/develop/dist/sigma.min.js"></script> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> | ||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/sigma.js/1.1.0/plugins/sigma.layout.forceAtlas2.min.js"></script> | ||
<script> | ||
var YOUR_ENV_ID = 'ENTER YOUR ENVIRONMENT ID HERE', | ||
YOUR_API_TOKEN = 'ENTER YOUR API TOKEN HERE', | ||
CLUSTER = 'live.dynatrace.com', | ||
i, | ||
s, | ||
g = { | ||
nodes: [], | ||
edges: [] | ||
}; | ||
|
||
nodeIds = {}; | ||
|
||
function init() { | ||
$.ajax({ | ||
url: "https://" + YOUR_ENV_ID + "." + CLUSTER + "/api/v1/entity/services", | ||
type: 'get', | ||
headers: { 'Authorization': ' Api-Token ' + YOUR_API_TOKEN }, | ||
success: function(service_data) { | ||
var i = 0; | ||
// two passes, first one to create all service nodes | ||
service_data.forEach(function(entry) { | ||
//console.log(entry); | ||
var node = { | ||
id: entry.entityId, | ||
label: entry.displayName, | ||
x: Math.random(), | ||
y: Math.random(), | ||
size: 200, | ||
color: '#666' | ||
}; | ||
g.nodes.push(node); | ||
nodeIds[entry.entityId] = true; | ||
}); | ||
// second one to add only edges to existing service nodes | ||
service_data.forEach(function(entry) { | ||
var callRel = entry.toRelationships.calls; | ||
if(callRel) { | ||
callRel.forEach(function(toId) { | ||
if(nodeIds[toId]) { | ||
g.edges.push({ | ||
id: 'e' + i, | ||
source: entry.entityId, | ||
target: toId, | ||
size: 100, | ||
color: '#ccc' | ||
}); | ||
i++; | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
// instantiate sigma | ||
s = new sigma({ | ||
graph: g, | ||
container: 'graph-container' | ||
}); | ||
|
||
s.bind('clickNode', function(e) { | ||
$.ajax({ | ||
url: "https://" + YOUR_ENV_ID + "." + CLUSTER + "/api/v1/entity/services/" + e.data.node.id, | ||
type: 'post', | ||
headers: { 'Authorization': ' Api-Token ' + YOUR_API_TOKEN, "Content-Type": "application/json" }, | ||
data: '{ "tags": [ "customtagged" ] }', | ||
dataType: 'json' | ||
}); | ||
}); | ||
|
||
// Start the ForceAtlas2 algorithm: | ||
s.startForceAtlas2({worker: true, barnesHutOptimize: false}); | ||
} | ||
}); | ||
} | ||
</script> | ||
</head> | ||
<body onload="init();"> | ||
<div id="container"> | ||
<style> | ||
#graph-container { | ||
top: 0; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
position: absolute; | ||
} | ||
</style> | ||
<div id="graph-container"></div> | ||
</div> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Perform 2018 - Sample 3 | ||
|
||
This example is a modification of [Sample 2](../02-topology-service-tagging). | ||
|
||
Instead of Services a map of dependent processes is getting displayed. | ||
The required data is getting queried from via Dynatrace Topology and Smartscape API via REST Calls. | ||
Visualization is still taken care of by Sigma.js. | ||
|
||
To use this example with your own Dynatrace environment, just replace the placeholder with your own environment id and API key. |
Oops, something went wrong.