Selecting Hosts

Database Performance Monitor lets you manage collections of servers together and drill down into individual hosts as needed. For example, you can view Top Queries across all of your hosts, filter out some of them, or drill down to individual hosts.

The entire DPM web application operates on a set of hosts at once, and this set is controlled by the Host Filter in the top navigation bar. Type in the text field to do a full-text fuzzy-search against hosts. You can also click on an item in the dropdown menu.

Host Filter Expanded

While editing the Host Filter, you’ll see a hint to the right of the text field that you need to press Enter to apply the changes you’ve made.

The selected hosts are filtered by the currently selected time range. Hosts are included only if they are actively reporting data in the time range. We broaden the time range by an hour so that recently active hosts will not disappear immediately.

The Host Filter operates as a simple substring match by default. That is, if you type webapp into the Host Filter, any host whose name includes the substring webapp will become part of the set of active hosts. In the illustration above, webapp1 and webapp2 will be selected. However, api1 and api2 would not be selected, because they don’t contain the substring webapp.

The Host Filter is more than a simple substring match, however. It supports a more advanced selection syntax.

  • You can match hostnames exactly by using the = modifier. The string =api2, for example, will match a host named api2 but not one named api20. Note: Wrapping a search filter with double quotes no longer restricts results to an exact match.
  • You can select hosts by their type (os, mysql, pgsql, redis and mongo at present), with syntax such as type=os or type=mysql.
  • You can also use Google Go’s (previously, JavaScript’s) regular expression syntax. The expression must start and end with /. For example, /webapp[5-7]/ will match webapp5 but not webapp2. This match is performed against the databases’s hostname only, and not the description.

Hosts can also optionally be tagged with custom labels from the Hosts List page. Once tagged, you can match all hosts with a given tag using the #tagname syntax. Tags cannot contain spaces or commas, but otherwise just about anything can be used for a tag name. For more information on applying tags to hosts, visit the documentation for the Inventory page.

Syntax changes and improvements

With the latest updates, host filtering functionality and syntax is now expanded and improved. Host filtering is now done 100% service-side. All host filtering functionality now is available to all instances of DPM: whether you’re using the Web application, the Slack application, or using direct API calls - and the behavior is identical.

For syntax, you can now also use tag expressions, Google Go regular expressions (regular expressions were previously JavaScript-based), and logical operators (AND, OR, NOT) to refine your search. In addition, you can optionally include all ancestors or descendants of a particular host or set of hosts in the search results.

In most cases, the updated syntax improvements are backwards compatible, and any filtering you’ve used before will likely continue to work the same. However, there are some instances where you may need to recreate a filter to get the results you want. Here are some examples:

  • Matching host names exactly now uses the = modifier instead of double quotes (as a result, double quotation marks are now more powerful, and you can include spaces in your searches).
  • If needed, you can use double quotation marks to include special characters (like # and ^) in search results.
  • In complex regular expression filters, there may be differences between the previous JavaScript regular expression syntax and the new Google Go regular expression syntax.

Basic and advanced syntax with examples

The following table shows the different kinds of syntax you can use for host filtering, with examples and expected results.

Filter by Syntax Example Result
host id hostid 40 Host with ID 40
multiple host ids hostid1, hostid2 40,41 Hosts with IDs 40 and 41
host name hostname myhost Host with the name myhost. Partial matches are included
exact host name =hostname =myhost Host with the name myhost. Only an exact match is included
host type type=os|mysql|pgsql|redis|mongo type=os Hosts with type os
regular expression Google Go regexp syntax /webapp[5-7]/ Hosts with a name that match the regular expression
tag # #prod Hosts that contain the prod tag
include ancestors _ _40 Host with ID 40 and all its ancestors
include descendants ^ ^myhost Host with the name myhost and all its descendants
include both * *type=os Hosts with type os and all their ancestors and descendants
tag expressions tags[“tag_name”]=value tags["aws_region"]=us-east-1 Hosts where the tag aws_region is set to us-east-1
tag expressions (cont.) tags.tagname>number or tags.tagname<number tags.version>8 Hosts with tag version larger than 8
logical operators AND, OR, NOT 3,4,5 AND myhost Hosts with IDs 3, 4, or 5, and any host with the name myhost
logical operators (cont.) AND, OR, NOT master AND #prod AND NOT type=os Hosts containing both the name master and the tag prod, without the type os.
logical operators (cont.) AND, OR, NOT ^mycluster OR (/mongo[1-3]/ AND #sometag) Hosts containing the name mycluster and all descendants, or hosts with a name that matches the /mongo[1-3]/ regular expression while also having the sometag tag.