Here’s a typical example of a “Health Check” script that is pinging systems based on their URL and updating the status in the corresponding node in the graph.

<!DOCTYPE etl SYSTEM "https://scriptella.org/dtd/etl.dtd">
<etl>
<description>Healt Check Systems</description>
<connection id="logInfo" driver="log">
level=INFO
</connection>
 
<connection id="neo4j" driver="graphConnection">
project_id=123
query_empty_value=
</connection>
<connection id="java" driver="janino"></connection>
 
<query connection-id="neo4j">
MATCH (node) WHERE node.type = 'service'
RETURN node.url as url, ID(node) as nodeId
<query connection-id="java">
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
//ping url
URL result = new URL(String.valueOf(get("url")));
HttpURLConnection http = (HttpURLConnection)result.openConnection();
int statusCode = http.getResponseCode();
http.disconnect();
// set result to the job context to make it available for other steps in the job
set("status_result", statusCode);
// execute embedded queries (the logInfo and neo4j steps below)
next();
<script connection-id="logInfo">
Node ID: $nodeId | Returned status: $status_result
</script>
<query connection-id="neo4j">
MATCH (n) WHERE ID(n)=$nodeId SET n.status='$status_result'
</query>
</query>
</query>
 
</etl>