firehose-http-endpoint-for-mackerel

command module
v0.0.0-...-eea4ff1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2022 License: MIT Imports: 10 Imported by: 0

README

firehose-http-endpoint-for-mackerel

A PoC of Firehose HTTP Endpoint to post metrics to Mackerel.

Requirements

Go 1.19

How to run on local

$ make
$ ./firehose-http-endpoint-for-mackerel

firehose-http-endpoint-for-mackerel runs on 0.0.0.0:8080.

How to run on Amazon API Gateway

Makefile includes a example target for deployment to a Lambda function firehose-http-endpoint-for-mackerel on your AWS account by Lambroll.

$ GOARCH=amd64 GOOS=linux make
$ ROLE_ARN=arn:aws:iam::123456789012:role/lambda make deploy

Create an Amazon API Gateway which have a "HTTP integration" with that Lambda function.

The IAM role for the lambda function requires only a policy equals to arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecution.

Connect with Kinesis Data Firehose

Setup a Kinesis Data Firehose which have a destination to HTTP endpoint for the API Gateway or your custom endpoint.

  • HTTP endpoint URL: https://..../service
  • Access key: Your Mackerel API Key
  • Content encoding: "Disabled"
  • Parameters
    • service: A Mackerel service name to post metrics

How to post metrics to Firehose

Post service metrics to the Firehose delivery stream. Record formats are allowed as below.

  • JSON format {"name":"metric.name","time":1596382129,"value":27759}
  • Text format same as for Mackerel agent metric.name\t27759\t1596382129

LICENSE

MIT

Author

@fujiwara

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL