The New Relic Servers page—available by selecting Servers from the product picker at the top of each New Relic page—provides a helpful list of all the servers you’re monitoring. However, many environments have a mixture of different servers for different purposes. These all show up together into the same list, making it challenging to differentiate the status of different kinds of servers.
For example, you may be monitoring both production and pre-production servers. Nearing capacity on production servers is a big deal, but may not be on pre-production servers. Or maybe you need to compare performance across multiple data centers for capacity planning.
Wouldn’t it be great if you could categorize your servers in these various ways and then view them in terms of these different groups?
Now you can, thanks to two new features, labels and categories. This post will explain how to use the new features in the user interface, show some ways the features can be used, and then discuss how to give a server its labels.
Using these new features is easy; just click on the ‘Filter servers’ edit box on the Servers page. Typing in the edit box will filter the server list and display categories with which you can combine servers into groups.
You can use category rollups to make any type of server groups you desire. Useful examples include grouping servers across environments (development, staging, or production), data centers (East-US, West-US, etc.) and across applications or functions (database, Web server, app server).
Filtering and roll ups are useful for more than just finding the server you are looking for, though. For example, do the following on the Servers page after you’ve set up a few categories and you have a handy tool for capacity planning:
First, filter by the label Production.
Next, roll up by data center and choose one.
Finally, sort servers by the Memory metric, descending.
Now you can see how production servers in your East-US data center are doing memory-wise, and can plan accordingly. Cool!
Troubleshooting specific issues
You can do something similar for tracking down very specific issues. For example, are you noticing slowness in permission-related activities for your customers in California? Filter your servers by datacenter (Westus), service (Permissions), and environment (Production). Voila! You now know which server to investigate.
Servers filtered by service, environment, and datacenter used to track down permissions issues for California users.
The roll up summary view makes it easy to spot problems by category as well. For example, if you roll up your servers by environment you can easily verify that the local environment has a problem, as it has only one server and that server is not currently reporting. However, you can see that your production environment has five servers that are in the green (although you may want to investigate the production servers that are in the red and not reporting).
Roll up by environment to see at a glance how each environment’s servers are doing overall.
It’s simple to set categories in several different ways. In addition to the user interface on the Servers page, you can also set a label and category via the REST API. An easy way to use the REST API is to visit the REST API explorer, which includes a Labels section where you can add labels to servers.
You can also set labels and categories during server agent deployment. For example, you can see your hosts categorized by production, staging, and development (or whatever environment names you use) just by setting the labels field in New Relic’s Linux server agents’ configuration files. For example, the line in the configuration file for a local server running a permissions service should look like this:
This will set the environment category for this server to Local and set the service category value to Permissions. This line can be added manually or via a script depending upon how you install New Relic’s Linux server agents on your server(s). More information about this is in the Configuration settings section of the New Relic server configuration documentation.
Now that you have an idea of how to use labels and categories, enjoy slicing and dicing your server data! For more information about using these features, go to New Relic’s labels and categories documentation page.