{"componentChunkName":"component---src-templates-default-template-tsx","path":"/ki-syntax/definitions/variables/","result":{"data":{"asciidoc":{"id":"5cdb1fbe-348c-5765-bcc1-d7a45038d481","html":"<div id=\"toc\" class=\"toc\">\n<div id=\"toctitle\">Table of Contents</div>\n<ul class=\"sectlevel1\">\n<li><a href=\"#_variable_introduction\">Variable Introduction</a>\n<ul class=\"sectlevel2\">\n<li><a href=\"#todo-variables\">Todo Variables</a></li>\n<li><a href=\"#special-variables\">Special Variables</a></li>\n<li><a href=\"#virtual-variables\">Virtual Variables</a></li>\n</ul>\n</li>\n</ul>\n</div>\n<div class=\"sect1\">\n<h2 id=\"_variable_introduction\">Variable Introduction</h2>\n<div class=\"sectionbody\">\n<div class=\"admonitionblock important\">\n<table>\n<tr>\n<td class=\"icon\">\n<i class=\"fa icon-important\" title=\"Important\"></i>\n</td>\n<td class=\"content\">\n<div class=\"paragraph\">\n<p>Variable names are limited by the underlying tokenizer to contain:</p>\n</div>\n<div class=\"ulist\">\n<ul>\n<li>\n<p>Alphanumerical characters <code>A-Z</code>, <code>a-z</code>, <code>1234567890</code></p>\n</li>\n<li>\n<p>Underscore <code>_</code></p>\n</li>\n<li>\n<p>Slash <code>/</code></p>\n</li>\n</ul>\n</div>\n</td>\n</tr>\n</table>\n</div>\n<div class=\"paragraph\">\n<p>HIRO variables are largely defined by the users. Variables are\ndesigned to be reused throughout the entire HIRO installation.\nDefined variables are stored in the database and are available for\n(re)use for all users. Typically (with the exception of temporary/local\nvariables) each variable is defined during initial creation to contain a\nspecific type of data e.g.:</p>\n</div>\n<table class=\"tableblock frame-all grid-all stretch\">\n<caption class=\"title\">Table 1. Variable Examples</caption>\n<colgroup>\n<col style=\"width: 25%;\">\n<col style=\"width: 25%;\">\n<col style=\"width: 25%;\">\n<col style=\"width: 25%;\">\n</colgroup>\n<thead>\n<tr>\n<th class=\"tableblock halign-left valign-top\">Variable</th>\n<th class=\"tableblock halign-left valign-top\">Description</th>\n<th class=\"tableblock halign-left valign-top\">Content</th>\n<th class=\"tableblock halign-left valign-top\">Example</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">IPv4Address</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">Contains an IPv4 address.</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">IPv4 address as string.</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">192.168.0.1,<br>\n 192.168.0.2,<br>\n 192.168.0.3</p></td>\n</tr>\n<tr>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">Interface</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">Contains a Network interface name.</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">Interface name as\nstring.</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">eth0,<br>\neth1</p></td>\n</tr>\n</tbody>\n</table>\n<div class=\"admonitionblock important\">\n<table>\n<tr>\n<td class=\"icon\">\n<i class=\"fa icon-important\" title=\"Important\"></i>\n</td>\n<td class=\"content\">\n<div class=\"paragraph\">\n<p>Variable definitions are <strong>immutable</strong> once defined, therefore great care\nshould be taken when defining new variables. This should be a process\ninvolving key staff from all groups of HIRO users. Customers can\nand <em>should</em> define their best practice naming and definition standards\nfor HIRO variables during the initial rollout process.</p>\n</div>\n</td>\n</tr>\n</table>\n</div>\n<div class=\"admonitionblock note\">\n<table>\n<tr>\n<td class=\"icon\">\n<i class=\"fa icon-note\" title=\"Note\"></i>\n</td>\n<td class=\"content\">\nMake sure to define all variables you wish to use\n<em>before</em> their first occurrence in an Issue.\n</td>\n</tr>\n</table>\n</div>\n<div style=\"page-break-after: always;\"></div>\n<div class=\"sect2\">\n<h3 id=\"todo-variables\">Todo Variables</h3>\n<div class=\"paragraph\">\n<p>Each Issue must contain at least one \"Todo\"-Variable otherwise it will\nautomatically be marked as \"resolved\" without any actual processing. The\nuser can define variables with a special \"Todo\" flag that are\nexclusively used to track progress. HIRO will use \"Todo\"-Variables\nto track if a task has been completed. Issues will remain in processing\nuntil all values from all \"Todo\" variables in this Issue have been\nremoved.</p>\n</div>\n<div class=\"paragraph\">\n<p>The user can create a variable <code>HostIsDown</code> to which a list of hostnames\nthat should be reachable is stored. The variable can contain a list of\nvalues like:</p>\n</div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight\"><code class=\"language-elixir\" data-lang=\"elixir\">HostIsDown = [\"192.168.1.100\",\"192.168.1.101\",\"192.168.1.102\"]</code></pre>\n</div>\n</div>\n<div class=\"paragraph\">\n<p>Now a set of Knowledge Items are triggered by the existence of\n<code>HostIsDown</code> and start taking measures to restore service for these\nhostnames. Once they are confirmed to be available again the respective\nhostname is deleted from the list of values in <code>HostIsDown</code>. Once all\n\"Todo\"-Variables have been emptied, the Issue is considered to be\nfinished and will be \"resolved\". As long as there are any values present\nin any of the \"Todo\"-Variables, the Issue will remain in processing\nuntil Knowledge Items have removed all values, the Issue was resolved\nmanually or ejected by other means.</p>\n</div>\n<div style=\"page-break-after: always;\"></div>\n</div>\n<div class=\"sect2\">\n<h3 id=\"special-variables\">Special Variables</h3>\n<div class=\"paragraph\">\n<p>There are a few variables that have special meaning and contain information\nabout the issue processing.</p>\n</div>\n<table class=\"tableblock frame-all grid-all stretch\">\n<colgroup>\n<col style=\"width: 50%;\">\n<col style=\"width: 50%;\">\n</colgroup>\n<thead>\n<tr>\n<th class=\"tableblock halign-left valign-top\">Variable</th>\n<th class=\"tableblock halign-left valign-top\">Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">ogit/_id</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">The graph ID of the vertex, often referred to as \"issue ID\"</p></td>\n</tr>\n<tr>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">ogit/_created-on</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">Timestamp of issue creation in ms since epoch</p></td>\n</tr>\n<tr>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">ogit/_modified-on</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">Timestamp of last issue modification in ms since epoch</p></td>\n</tr>\n<tr>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">ogit/subject</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">Human readable issue subject shown in frontend UI</p></td>\n</tr>\n<tr>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">ogit/status</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">Current state of the issue</p></td>\n</tr>\n<tr>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">ogit/Automation/originNode</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">ID of the vertex the issue was originally created on</p></td>\n</tr>\n<tr>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">ogit/Automation/processingNode</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">ID of the vertex the issue is currently attached to</p></td>\n</tr>\n<tr>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">ogit/Automation/processingTimestamp</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">Timestamp value of the last processed KI (ms). It is updated with each KI execution and displayed in the task content</p></td>\n</tr>\n<tr>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">ogit/Automation/deployStatus</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">Deployment status of issue in engine</p></td>\n</tr>\n</tbody>\n</table>\n<div class=\"paragraph\">\n<p>With the exception of ogit/subject, these variables should be regarded as \"read-only\"\nfor KI processing.</p>\n</div>\n<div class=\"paragraph\">\n<p>[[Self-generated Variables]]\n=== Self-generated Variables</p>\n</div>\n<div class=\"paragraph\">\n<p>These are variables that are self-generated in the moment that one of the components: Issue, Node or KI exists.</p>\n</div>\n<div class=\"paragraph\">\n<p><code>IID</code> – it is ogit/_id of an Issue that comes into HIRO</p>\n</div>\n<div class=\"paragraph\">\n<p><code>NodeID</code> – it is ogit/_id of a vertex/Node from the semantic graph</p>\n</div>\n<div class=\"paragraph\">\n<p><code>KIID</code> – It is ogit/_id of a KI</p>\n</div>\n<div class=\"paragraph\">\n<p>These values are auto imported and explicit matching in conditions.</p>\n</div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight\"><code class=\"language-elixir\" data-lang=\"elixir\">do\n  Taskid = IID</code></pre>\n</div>\n</div>\n</div>\n<div class=\"sect2\">\n<h3 id=\"virtual-variables\">Virtual Variables</h3>\n<div class=\"paragraph\">\n<p>There are variables that will be available only within KI processing context and are not\nactually stored or visible in the graph representation of the issue.</p>\n</div>\n<div class=\"sect3\">\n<h4 id=\"_execidle\">ExecIdle</h4>\n<table class=\"tableblock frame-all grid-all stretch\">\n<colgroup>\n<col style=\"width: 50%;\">\n<col style=\"width: 50%;\">\n</colgroup>\n<thead>\n<tr>\n<th class=\"tableblock halign-left valign-top\">Variable</th>\n<th class=\"tableblock halign-left valign-top\">Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">ExecIdle</p></td>\n<td class=\"tableblock halign-left valign-top\"><p class=\"tableblock\">Seconds since last KI execution. It is dinamically calculated from the ´ogit/Automation/processingTimestamp´</p></td>\n</tr>\n</tbody>\n</table>\n<div class=\"paragraph\">\n<p>A simple example that would make use of the ExecIdle variable to trigger a KI only after\nno other KI could be executed for about 5 minutes (only minimal WHEN and DO sections shown):</p>\n</div>\n<div class=\"listingblock\">\n<div class=\"content\">\n<pre class=\"highlight\"><code class=\"language-elixir\" data-lang=\"elixir\">when\n  ExecIdle &gt; 300\ndo\n  log(\"Issue has been idle for 5 minutes\")</code></pre>\n</div>\n</div>\n<div class=\"paragraph\">\n<p>Let&#8217;s illustrate the relationship between <code>ExecIdle</code> and <code>processingTimestamp</code> using the <code>Sleep</code> function. The <code>Sleep</code> function pauses the engine from searching KIs for 10 seconds. During this pause, <code>ExecIdle</code> will be 0 with the last KI execution and will increase over time. Meanwhile, <code>ogit/Automation/processingTimestamp</code> will store the timestamp of the last executed KI. After the 10-second pause, <code>ExecIdle</code> will be 10, and the task will resume, searching for KIs that can complete it.</p>\n</div>\n<div class=\"imageblock\">\n<div class=\"content\">\n<img src=\"/7.0/images/ki-syntax/ExecIdleProcessingTimestamp.png\" alt=\"ExecIdleProcessingTimestamp.png\">\n</div>\n</div>\n</div>\n</div>\n</div>\n</div>","document":{"main":"2.Variables","title":"2.Variables","subtitle":""},"fields":{"toc":true,"location":["ki-syntax","definitions","variables"]}},"sidebarYaml":{"id":"6f28bdca-d703-5e79-ae00-b0508f8ee82a","showIndex":true}},"pageContext":{"id":"5cdb1fbe-348c-5765-bcc1-d7a45038d481","parent":"ki-syntax"}},"staticQueryHashes":["1010459453","1010459453","2356112386","2356112386","2603905930","2603905930","3026652197","3026652197","3167850324","3167850324","63159454","63159454"]}