Op Functions Introduction

Updated 4 months ago by Shoreline

Op is a powerful interactive CLI based upon an operations oriented language for gathering information about your infrastructure and proactively managing issues in order to maintain a stable operational environment.  Op has five types of objects that you will be working with:

  1. Resources - the infrastructure objects in your environment.  Resources can be hosts, pods, containers, virtual machines, database instances etc.  On different platforms, you can have different resources e.g. pods and containers for Kubernetes and virtual machines for AWS, GCP, or Azure. 
  2. Metrics - time series data associated with your resources such as CPU utilization, latency, throughput, or error rate.  You can query the metrics gathered to monitor the environment.  You also use metrics to determine if a condition or threshold has been met which requires an Action to be taken.
  3. Alarms - indicators that tell you when something has gone wrong and/or needs attention.  Alarms are defined on metrics, resources, and system state and are triggered when a condition is met.
  4. Actions - shell commands and shell scripts that help you mitigate and remediate the problem that an Alarm has identified.  The Op CLI comes with a basic set of actions.  You can define custom actions and encode an entire operational workflow into a runbook using Actions. 
  5. Bots - bind Alarms and Actions together using IF-THEN-ELSE constructs.  Bots specify the action or set of actions to take when the alarm triggers.

Op has five types of functions that you will be performing on objects:

Op functions are similar to the basic Create Read Update Delete (CRUD) functions that you are likely used to working with in other languages.
  1. Define - creates new objects.
  2. Get - returns the value of a specified field inside of an object.
  3. List - returns all instances of the object type specified.
  4. Update - modifies the description, value, arguments, approvers, and enabled state of existing objects.
  5. Delete - erases existing objects.

Op objects support symbolic manipulation.  The Op functions bind the symbol to the underlying query or action.  This Glossary provides the syntax and examples for each function.

How did we do?