Skip to content

Commit

Permalink
Add initial version of Sematext agent chart (helm#10202)
Browse files Browse the repository at this point in the history
* Add initial version of Sematext agent chart

Signed-off-by: Alen Komljen <[email protected]>

* Set home to chart metadata

Signed-off-by: Alen Komljen <[email protected]>

* Update maintainer name

Signed-off-by: Alen Komljen <[email protected]>

* Address a few minor issues and improve the readme

Signed-off-by: Alen Komljen <[email protected]>
  • Loading branch information
komljen authored and k8s-ci-robot committed Feb 12, 2019
1 parent 4df52d5 commit 4d83b64
Show file tree
Hide file tree
Showing 17 changed files with 787 additions and 0 deletions.
21 changes: 21 additions & 0 deletions stable/sematext-agent/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
17 changes: 17 additions & 0 deletions stable/sematext-agent/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
appVersion: "1.0"
version: 1.0.1
description: Helm chart for deploying Sematext Agent to Kubernetes
keywords:
- sematext
- observability
- monitoring
- logging
- containers
- ebpf
home: https://sematext.com/cloud
icon: https://sematext.com/wp-content/uploads/2017/09/octi-square-logo-200x200-2.png
maintainers:
- name: komljen
email: [email protected]
name: sematext-agent
4 changes: 4 additions & 0 deletions stable/sematext-agent/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
approvers:
- komljen
reviewers:
- komljen
77 changes: 77 additions & 0 deletions stable/sematext-agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Sematext Agent

Sematext Agent collects metrics about hosts (CPU, memory, disk, network, processes), containers (both Docker and rkt) and orchestrator platforms and ships that to [Sematext Cloud](https://sematext.com/cloud). Sematext Cloud is available in the US and EU regions.

## Introduction

This chart installs the Sematext Agent to all nodes in your cluster via a `DaemonSet` resource.

## Prerequisites

- Kubernetes 1.9+
- You need to create [a new Docker app in Sematext Cloud](https://apps.sematext.com/ui/integrations/create/docker) to get relevant tokens

## Installation

To install the chart run the following command:

```bash
$ helm install --name release_name \
--set containerToken=YOUR_CONTAINER_TOKEN,logsToken=YOUR_LOGS_TOKEN stable/sematext-agent
```

After a few minutes, you should see logs, metrics, and events reported in Sematext web UI.

**NOTE:** If you want to use Sematext in EU region set the region as well `--set region=EU`. Also, it is worth mentioning that the agent is running as a privileged container.

## Deleting

To uninstall the chart delete `release_name` deployment:

```bash
$ helm delete --purge release_name
```

The command removes all the Kubernetes components associated with the chart and deletes the release.

## Configuration

The following table lists the configuration parameters of the `sematext-agent` chart and default values.

| Parameter | Description | Default |
|-------------------------------|--------------------------------------|-------------------------------------------|
| `containerToken` | Sematext Container token | `Nil` Provide your Container token |
| `logsToken` | Sematext Logs token | `Nil` Provide your Logs token |
| `region` | Sematext region | `US` Sematext US or EU region |
| `agent.image.repository` | The image repository | `sematext/agent` |
| `agent.image.tag` | The image tag | `latest` |
| `agent.image.pullPolicy` | Image pull policy | `Always` |
| `agent.service.port` | Service port | `80` |
| `agent.service.type` | Service type | `ClusterIP` |
| `agent.resources` | Agent resources | `{}` |
| `logagent.image.repository` | The image repository | `sematext/logagent` |
| `logagent.image.tag` | The image tag | `latest` |
| `logagent.image.pullPolicy` | Image pull policy | `Always` |
| `logagent.resources` | Logagent resources | `{}` |
| `customUrl.metricsServer` | Custom endpoint for Metrics receiver | `Nil` |
| `customUrl.logsServer` | Custom endpoint for Logs receiver | `Nil` |
| `customUrl.eventServer` | Custom endpoint for Event receiver | `Nil` |
| `serviceAccount.create` | Create a service account | `true` |
| `serviceAccount.name` | Service account name | `Nil` Defaults to chart name |
| `rbac.create` | RBAC enabled | `true` |
| `tolerations` | Tolerations | `[]` |
| `nodeSelector` | Node selector | `{}` |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example:

```bash
$ helm install --name release_name \
--set containerToken=YOUR_CONTAINER_TOKEN \
stable/sematext-agent
```

Alternatively, you can use a YAML file that specifies the values while installing the chart. For example:

```bash
$ helm install --name release_name -f custom_values.yaml stable/sematext-agent
```
212 changes: 212 additions & 0 deletions stable/sematext-agent/files/autodisco.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
# ========================================================
# Definition of autodiscovery patterns
# ========================================================

# The top level element identifies the app type.
# The value of this element is used by AA to correctly
# setup the corresponding agent. Then we have a number
# of attributes that determines whether certain app is
# discovered as such. Firstly, the `process` accepts a
# regular expression pattern to identify process's image
# name that originated the event and is susceptible for
# classification.
# Then, we have `args` that represents the regular expression
# used to match the tokens from process's command line. The
# sequence of well-known ports is also used as an advice to
# autodisco machinery that specific service could expose these
# ports. The Infra agent also sends requests to these ports
# in order to get additional meta info.


# Finally, `labels` attribute provides custom key-value pairs
# that are attached as container labels/env vars. The naming
# of some of them might be specific to AA framework and thus
# are used by itself.

# You can use any valid go template (https://golang.org/pkg/text/template/)
# construct inside yaml file. You can access command line args
# or discovered ports like this:
#
# labels:
# cmdline: "{{ .Args}}"
#
# For instance to get the container id or container name you
# would use the following go template action. Please note that built-in `isset`
# function is used to ensure container details are present since some
# apps can be discovered in the VM or baremetal host and thus lack container
# meta.
#
# labels:
# container.name: '{{if isset .ContainerInfo "Name"}}{{ .ContainerInfo.Name }}{{end}}'
# container.id: '{{if isset .ContainerInfo "ID"}}{{ .ContainerInfo.ID }}{{end}}'

# You can also query app meta info through `Meta` field. For example, to get
# the version of nginx server use '{{if isset .Meta "Version"}}{{ .Meta.Version }}{{end}}'
# in `labels` section.

# To pull secrets that are attached to containers use '{{index .Secrets "SECRET_NAME"}}'

cassandra:
process: java
args: .*org.apache.cassandra.service.CassandraDaemon.*
ports:
- 7199
- 7000
- 7001
- 9160
- 9042

clickhouse:
process: clickhouse-.*
args: clickhouse-server --config=.*
ports:
- 8123
- 9000
- 9009
labels:
SPM_MONITOR_CLICKHOUSE_DB_HOST_PORT: "{{ .IP }}:8123"
SPM_MONITOR_CLICKHOUSE_DB_USER:
SPM_MONITOR_CLICKHOUSE_DB_PASSWORD:

es:
process: java
args: .*org.elasticsearch.bootstrap.Elasticsearch.*
ports:
- 9200
- 9300
- 9201
- 9202
- 9301
- 9302

haproxy:
process: haproxy
args: .*haproxy.*haproxy.cfg.*-p

httpd:
process: httpd
args: httpd-*D*
ports:
- 80
- 443
- 8080
- 8443

kafka:
process: java
args: kafka.Kafka .*server\.properties
ports:
- 9092

mongodb:
process: mongod|listener|conn\d+
args: mongod.*|listener|conn\d+
ports:
- 27017

mysql:
process: mysqld
args: mysqld.*
ports:
- 3306

nginx:
process: nginx
args: "nginx: master process.*|nginx: worker process.*|nginx -g daemon off.*"
ports:
- 80
- 443
- 8080
- 8443
labels:
container.name: '{{if isset .ContainerInfo "Name"}}{{ .ContainerInfo.Name }}{{end}}'
container.id: '{{if isset .ContainerInfo "ID"}}{{ .ContainerInfo.ID }}{{end}}'
version: '{{if isset .Meta "Version"}}{{ .Meta.Version }}{{end}}'

redis:
process: redis-server
args: redis-server .*
ports:
- 6379

solr:
process: java
args: .*-Dsolr.solr.home.*|.*-Dsolr.install.dir.*
ports:
- 8983
- 7983

spark-master:
process: java
args: .*org.apache.spark.deploy.master.Master.*
ports:
- 7707
- 4040

spark-worker:
process: java
args: .*org.apache.spark.deploy.worker.Worker.*
ports:
- 7707
- 4040

spark-driver:
process: java
args: .*org.apache.spark.deploy.SparkSubmit.*--deploy-mode client.*|.*org.apache.spark.deploy.worker.DriverWrapper.*
ports:
- 7707
- 4040

spark-executor:
process: java
args: .*org.apache.spark.executor.CoarseGrainedExecutorBackend.*
ports:
- 7707
- 4040

storm-nimbus:
process: java
args: .*org.apache.storm.daemon.nimbus.*
ports:
- 6627
- 6700
- 6701
- 6702
- 6703

storm-supervisor:
process: java
args: .*org.apache.storm.daemon.supervisor.Supervisor.*
ports:
- 6627
- 6700
- 6701
- 6702
- 6703

storm-worker:
process: java
args: .*org.apache.storm.daemon.worker.*
ports:
- 6627
- 6700
- 6701
- 6702
- 6703

tomcat:
process: java
args: .*catalina.*org.apache.catalina.startup.Bootstrap.*
ports:
- 80
- 443
- 8080
- 8443

zookeeper:
process: java
args: .*-Dzookeeper.log.dir.*|.*org.apache.zookeeper.server.quorum.QuorumPeerMain.*
ports:
- 2181
- 2888
- 3888
51 changes: 51 additions & 0 deletions stable/sematext-agent/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{- if and (not .Values.containerToken) (not .Values.logsToken) -}}

###############################################################################
# ERROR: Please provide containerToken and/or logsToken! #
###############################################################################

Depending on which region you want to use, create a container and/or logs apps
to get your tokens. Then, start the app with:

helm install --name release_name \
--set sematext.containerToken=YOUR_CONTAINER_TOKEN \
stable/sematext-agent

Or if you created both apps use:

helm install --name release_name \
--set containerToken=YOUR_CONTAINER_TOKEN,logsToken=YOUR_LOGS_TOKEN \
stable/sematext-agent

Please check the README file for all available parameters.

{{- else if not .Values.logsToken -}}

Missing logsToken! You will only receive metrics and events.
{{ if eq .Values.region "US" }}
After a few minutes check your app at https://apps.sematext.com/ui/monitoring
{{ else if eq .Values.region "EU" }}
After a few minutes check your app at https://apps.eu.sematext.com/ui/monitoring
{{ end }}

{{- else if not .Values.containerToken -}}

Missing containerToken! You will only receive logs.
{{ if eq .Values.region "US" }}
After a few minutes check your app at https://apps.sematext.com/ui/logs
{{ else if eq .Values.region "EU" }}
After a few minutes check your app at https://apps.eu.sematext.com/ui/logs
{{ end }}

{{- else -}}

You are all set!
{{ if eq .Values.region "US" }}
After a few minutes check your metrics app at https://apps.sematext.com/ui/monitoring
or logs at https://apps.sematext.com/ui/logs
{{ else if eq .Values.region "EU" }}
After a few minutes check your metrics app at https://apps.eu.sematext.com/ui/monitoring
or logs at https://apps.eu.sematext.com/ui/logs
{{ end }}

{{- end -}}
Loading

0 comments on commit 4d83b64

Please sign in to comment.