Hastic standalone https://hastic.io
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.8 KiB

3 years ago
# Hastic
Hastic needs [Prometheus](https://prometheus.io/) or [InfluxDB](https://www.influxdata.com/get-influxdb/)
2 years ago
instance for getting metrics.
## Build from source (Linux)
2 years ago
### Prerequirements
1. [Install cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html) (required version: >=1.49)
2. Install [node.js >=10.x](https://nodejs.org/en/download/)
3. Install [yarn](https://classic.yarnpkg.com/lang/en/docs/install)
4. Install x86_64-unknown-linux-musl: `rustup target add x86_64-unknown-linux-musl`
5. musl-tools: `sudo apt install musl-tools`
2 years ago
### Build
3 years ago
```
make
```
### Configure
Hastic can be configured using config-file or environment variables.
At first, choose which datasource you'll be using: `prometheus` or `influx`. Only one can be used at a time.
#### Config-file
2 years ago
- copy the config example to the release directory:
```bash
cp config.example.toml release/config.toml
```
2 years ago
- edit the config file, e.g. using `nano`:
```bash
nano release/config.toml
```
#### Environment variables
All config fields are also available as environment variables with `HASTIC_` prefix
Variable name structure:
- for high-level fields: `HASTIC_<field_name>`, e.g. `HASTIC_PORT`
- for nested fields: `HASTIC_<category_name>__<field_name>`, e.g. `HASTIC_PROMETHEUS__URL`
Environment variables can be set either by exporting them (they'll be actual until a bash-session is closed):
```bash
export HASTIC_PORT=8000
export HASTIC_PROMETHEUS__URL=http://localhost:9090
export HASTIC_PROMETHEUS__QUERY=rate(go_memstats_alloc_bytes_total[5m])
```
2 years ago
or specifing them in a run command (they'll be actual only for one run):
```bash
HASTIC_PORT=8000 HASTIC_PROMETHEUS__URL=http://localhost:9090 HASTIC_PROMETHEUS__QUERY=rate(go_memstats_alloc_bytes_total[5m]) ./release/hastic
```
### Run
3 years ago
```
cd release
./hastic
```
2 years ago
open `http://localhost:4347` in browser