Linux Commands, Metric Queries, and Resource Commands

Updated 1 month ago by Shoreline

Linux commands

Op supports the execution of Linux commands on resources specified by an Op resource query command

Example:  op> host | .pod | .container | `ps aux`

Metric query

This query retrieves metric data on all the hosts from a prior resource query.  If there is no prior resource query, Op will retrieve metric data on all hosts.

Examples:

  • op> host | cpu_usage | real_time = true | window(10s)
  • op> container | metric_query(metric_names="container_cpu_usage_seconds_total") / 60 | real_time = true | window(10s)

Resource commands

The resources() and resource_path_entry() commands are used to define resource queries. In the example below, we show how we simplified resource queries (for example resources(type=”HOST”) | resource_path_entry(type=”POD”)) by using predefined  symbols.  The default symbol “host” was created like so: resource host = resources(type=”HOST”), and .pod will be replaced with resource_path_entry(type=”POD”).

Examples:

  • resources(type="HOST") (Typically written as host using substitution)
  • resources(type="HOST") | resource_path_entry(type="POD") (typically written as host | .pod using substitution)
  • host | limit=2
  • pod | namespace="istio-system"


How did we do?