Skip to content

Commit

Permalink
Merge pull request #20 from jeremyje/systemd
Browse files Browse the repository at this point in the history
Systemd Unit File
  • Loading branch information
jeremyje authored Nov 16, 2022
2 parents 111b2da + 24a5103 commit 22c8e91
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/lmsensors/lmsensors_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type lmsensorsDriver struct {
func (d *lmsensorsDriver) Get() (*pb.MachineMetrics, error) {
out, err := exec.Command("sensors", "-j").Output()
if err != nil {
return nil, fmt.Errorf("cannot run 'sensors' command, is it installed?\nout= %s\nerr= %w", out, err)
return nil, fmt.Errorf("cannot run 'sensors' command, is it installed or running in a VM?\nout= %s\nerr= %w", out, err)
}
data, err := fromJSON(out)
if err != nil {
Expand Down
36 changes: 36 additions & 0 deletions install/systemd/coretemp-exporter.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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.

# Install
# sudo cp coretemp-exporter /usr/local/bin/coretemp-exporter
# sudo chmod +x /usr/local/bin/coretemp-exporter
# sudo cp coretemp-exporter.service /etc/systemd/system/coretemp-exporter.service
# sudo systemctl enable coretemp-exporter.service
# sudo systemctl start coretemp-exporter.service

# Uninstall
# sudo systemctl stop coretemp-exporter.service
# sudo systemctl disable coretemp-exporter.service
# sudo rm -f /etc/systemd/system/coretemp-exporter.service

[Unit]
Description=Reports CPU and other device temperatures and health metrics in Prometheus format.

[Service]
ExecStart=/usr/local/bin/coretemp-exporter
Type=simple
Restart=always

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,51 @@ message Operation {
// extra functionality that is not covered by the standard OpenAPI Specification.
// See: https://swagger.io/docs/specification/2-0/swagger-extensions/
map<string, google.protobuf.Value> extensions = 13;
// Custom parameters such as HTTP request headers.
// See: https://swagger.io/docs/specification/2-0/describing-parameters/
// and https://swagger.io/specification/v2/#parameter-object.
Parameters parameters = 14;
}

// `Parameters` is a representation of OpenAPI v2 specification's parameters object.
// Note: This technically breaks compatibility with the OpenAPI 2 definition structure as we only
// allow header parameters to be set here since we do not want users specifying custom non-header
// parameters beyond those inferred from the Protobuf schema.
// See: https://swagger.io/specification/v2/#parameter-object
message Parameters {
// `Headers` is one or more HTTP header parameter.
// See: https://swagger.io/docs/specification/2-0/describing-parameters/#header-parameters
repeated HeaderParameter headers = 1;
}

// `HeaderParameter` a HTTP header parameter.
// See: https://swagger.io/specification/v2/#parameter-object
message HeaderParameter {
// `Type` is a a supported HTTP header type.
// See https://swagger.io/specification/v2/#parameterType.
enum Type {
UNKNOWN = 0;
STRING = 1;
NUMBER = 2;
INTEGER = 3;
BOOLEAN = 4;
}

// `Name` is the header name.
string name = 1;
// `Description` is a short description of the header.
string description = 2;
// `Type` is the type of the object. The value MUST be one of "string", "number", "integer", or "boolean". The "array" type is not supported.
// See: https://swagger.io/specification/v2/#parameterType.
Type type = 3;
// `Format` The extending format for the previously mentioned type.
string format = 4;
// `Required` indicates if the header is optional
bool required = 5;
// field 6 is reserved for 'items', but in OpenAPI-specific way.
reserved 6;
// field 7 is reserved `Collection Format`. Determines the format of the array if type array is used.
reserved 7;
}

// `Header` is a representation of OpenAPI v2 specification's Header object.
Expand Down

0 comments on commit 22c8e91

Please sign in to comment.