Provider and Namespace
Siren provider represents a monitoring server. We define alerts and alerts routing configuration inside providers. For example the below provider, describes how a cortex monitoring server info is stored inside Siren.
# provider
{
"id": "3",
"host": "http://localhost:9009",
"urn": "localhost_cortex",
"name": "localhost_cortex",
"type": "cortex",
"credentials": {},
"created_at": "2021-10-26T06:00:52.627917Z",
"updated_at": "2021-10-26T06:00:52.627917Z"
}
Monitoring providers usually have tenants, a sharded way of storing and querying telemetry data. Siren calls them namespaces. You should create a namespaces with the same name as the tenant of your monitoring providers. Example: the below namespace represent the tenant "odpf".
# namespace
{
"id": "10",
"urn": "odpf",
"name": "odpf",
"provider": {
"id": 3
},
"credentials": {},
"created_at": "2021-10-26T06:00:52.627917Z",
"updated_at": "2021-10-26T06:00:52.627917Z"
}
Provider
Provider creation
- CLI
- HTTP
$ siren provider create --file provider.yaml
$ curl --request POST
--url http://localhost:8080/v1beta1/providers
--header 'content-type: application/json'
--data-raw '{
"host": "http://localhost:9009",
"urn": "localhost_cortex",
"name": "localhost_cortex",
"type": "cortex",
"credentials": {},
"labels": {}
}'
Terminology of the request body
Term | Description | Example |
---|---|---|
host | Fully qualified path for the provider | http://localhost:9009 |
urn | Unique name for this provider (uneditable) | localhost_cortex |
name | Name of the proider (editable) | localhost_cortex |
type | type of the provider(cortex/influx etc.) | cortex |
credentials | key value pair to be used for authentication with the host | {"bearer_token":"x2y4rd5"} |
labels | key value pair that can be used as label selector | {"environment":"dev"} |
The response body will look like this:
{
"id": "1",
"host": "http://localhost:9009",
"urn": "localhost_cortex",
"name": "localhost_cortex",
"type": "cortex",
"credentials": {},
"created_at": "2022-01-03T05:10:47.880209Z",
"updated_at": "2022-01-03T05:10:47.880209Z"
}
Provider update
- CLI
- HTTP
$ siren provider edit --id 4 --file provider.yaml
$ curl --request PUT
--url http://localhost:8080/v1beta1/providers
--header 'content-type: application/json'
--data-raw '{
"host": "http://localhost:9009",
"urn": "localhost_cortex",
"name": "localhost_cortex_1",
"type": "cortex",
"credentials": {},
"labels": {}
}'
Getting a provider
- CLI
- HTTP
$ siren provider view 1
$ curl --request GET --url http://localhost:8080/v1beta1/providers/1
Getting all providers
- CLI
- HTTP
$ siren provider list
$ curl --request GET --url http://localhost:8080/v1beta1/providers
Deleting a provider
- CLI
- HTTP
$ siren provider delete 4
$ curl --request DELETE --url http://localhost:8080/v1beta1/providers/4
Note:
- Before deleting the provider, you will need to delete dependant resources (namespaces).
Namespace
Note: These operations on namespaces inside Siren doesn't affect the actual tenant in the monitoring provider. The user should manage the tenants themselves.
Creating a namespace
- CLI
- HTTP
$ siren namespace create --file namespace.yaml
$ curl --request POST
--url http://localhost:8080/v1beta1/namespaces
--header 'content-type: application/json'
--data-raw '{
"name": "test",
"urn": "test",
"provider": "5",
"credentials": {},
"labels": {}
}'
Terminology of the request body
Term | Description | Example |
---|---|---|
urn | Unique name for this namespace (uneditable) | test-tenant |
name | Name of the tenant (editable) | test-tenant |
provider | id of the provider to which this tenant belongs | 1 |
labels | key value pair that can be used as label selector | {"environment":"dev"} |
credentials | key value pair to be used for authentication with the host | {"bearer_token":"x2y4rd5"} |
The response body will look like this:
{
"id": "13",
"urn": "test",
"name": "test",
"provider": "5",
"credentials": {},
"created_at": "2022-01-03T07:06:30.884113Z",
"updated_at": "2022-01-03T07:06:30.884113Z"
}
Updating a namespace
- CLI
- HTTP
$ siren namespace edit --id 13 --file namespace.yaml
$ curl --request PUT
--url http://localhost:8080/v1beta1/namespaces/13
--header 'content-type: application/json'
--data-raw '{
"name": "test2",
"urn": "test",
"provider": "5",
"credentials": {},
"labels": {}
}'
Getting a namespace
- CLI
- HTTP
$ siren namespace view 13
$ curl --request GET --url http://localhost:8080/v1beta1/namespaces/13
Getting all namespaces
- CLI
- HTTP
$ siren namespace list
$ curl --request GET --url http://localhost:8080/v1beta1/namespaces
Deleting a namespace
- CLI
- HTTP
$ siren namespace delete 13
$ curl --request DELETE --url http://localhost:8080/v1beta1/namespaces/13