> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.itential.com/itential-platform/2023-2/studio/templates/analytic-templates/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server. # Analytic templates > Compare Pre and Post command response pairs against analytic rules without running commands on devices at execution time. Analytic templates evaluate pairs of command responses — labeled **Pre** and **Post** — against a set of rules. Unlike command templates, they do not run commands on devices at execution time. Instead, they consume responses already collected at earlier stages of the automation and compare the Pre and Post outputs against each other. See [Command templates](/itential-platform/studio/command-templates/overview) for information on how Pre and Post responses are collected. ## Prerequisites * A working NSO instance with at least one device using a live-status capable NED. Netsim devices may not work. * The `itential_tools` NSO package pre-loaded. ## Create an analytic template #### Open Studio Click **Studio** in the left nav. #### Open the Create dialog Click the **+** icon in the top toolbar. #### Select analytic template Select **Analytic Template** from the dropdown. #### Name and create Enter a name and click **Create**. ![](/_fern-img/6bbf4385d65479dfa87430215f9702432acc382977cac4bc953e026eed4fcd42.webp) ## Define an analytic template ![](/_fern-img/2e4d3b746939bf3e9fe7aa50335ea525a27a131be358cbcbf1f8a7ac6256ba0b.webp) | Label | Action | | :---: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 1 | Select a device from the **Device Name** dropdown, or use the magnifying glass to search. | | 2 | Set the global command pass logic using the dropdown. See [Global command pass](#global-command-pass). | | 3 | Select a command template in the **Pre Template** and **Post Template** dropdowns. | | 4 | Set the command pair (Pre and Post Command) to test against the device. | | 5 | Select a [rule](#rules) type and [severity](#severity) level. | | 6 | Click **+ Rule** to add a rule to the command. | | 7 | Set the global rules pass logic using the dropdown. See [Global rules pass](#global-rules-pass). | | 8 | Click **Test Run** to test the command. Passed rules are marked with a green check; failed rules with a red minus. The device response appears at the bottom of the screen. | | 9 | Click **+ Command Pair** to add a command to the template. | ### Global command pass Controls pass logic at the template level. ![](/_fern-img/39c5e72ba45f059f648b1d40fdeb20147d5efb1b2e423b3ce059d28383ae7356.webp) | Option | Behavior | | :----------------------------------------- | :--------------------------------------------------- | | All commands must pass (default) | Every rule in every command must pass. | | All commands must pass (warn/info as pass) | No errors may be present in the template. | | One command must pass (default) | All rules in at least one command must pass. | | One command must pass (warn/info as pass) | At least one command with no errors must be present. | ### Rules ![](/_fern-img/6daf0b6ee85c49450842bd56c087ef2cf484d850908c285fd20b7ac45f47a8a5.webp) | Rule | Description | | :--------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `regex` | Extracts values using capture groups and compares them using a regex operator. | | `table` | Extracts keys and values from a table dataset and checks that all keys and values match. Useful when row order may change. | | `matches` | Compares the Pre and Post responses in full. Passes when the responses are equivalent. An optional ignore pattern can exclude parts of the response from comparison. | | `!matches` | Compares the Pre and Post responses in full. Passes when the responses differ. An optional ignore pattern can exclude parts of the response from comparison. | ### Regex operators ![](/_fern-img/471abf47724e381bf713794b5d8a14a68daa6f2db8e48f533215631d7e4cf634.webp) | Operator | Description | | :------: | :---------------------------------------------------------------------------------------------------------------------------------------------- | | `=` | `true` if the Pre and Post values are equal. | | `!=` | `true` if the Pre and Post values are not equal. | | `<=` | `true` if the Pre value is less than or equal to the Post value. | | `<` | `true` if the Pre value is less than the Post value. | | `>=` | `true` if the Pre value is greater than or equal to the Post value. | | `>` | `true` if the Pre value is greater than the Post value. | | `%` | Calculates `100 × (Post / Pre)` and returns `true` if the result is greater than or equal to the threshold entered in the **Post/Pre %** field. | ### Severity Severity applies only when a rule has failed. The default is `error`. ![](/_fern-img/5a1c1a89b1365148140c121d15e5c86a4f1ec0a7c447e769e6af2519a441ea37.webp) | Level | Meaning | | :-------: | :--------------------------------------------------------------- | | `error` | Something is wrong; a specific action may need to be taken. | | `warning` | Something to be aware of that could potentially cause a problem. | | `info` | Informational; no action required. | ### Flags Flags apply to `matches` and `!matches` rules. Each command may have one or more rules bound by a boolean pass flag: * Pass flag `true` (on) — AND logic: all rules must pass. * Pass flag `false` (off) — OR logic: at least one rule must pass. | Flag | Description | | :--: | :------------------------------------------------------------------------- | | `i` | Case-insensitive matching. | | `g` | Global search; retains the index of the last match for iterative searches. | | `m` | Multi-line; `^` and `$` match the start and end of each line. | ### Global rules pass Controls pass logic at the command level. | Option | Behavior | | :------------------ | :------------------------------------------ | | All Rules must pass | Every rule in the command must pass. | | One Rule must pass | At least one rule in the command must pass. | ![](/_fern-img/effc5a87c25b820f405ea229103e6e15a37ea441bfcfbf35c2a0241b2c81d0ae.webp) > Compare Pre and Post command response pairs against analytic rules without running commands on devices at execution time.