Skip to content

Commit

Permalink
Merge pull request #11 from f100024/feature/add-rest-db-status
Browse files Browse the repository at this point in the history
Added support /rest/db/status
  • Loading branch information
f100024 authored Apr 15, 2021
2 parents d8c4a1e + 3e56455 commit b12f1fc
Show file tree
Hide file tree
Showing 18 changed files with 1,137 additions and 64 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
## 0.2.4 / 2020-03-31
## 0.3.0 / 2020-04-15
---
* Added support /rest/db/status
* Fixed logging
* Updated grafana dashboard
* Refactoring

## 0.2.4 / 2020-04-13
---
* Added support /rest/stats/device
* Minor refactoring
Expand Down
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ Basic prometheus configuration:
### Start flags
Name | Evironment variable | Required | Description
-------------------|---------------------|----------|-------------
web.listen-address | WEB_LISTEN_ADDRESS | - | Address ot listen on for web interface and telemetry
web.metrics-path | WEB_METRIC_PATH | - | Path under which to expose metrics
syncthing.uri | SYNCTHING_URI | + | HTTP API address of Syncthing node
syncthing.token | SYNCTHING_TOKEN | + | Token for authentification Syncthing HTTP API
syncthing.timeout | SYNCTHING_TIMEOUT | - | Timeout for trying to get stats from Syncthing
Name | Evironment variable | Required | Description
--------------------|---------------------|----------|-------------
web.listen-address | WEB_LISTEN_ADDRESS | - | Address ot listen on for web interface and telemetry
web.metrics-path | WEB_METRIC_PATH | - | Path under which to expose metrics
syncthing.uri | SYNCTHING_URI | + | HTTP API address of Syncthing node
syncthing.token | SYNCTHING_TOKEN | + | Token for authentification Syncthing HTTP API
syncthing.timeout | SYNCTHING_TIMEOUT | - | Timeout for trying to get stats from Syncthing
syncthing.foldersid | SYNCTHING_FOLDERSID | - | List of ids of folders, delimeter is ','
### What's and how exported
Expand All @@ -41,8 +42,11 @@ Example of all metrics related to `syncthing` [here](examples/exposed_parameters
For data obtaining is using two endpoints:

[GET /rest/svc/report](https://docs.syncthing.net/rest/svc-report-get.html)
[GET /rest/system/connections](https://docs.syncthing.net/rest/system-connections-get.html)
[GET /rest/stats/device](https://docs.syncthing.net/rest/stats-device-get.html)
[GET /rest/system/connections](https://docs.syncthing.net/rest/system-connections-get.html)
[GET /rest/stats/device](https://docs.syncthing.net/rest/stats-device-get.html)
[GET /rest/db/status](https://docs.syncthing.net/rest/db-status-get.html)*

>\* This is an expensive call, increasing CPU and RAM usage on the device. Use sparingly.

### Grafana dashboard

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.4
0.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@ var (
},
}
)

func bool2float64(status bool) float64 {
if status {
return float64(1)
}
return float64(0)
}
30 changes: 30 additions & 0 deletions collector/fixtures/rest_db_status_response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"errors": 0,
"globalBytes": 4047955455069,
"globalDeleted": 156112,
"globalDirectories": 346372,
"globalFiles": 694624,
"globalSymlinks": 0,
"globalTotalItems": 1197108,
"ignorePatterns": false,
"inSyncBytes": 4047955455069,
"inSyncFiles": 694624,
"invalid": "",
"localBytes": 4047955455069,
"localDeleted": 318,
"localDirectories": 346372,
"localFiles": 694624,
"localSymlinks": 0,
"localTotalItems": 1041314,
"needBytes": 0,
"needDeletes": 0,
"needDirectories": 0,
"needFiles": 0,
"needSymlinks": 0,
"needTotalItems": 0,
"pullErrors": 0,
"sequence": 1213411,
"state": "idle",
"stateChanged": "2077-02-06T00:02:00-07:00",
"version": 1213411
}
Loading

0 comments on commit b12f1fc

Please sign in to comment.