-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated Readme / Added ansible-playbook and other deployment things
- Loading branch information
localleon
committed
Jan 24, 2019
1 parent
7379403
commit b7f7e48
Showing
5 changed files
with
98 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,37 @@ | ||
# octoprint-exporter | ||
OctoPrint Exporter for Prometheus written in Golang | ||
### OctoPrint Exporter for Prometheus written in Golang | ||
|
||
-- WORK-IN-PROGRESS | ||
## Metrics | ||
Metrics are exposed under :9112/metrics and start with the prefix "octoprint" . The Metrics are a replicate from the octoprint API | ||
|
||
# Plattform | ||
#### octoprint_status | ||
0 == Unknown | ||
1 == Operational | ||
2 == Printing from SD | ||
3 == Printing | ||
|
||
## Deploying | ||
1. Use Ansible | ||
- Run build.sh to create binarys or download them from the releases page | ||
- Change host and username in ansible-deploy.yaml (Ansible-Playbook) | ||
- Run ``` ansible-playbook ./ansible-deploy.yaml ``` (tested on CentOS and Raspbian) | ||
- Add scrape Job to your prometheus server and you're done | ||
2. Do it yourself | ||
- Copy the binary and the example-config file to your remote server | ||
- Copy the systemd-service file to /etc/systemd/system/ | ||
- Use ```systemctl``` to enable the Service | ||
|
||
|
||
## Contributing | ||
- Pull-requests and bug reports wanted ! | ||
|
||
## Plattform | ||
Currently tested on: | ||
- linux/amd64 | ||
- linux/arm | ||
|
||
### Credits / Libarys used | ||
https://mholt.github.io/json-to-go/ -- Used to create Go Structs out of JSON | ||
## Credits / Libarys used | ||
https://mholt.github.io/json-to-go/ -- Used to create Go Structs out of JSON | ||
|
||
## Author | ||
Copyright localleon(c) 2019 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
- hosts: monitoring.virt.lan | ||
remote_user: pi | ||
become: yes | ||
become_method: sudo | ||
|
||
vars: | ||
build_path: ./octoprint-exporter-linux-arm.bin | ||
service_path: ./octoprint-exporter.service | ||
config_path: ./config.yaml | ||
|
||
tasks: | ||
- name: Creates directory | ||
file: | ||
path: /opt/octoprint/ | ||
state: directory | ||
|
||
- name: copying binary to remote | ||
copy: | ||
src: "{{build_path}}" | ||
dest: "/opt/octoprint/octoprint.bin" | ||
owner: root | ||
group: root | ||
mode: 0755 | ||
|
||
- name: copying config file to remote | ||
copy: | ||
src: "{{config_path}}" | ||
dest: "/opt/octoprint/config.yaml" | ||
|
||
- name: copying systemd-service file to remote | ||
copy: | ||
src: "{{service_path}}" | ||
dest: "/etc/systemd/system/octoprint-exporter.service" | ||
|
||
- name: just force systemd to reread configs | ||
systemd: | ||
daemon_reload: yes | ||
|
||
- name: enable service octoprint-service and restart | ||
systemd: | ||
name: octoprint-exporter | ||
enabled: yes | ||
state: restarted | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
listen : ":9112" # Port for the http Server to listen on | ||
probetime: 15 # How often the Metrics are updated | ||
apikey : "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" # Your Octoprint API Key found in the WebInterface | ||
apikey : "677C7AD5049948EC84C2A14D75C317CB" # Your Octoprint API Key found in the WebInterface | ||
octopi : "octopi.local" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[Unit] | ||
Description=Octoprint Prometheus Exporter | ||
ConditionPathExists=/opt/octoprint/octoprint.bin | ||
After=network.target | ||
|
||
[Service] | ||
Type=simple | ||
User=root | ||
Group=root | ||
|
||
Restart=on-failure | ||
RestartSec=30 | ||
|
||
WorkingDirectory=/opt/octoprint/ | ||
ExecStart=/opt/octoprint/octoprint.bin --config=/opt/octoprint/config.yaml | ||
|
||
[Install] | ||
WantedBy=multi-user.target |