Two of the Most Common Mistakes Developing Scripts

three professionals gathered around a laptop, collaborating on work in an office setting

Notice: This blog post was originally published on Indeni before its acquisition by BlueCat.

The content reflects the expertise and perspectives of the Indeni team at the time of writing. While some references may be outdated, the insights remain valuable. For the latest updates and solutions, explore the rest of our blog

Key Takeaways
  • Indeni scripts must perform explicit input validation to handle empty or null values returned from network devices.
  • Metrics that may not exist on all interfaces, such as tx-error counters, require default initialization or conditional checks before collection.
  • Rules that compare related metrics, like kernel table entries versus limits, should only collect data when all required metric values are present.
  • Incomplete metric data leads to “unknown” rule evaluation states, which can cause false positives and unresolved issues.
  • Vendor-agnostic rules depend on consistent metric and tag names, so IND scripts must align exactly with the rule’s expected names.
  • Missing or incorrect tags (for example, omitting the “name” tag for a “memory-usage” metric) will prevent associated alerts from triggering.


When you are learning something new there are always periods of trial and error – especially when it comes to scripting. After taking Indeni Knowledge Language training, our community members put their skills to the test by writing commands and rules. We asked our Knowledge Experts what advice they would give to newbies, and we came up with the top two below. See below for some of the common mistakes made in developing Indeni scripts.

Common Mistake #1: Incomplete Input Validation

When receiving data from the network device, it is important to validate the data and consider empty or null data. For example, a device may have different type of interfaces. Some interface have tx-error stat and some other interface do not have tx-error stat. You are expecting the tx-error stat will trigger an alert once it cross certain threshold. The ind script for collecting this tx-error was written like this (pseudo code):

for( index_of_table = 1; index_of_table < index_interface + 1; index_of_table++ ){
    writeDoubleMetric(“tx-error”, tags, "gauge", 60, array_interfaces
[index_of_table, “tx-error”])
}

This will be a problem if some of the interfaces have no such metric. To correct this, we either initialize this metric for all interfaces to 0 at the beginning(not going to show here), or put a check before collecting it. Here is a pseudo sample after the correction:

for( index_of_table = 1; index_of_table < index_interface + 1; index_of_table++ ){
    If ( array_interfaces[index_of_table, “tx-error”] == “”) {
        array_interfaces[index_of_table, “tx-error”] = 0
   }
   writeDoubleMetric(“tx-error”, tags, "gauge", 60, array_interfaces
[index_of_table, “tx-error”])
}

Another example is the kernel table metric collection for a Palo Alto Networks firewall device. The kernel table rule is checking the actual entries against the table size limit. So both of the actual number of table entries and table limit should be present for the rule to work properly. The problem is, sometimes the device does not return the table limit simply because there isn’t a limit. The IND script should test if both of these two metric values are present; if any value is missing, we should not be collecting the metrics.
Here is the pseudo code which has the problem:

writeDoubleMetric(“fw-table-entries”, tags, "gauge", 60, tableEntries)
writeDoubleMetric(“fw-table-limit”, tags, "gauge", 60, tableLimit)
The following  pseudo code will fix the problem,
If (tableEntries != “” && tableLimit != “”) {
    writeDoubleMetric(“fw-table-entries”, tags, "gauge", 60, tableEntries)
    writeDoubleMetric(“fw-table-limit”, tags, "gauge", 60, tableLimit)
 }

The reason behind the metric value checking is, when a rule evaluates the data, there are three possible outcomes:

  • Resolved with no issue
  • Issue detected
  • Unknown – incomplete data to compute the result

The “unknown” normally is rooted from empty metric and has been very problematic causing false positives and issues not automatically resolved.

Common Mistake #2: Missing or Incorrect Tags

A rule is typically vendor agnostic and is shared among many devices. In addition to making sure that the metric name in the IND script matches the metric name, the tag name is often overlooked.

For example, this is the templated cross vendor rule for checking memory usage. You will find the rule here.

Notice the “applicableMetricTag” field with the value “name”. Your IND script needs to have the tag called “name” and metric name “memory-usage”. Otherwise, you would not see the alert.

Here is an example of the IND script for Juniper SRX. You will need to collect the metric name “memory-usage” with a tag name “name”.

You will find the actual Indeni script here.

These lessons learned were crowd-sourced from our community of certified IT professionals. Are you interested in learning how to code in Indeni Knowledge Language? Get started today by joining the Indeni Crowd and turn your domain expertise into automation.

If you found this article to be helpful, please share with your social networks. If you have feedback or other best practices you use please comment below. Thanks!


An avatar of the author

Ulrica de Fort-Menares is the Vice President of Product Management for Infrastructure Assurance.

Related content

Flock of geese flying in formation across a blue sky, framed by a pink graphic border, symbolizing coordinated network migrat

Automate your DDI modernization path by migrating with Micetro

Automate cross-platform DNS and DHCP migration with Micetro to reduce risk, eliminate manual effort, and modernize infrastructure faster.

Read more
Three armored figures walking toward a futuristic Las Vegas skyline with pyramids, glowing orb, and "Welcome to Fabulous Las

Your journey to intelligent NetOps begins at Cisco Live

Visit BlueCat’s booth or book a meeting now to learn more about how our solutions can help you build a network that supports constant change.

Read more
Stacked colorful wooden directional arrows on a post by a calm seaside with distant hills and blue sky

Replace BIND and ISC with Micetro DNS/DHCP Server (MDDS)

Tired of patching and manually configuring BIND DNS and ISC DHCP? Discover how Micetro MDDS appliances can replace them for modern DDI.

Read more
Row of orange industrial robotic arms positioned along an automated conveyor belt in a factory setting

Automate it all in Integrity with REST v2 API-first DDI management

Discover API-first DDI with Integrity X by using REST v2 to automate DNS, DHCP, and IPAM for scalable, secure network operations.

Read more