Skip to content

Commit

Permalink
Add license and better instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyje committed Nov 17, 2022
1 parent 22c8e91 commit e67c738
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 7 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2022 Jeremy Edwards
#
# 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.

# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
Expand Down
68 changes: 67 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,68 @@
# coretemp-exporter
Core Temp Exporter for Prometheus

[![CI](https://github.com/jeremyje/coretemp-exporter/actions/workflows/ci.yaml/badge.svg)](https://github.com/jeremyje/coretemp-exporter/actions/workflows/ci.yaml)

A Prometheus exporter that emits CPU health information such as core temperatures. There are also some example dashboards to visualize your computer's sensor data.

## Building

To build coretemp-exporter you need [Go](https://go.dev/dl/) and Make installed. You can use Linux or Windows hosts to build.

```bash
# (optional) Delete all build artifacts.
make clean

# Build all binaries.
make all -j$(nproc)

# Binaries are created in build/$GOOS-$GOARCH/ directory.
```

## Running

You can run `coretemp-exporter` on Windows or Linux. By default it'll serve its metrics at [`:8081`](http://localhost:8081).

### Linux

```bash
# Install lm-sensors
sudo apt-get install lm-sensors

# Test that lm-sensors is working.
sensors

# If it's not working try.
sudo sensors-detect

# Run coretemp-exporter.
./build/linux_amd64/coretemp-exporter
```

### Windows

1. Install and run [ALCPU CoreTemp](https://www.alcpu.com/CoreTemp/). It is important that this application is running otherwise you will not get any data.

```powershell
# Windows
.\build\windows_amd64\coretemp-exporter.exe
```

## Dashboards

You'll need [Docker](https://docs.docker.com/get-docker/) and [docker-compose](https://github.com/docker/compose/releases) installed. Windows users should run Docker in Linux mode.

```bash
# Go to the docker-compose directory.
cd install/compose
# Launch Prometheus and Grafana.
docker-compose up -d
```

Once both services are you you can view the graphs via: [`:3000/dashboards`](http://localhost:3000/dashboards). To login use the following credentials:

* Username: `root`
* Password: `admin`

Once you've logged in you can visit the `CPU` page and you should see something like:

![Grafana Charts](docs/example-graphs.png "CPU Health Metrics in Grafana")
14 changes: 14 additions & 0 deletions cmd/converter/converter.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2022 Jeremy Edwards
//
// 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.

package main

import (
Expand Down
Binary file added docs/example-graphs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 66 additions & 6 deletions install/compose/grafana/dashboards/cpu.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"overrides": []
},
"gridPos": {
"h": 16,
"h": 29,
"w": 12,
"x": 0,
"y": 0
Expand Down Expand Up @@ -268,8 +268,8 @@
},
"gridPos": {
"h": 13,
"w": 12,
"x": 0,
"w": 6,
"x": 12,
"y": 16
},
"id": 6,
Expand All @@ -293,14 +293,74 @@
"uid": "PBFA97CFB590B2093"
},
"editorMode": "builder",
"expr": "cpu_speed",
"legendFormat": "{{model}}",
"expr": "cpu_frequency",
"legendFormat": "{{name}}",
"range": true,
"refId": "A"
}
],
"title": "CPU Speed",
"type": "gauge"
},
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "rothz"
},
"overrides": []
},
"gridPos": {
"h": 13,
"w": 6,
"x": 18,
"y": 16
},
"id": 8,
"options": {
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"showThresholdLabels": false,
"showThresholdMarkers": true
},
"pluginVersion": "9.2.4",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "PBFA97CFB590B2093"
},
"editorMode": "builder",
"expr": "cpu_fsb_frequency",
"legendFormat": "Front Side Bus of {{name}}",
"range": true,
"refId": "A"
}
],
"title": "Front Side Bus Frequency",
"type": "gauge"
}
],
"refresh": "5s",
Expand All @@ -318,6 +378,6 @@
"timezone": "",
"title": "CPU",
"uid": "RwtPEDHVz",
"version": 1,
"version": 2,
"weekStart": ""
}

0 comments on commit e67c738

Please sign in to comment.