mkr - Command Line Tool For Mackerel written in Go.
# DESCRIPTION
mkr is a command-line interface tool for the [Mackerel API](https://mackerel.io/api-docs/) written in Go.
mkr helps to automate tedious daily server operations to best leverage Mackerel's and Unix's tools.
mkr output format is JSON, so it can be filtered with a JSON processor such as [jq](http://stedolan.github.io/jq/).
# INSTALLATION
## apt / yum (for Linux)
### CentOS 7 (or later)
```bash
curl -fsSL https://mackerel.io/file/script/setup-yum-v2.sh | sh
yum install mkr
```
### Debian / Ubuntu
```bash
curl -fsSL https://mackerel.io/file/script/setup-apt-v2.sh | sh
apt-get install mkr
```
### Amazon Linux 2 LTS
```bash
curl -fsSL https://mackerel.io/file/script/amznlinux/setup-yum-v2.sh | sh
yum install mkr
```
### Amazon Linux
```bash
curl -fsSL https://mackerel.io/file/script/amznlinux/setup-yum.sh | sh
yum install mkr
```
## Homebrew (for macOS)
You can also install from the brew rule we maintain, but we don't officially support the environment.
```bash
brew tap mackerelio/mackerel-agent
brew install mkr
```
## Build from source
```bash
$ go install github.com/mackerelio/mkr@latest
```
# USAGE
First the MACKEREL_APIKEY environment variable must be set. It is not necessary to set the MACKEREL_APIKEY on hosts running [mackerel-agent](https://github.com/mackerelio/mackerel-agent). For more details, see below.
Specifying the and MACKEREL_APIKEY is not necessary because mkr refers to /var/lib/mackerel-agent/id and /etc/mackerel-agent/mackerel-agent.conf instead of specifying manually.
```bash
$ docker run --rm --env MACKEREL_APIKEY= mackerel/mkr help
```
# CONTRIBUTION
1. Fork ([https://github.com/mackerelio/mkr/fork](https://github.com/mackerelio/mkr/fork))
2. Create a feature branch
3. Commit your changes
4. Rebase your local changes against the master branch
5. Run test suite with the `go test ./...` command and confirm that it passes
6. Run `gofmt -s`
7. Create new Pull Request
License
----------
Copyright 2014 Hatena Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.