Skip to content

Commit

Permalink
Merge pull request #554 from newrelic/relatedinfo-to-rr
Browse files Browse the repository at this point in the history
Relatedinfo to rr
  • Loading branch information
jerelmiller authored Aug 7, 2020
2 parents 3cd3944 + 773022e commit 22def16
Show file tree
Hide file tree
Showing 16 changed files with 979 additions and 851 deletions.
5 changes: 5 additions & 0 deletions src/components/RelatedContentModules/Resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ const SITE_TAGS = {
developer: 'https://developer.newrelic.com',
'open source': 'https://opensource.newrelic.com',
docs: 'https://docs.newrelic.com',
github: 'https://github.com',
terraform: 'https://terraform.io',
kubernetes: 'https://kubernetes.io',
youtube: 'https://youtube.com',
discuss: 'https://discuss.newrelic.com',
};

const findTag = (resource) =>
Expand Down
62 changes: 30 additions & 32 deletions src/markdown-pages/automate-workflows/5-mins-tag-resources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ description: 'Add tags to applications you instrument for easier filtering and o
tileShorthand:
title: 'Quickly tag resources'
description: 'Add tags to apps for easy filtering'
resources:
- title: 'Understand the Entity Explorer'
url: https://youtube.com/watch?v=IGZQup8ZEmE
- title: 'Use tags to organize and group what you monitor'
url: https://docs.newrelic.com/docs/new-relic-one/use-new-relic-one/core-concepts/tagging-use-tags-organize-group-what-you-monitor
- title: 'New Relic CLI Repo'
url: https://github.com/newrelic/newrelic-cli
---

