https://github.com/yasumoto/enpitsu
Swift Graphite Client
https://github.com/yasumoto/enpitsu
devops graphite-api swift-4 swift-package-manager swift4
Last synced: about 1 year ago
JSON representation
Swift Graphite Client
- Host: GitHub
- URL: https://github.com/yasumoto/enpitsu
- Owner: Yasumoto
- Created: 2017-06-08T03:46:14.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-09-29T23:21:20.000Z (over 6 years ago)
- Last Synced: 2025-06-09T03:09:37.409Z (about 1 year ago)
- Topics: devops, graphite-api, swift-4, swift-package-manager, swift4
- Language: Swift
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Enpitsu
A client for [`graphite-api`](https://graphite-api.readthedocs.io), named after the Japanese word for pencil. This can also be used through Grafana if that is configured to pass through to Graphite as a datasource.
If there are dashboards configured in Grafana, one can also use this library to get a list of dashboards as well as the graphs on a dashboard.
## Usage
```swift
import Foundation
let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .medium
dateFormatter.timeStyle = .medium
dateFormatter.timeZone = TimeZone(abbreviation: "PDT")!
let client = Enpitsu(graphiteServer: "http://graphite.example.com:9001")
let metrics = try client.retrieveMetrics("collectd.*.servers.host-*.metricname")
for timeseries in metrics {
print("Target: \(timeseries.target)")
for datapoint in timeseries.datapoints {
print(incidentDateFormatter.string(from: datapoint.date))
print("\(value)")
}
}
```