<Intro>
Expand All @@ -28,28 +35,28 @@ For this guide you need your New Relic [personal API Key](https://docs.newrelic.

You can download the New Relic CLI via [Homebrew](https://brew.sh/) (macOS), [Scoop](https://scoop.sh/) (Windows), and [Snapcraft](https://snapcraft.io/) (Linux). You can also download [pre-built binaries](https://github.com/newrelic/newrelic-cli/releases) for all platforms, including .deb and .rpm packages, and our Windows x64 .msi installer.

* #### Linux
- #### Linux

With [Snapcraft](https://snapcraft.io/) installed, run:
With [Snapcraft](https://snapcraft.io/) installed, run:

`sudo snap install newrelic-cli`
`sudo snap install newrelic-cli`

* #### macOS
- #### macOS

With [Homebrew](https://brew.sh/) installed, run:
With [Homebrew](https://brew.sh/) installed, run:

`brew install newrelic-cli`
`brew install newrelic-cli`

* #### Windows
- #### Windows

With [Scoop](https://scoop.sh/) installed, run:
With [Scoop](https://scoop.sh/) installed, run:

`scoop bucket add newrelic-cli https://github.com/newrelic/newrelic-cli.git`<br />
`scoop install newrelic-cli`
`scoop bucket add newrelic-cli https://github.com/newrelic/newrelic-cli.git`<br />
`scoop install newrelic-cli`

</Step><Step>

## Create your New Relic CLI profile
## Create your New Relic CLI profile

New Relic CLI profiles contain credentials and settings that you can apply to any CLI command.

Expand All @@ -72,7 +79,7 @@ In the terminal, run [`entity search`](https://github.com/newrelic/newrelic-cli/

```bash lineNumbers=false
# Change the `name` to match any of your existing entities
newrelic entity search --name "test"
newrelic entity search --name "test"
```

</Step><Step>
Expand All @@ -92,24 +99,29 @@ Select an entity from the results and look for its `guid` value; the `guid` is t
"type": "WORKLOAD"
},
```

</Step><Step>

## Add tags and tag lists to your entity

With your entity `guid`, you can add tags right away. You can do so by invoking the [`entities tags create`](https://github.com/newrelic/newrelic-cli/blob/master/docs/cli/newrelic_entity_tags_create.md) command.
With your entity `guid`, you can add tags right away. You can do so by invoking the [`entities tags create`](https://github.com/newrelic/newrelic-cli/blob/master/docs/cli/newrelic_entity_tags_create.md) command.

What if you want to add multiple tags? You can use tag sets for that: While tags are key-value pairs separated by colons, tag sets are comma-separated lists of tags. For example:

`tag1:value1,tag2:value2`

<Important>Adding tags is an asynchronous operation: it could take a little while for the tags to get created.</Important>
<Important>
Adding tags is an asynchronous operation: it could take a little while for the
tags to get created.
</Important>

```bash lineNumbers=false
# Adding a single tag
newrelic entity tags create --guid GUID --tag key:value
# Adding multiple tags
newrelic entity tags create --guid GUID --tag tag1:test,tag2:test
```

</Step><Step>

## Check that the tags are there
Expand All @@ -124,42 +136,28 @@ Tags can be deleted at any time by invoking the [`entity tags delete`](https://g

</Tip>


```json lineNumbers=false
[
{
"Key": "tag1",
"Values": [
"true"
]
"Values": ["true"]
},
{
"Key": "tag2",
"Values": [
"test"
]
"Values": ["test"]
},
{
"Key": "tag3",
"Values": [
"testing"
]
"Values": ["testing"]
}
// ...
]
```

</Step></Steps>

## Next steps

Have a look at [all the New Relic CLI commands](https://github.com/newrelic/newrelic-cli/blob/master/docs/cli/newrelic.md). For example, you could create a [New Relic workflow](https://docs.newrelic.com/docs/new-relic-one/use-new-relic-one/core-concepts/new-relic-one-workloads-isolate-resolve-incidents-faster) using [`workload create`](https://github.com/newrelic/newrelic-cli/blob/master/docs/cli/newrelic_workload_create.md).

If you'd like to engage with other community members, visit our [New Relic Explorers Hub](https://discuss.newrelic.com/c/build-on-new-relic/developer-toolkit) page. We welcome feature requests or bug reports on [GitHub](https://github.com/newrelic/newrelic-cli).

## Related info

- [Understanding Entity Explorer (Video)](https://www.youtube.com/watch?v=IGZQup8ZEmE)
- [Tagging: Use tags to organize and group what you monitor](https://docs.newrelic.com/docs/new-relic-one/use-new-relic-one/core-concepts/tagging-use-tags-organize-group-what-you-monitor)
- [New Relic CLI commands reference](https://github.com/newrelic/newrelic-cli/blob/master/docs/cli/newrelic.md)
- [New Relic CLI repository on GitHub](https://github.com/newrelic/newrelic-cli)

92 changes: 59 additions & 33 deletions src/markdown-pages/automate-workflows/get-started-kubernetes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ path: '/automate-workflows/get-started-kubernetes'
duration: '20 min'
title: 'Set up New Relic using the Kubernetes operator'
template: 'GuideTemplate'
description: "Learn how to provision New Relic resources using the [Kubernetes operator](https://github.com/newrelic/newrelic-kubernetes-operator)."
description: 'Learn how to provision New Relic resources using the [Kubernetes operator](https://github.com/newrelic/newrelic-kubernetes-operator).'
tileShorthand:
title: 'Set up New Relic using the Kubernetes operator'
description: 'Learn how to provision New Relic resources using the Kubernetes operator'
resources:
- title: 'New Relic Kubernetes operator'
url: https://github.com/newrelic/newrelic-kubernetes-operator
- title: 'New Relic documentation'
url: https://docs.newrelic.com
- title: 'Kubernetes documentation'
url: https://kubernetes.io/docs/home/
---

<Intro>

[Kubernetes](https://kubernetes.io/) is an open-source system for automating deployment, scaling, and management of containerized applications. You can use it to provision all kinds of infrastructure and services, including New Relic entities.
Expand All @@ -16,15 +24,14 @@ In this guide you'll learn how to set up New Relic for the first time with the o

</Intro>


## Before you begin

This walkthrough assumes you’ve already deployed a Kubernetes cluster. You could even create a local cluster on your machine with [`kind`](https://kind.sigs.k8s.io/).
To use this guide, you should have some basic knowledge of both New Relic and Kubernetes. To complete the full exercise, you’ll need to:

* Deploy a New Relic agent if you haven't done so yet. [Install New Relic](https://docs.newrelic.com/docs/agents/manage-apm-agents/installation/install-agent) for your application.
* [Install `kubectl`](https://kubernetes.io/docs/tasks/tools/install-kubectl/) and point it at the correct cluster, as this will determine the cluster where you’ll install the New Relic operator.
* [Install `kustomize`](https://kubernetes-sigs.github.io/kustomize/installation/).
- Deploy a New Relic agent if you haven't done so yet. [Install New Relic](https://docs.newrelic.com/docs/agents/manage-apm-agents/installation/install-agent) for your application.
- [Install `kubectl`](https://kubernetes.io/docs/tasks/tools/install-kubectl/) and point it at the correct cluster, as this will determine the cluster where you’ll install the New Relic operator.
- [Install `kustomize`](https://kubernetes-sigs.github.io/kustomize/installation/).

<Steps>
<Step>
Expand All @@ -38,6 +45,7 @@ kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/relea
```

Next, install the Kubernetes operator.

```bash lineNumbers=false
kustomize build https://github.com/newrelic/newrelic-kubernetes-operator/configs/default | kubectl apply -f -
```
Expand All @@ -61,10 +69,14 @@ kube-system Active 20m
newrelic-kubernetes-operator-system Active 3m48s
```

Now, make sure the Kubernetes operator's controller manager is running:
Now, make sure the Kubernetes operator's controller manager is running:

<small>
<em><strong>Note</strong>: Don't forget to include the <tt>--namespace (shorthand -n)</tt> option when running kubectl get pods to ensure you're inspecting resources within the correct namespace.</em>
o
<em>
<strong>Note</strong>: Don't forget to include the{' '}
<tt>--namespace (shorthand -n)</tt> option when running kubectl get pods to
ensure you're inspecting resources within the correct namespace.
</em>
</small>

```bash lineNumbers=false
Expand All @@ -80,15 +92,24 @@ newrelic-kubernetes-operator-controller-manager-7b9c64f58crwg9j 2/2 Runnin

If your output is similar to the example shown, you’re ready for the next step. If you don’t see a pod named `newrelic-kubernetes-operator-controller-manager-<hash>`, double check your Kubernetes configuration to ensure you’re within the correct context and pointing to the correct cluster.


</Step>
<Step>

## Creating your first alert policy

To kick things off, start small. First, create an alert policy with the minimum required configuration, then add a NRQL alert condition to the policy, which will add the condition to the policy in New Relic.
A minimal alert policy configuration is represented in the code below. For the sake of this walkthrough, name this file `new_relic_alert_policy.yaml`.

<small><em><strong>Note</strong>: For help locating your personal API key, check out New Relic's <a href="https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#">personal API key documentation</a>.</em></small>
<small>
<em>
<strong>Note</strong>: For help locating your personal API key, check out
New Relic's{' '}
<a href="https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#">
personal API key documentation
</a>
.
</em>
</small>

```yaml lineNumbers=false
apiVersion: nr.k8s.newrelic.com/v1
Expand All @@ -98,12 +119,11 @@ metadata:
spec:
account_id: <your New Relic account ID>
api_key: <your New Relic personal API key>
name: "Alert Policy Created With k8s" # Feel free to rename
region: "us"
name: 'Alert Policy Created With k8s' # Feel free to rename
region: 'us'
```
Now run the `kubectl apply` command to create your alert policy.
Now run the `kubectl apply` command to create your alert policy.

```bash lineNumbers=false
kubectl apply -f ./new_relic_alert_policy.yaml
Expand All @@ -115,17 +135,28 @@ You'll see output that reads similar to the following:
alertspolicy.nr.k8s.newrelic.com/my-policy created
```

Confirm that your alert policy was created by viewing your policies at `alerts.newrelic.com/accounts/{your account ID}/policies`. You can search for your new policy by its name. In this case, search for "Alert Policy Created With k8s."
Confirm that your alert policy was created by viewing your policies at `alerts.newrelic.com/accounts/{your account ID}/policies`. You can search for your new policy by its name. In this case, search for "Alert Policy Created With k8s."

You should see your new alert policy. Next it’s time to add a NRQL alert condition to the policy using the same configuration file.

</Step>
<Step>

## Add NRQL alert conditions to your alert policy

In the previous section you created an alert policy; now, you’ll add some alert conditions to the policy so you can trigger alerts when certain metrics are out of line.
In your `new_relic_alert_policy.yaml` file, add a NRQL alert condition to the policy that will alert you when an application's average overall response time is above five seconds for a three minute period.

<em><small><strong>Note</strong>: To receive notifications when an alert is triggered, add <a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/managing-notification-channels/notification-channels-control-where-send-alerts">notification channels</a> to your alert policy, with this code.</small></em>
<em>
<small>
<strong>Note</strong>: To receive notifications when an alert is triggered,
add{' '}
<a href="https://docs.newrelic.com/docs/alerts/new-relic-alerts/managing-notification-channels/notification-channels-control-where-send-alerts">
notification channels
</a>{' '}
to your alert policy, with this code.
</small>
</em>

```yaml lineNumbers=false
# The policy from the previous steps
Expand All @@ -136,26 +167,26 @@ metadata:
spec:
account_id: <your New Relic account ID>
api_key: <your New Relic personal API key>
name: "Alert Policy Created With k8s" # Feel free to rename
region: "us"
name: 'Alert Policy Created With k8s' # Feel free to rename
region: 'us'
# Add a NRQL alert condition to the policy
conditions:
- spec:
type: "NRQL"
name: "NRQL Alert Condition Created With k8s"
type: 'NRQL'
name: 'NRQL Alert Condition Created With k8s'
nrql:
query: "SELECT average(duration) FROM Transaction WHERE appName = 'YOUR APP NAME'"
evaluationOffset: 3
enabled: true
terms:
- threshold: "5"
threshold_occurrences: "ALL"
- threshold: '5'
threshold_occurrences: 'ALL'
threshold_duration: 180
priority: "CRITICAL"
operator: "ABOVE"
violationTimeLimit: "ONE_HOUR"
valueFunction: "SINGLE_VALUE"
priority: 'CRITICAL'
operator: 'ABOVE'
violationTimeLimit: 'ONE_HOUR'
valueFunction: 'SINGLE_VALUE'
```

With the alert condition added to the configuration, you can apply the update, which will create a NRQL alert condition and add it to your policy.
Expand All @@ -172,12 +203,7 @@ To finish things off, you'll create and add an alert channel to your alert polic
</Steps>

## What’s next?

Nice work — now you can manage your New Relic alert policies and NRQL alert conditions with code that integrates seamlessly within your Kubernetes workflow. This provides the ability to configure and manage your alerts with a domain-specific pattern, providing consistency and maintainability. You also gain the benefits of code reviews for any potential changes moving forward.
As you and your team move forward, you might need to adjust some of the configuration values to better fit your needs.
The New Relic Kubernetes Operator is just one of several tools in the New Relic Developer Toolkit aimed at facilitating observability as code.

## Related info

- [New Relic Kubernetes operator](https://github.com/newrelic/newrelic-kubernetes-operator)
- [New Relic documentation](https://docs.newrelic.com)
- [Kubernetes documentation](https://kubernetes.io/docs/home/)
The New Relic Kubernetes Operator is just one of several tools in the New Relic Developer Toolkit aimed at facilitating observability as code.
Loading

0 comments on commit 22def16

Please sign in to comment.