This repository has been archived by the owner on Oct 11, 2023. It is now read-only.
forked from prometheus/snmp_exporter
-
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.
- Loading branch information
1 parent
e8e154d
commit 4e17b06
Showing
8 changed files
with
189 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.build/ | ||
.tarballs/ | ||
|
||
!.build/linux-amd64/ |
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,29 @@ | ||
build/ | ||
dist/ | ||
*.pyc | ||
*.egg-info | ||
# Compiled Object files, Static and Dynamic libs (Shared Objects) | ||
*.o | ||
*.a | ||
*.so | ||
|
||
# Folders | ||
_obj | ||
_test | ||
|
||
# Architecture specific extensions/prefixes | ||
*.[568vq] | ||
[568vq].out | ||
|
||
*.cgo1.go | ||
*.cgo2.c | ||
_cgo_defun.c | ||
_cgo_gotypes.go | ||
_cgo_export.* | ||
|
||
_testmain.go | ||
|
||
*.exe | ||
dependencies-stamp | ||
/snmp_exporter | ||
/.build | ||
/.release | ||
/.tarballs | ||
.deps | ||
*.tar.gz |
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,15 @@ | ||
repository: | ||
path: github.com/prometheus/snmp_exporter | ||
build: | ||
flags: -a -tags netgo | ||
ldflags: | | ||
-X {{repoPath}}/vendor/github.com/prometheus/common/version.Version={{.Version}} | ||
-X {{repoPath}}/vendor/github.com/prometheus/common/version.Revision={{.Revision}} | ||
-X {{repoPath}}/vendor/github.com/prometheus/common/version.Branch={{.Branch}} | ||
-X {{repoPath}}/vendor/github.com/prometheus/common/version.BuildUser={{user}}@{{host}} | ||
-X {{repoPath}}/vendor/github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}} | ||
tarball: | ||
files: | ||
- snmp.yml | ||
- LICENSE | ||
- NOTICE |
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,10 @@ | ||
sudo: false | ||
|
||
language: go | ||
|
||
go: | ||
- 1.5.4 | ||
- 1.6.2 | ||
|
||
script: | ||
- make |
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,9 @@ | ||
FROM quay.io/prometheus/busybox:latest | ||
MAINTAINER The Prometheus Authors <[email protected]> | ||
|
||
COPY snmp_exporter /bin/snmp_exporter | ||
COPY snmp.yml /etc/snmp_exporter/snmp.yml | ||
|
||
EXPOSE 9116 | ||
ENTRYPOINT [ "/bin/snmp_exporter" ] | ||
CMD [ "-config.file=/etc/snmp_exporter/snmp.yml" ] |
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,60 @@ | ||
# Copyright 2016 The Prometheus Authors | ||
# 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. | ||
|
||
GO := GO15VENDOREXPERIMENT=1 go | ||
PROMU := $(GOPATH)/bin/promu | ||
pkgs = $(shell $(GO) list ./... | grep -v /vendor/) | ||
|
||
PREFIX ?= $(shell pwd) | ||
BIN_DIR ?= $(shell pwd) | ||
DOCKER_IMAGE_NAME ?= blackbox-exporter | ||
DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD)) | ||
|
||
|
||
all: format build test | ||
|
||
style: | ||
@echo ">> checking code style" | ||
@! gofmt -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^' | ||
|
||
test: | ||
@echo ">> running tests" | ||
@$(GO) test -short $(pkgs) | ||
|
||
format: | ||
@echo ">> formatting code" | ||
@$(GO) fmt $(pkgs) | ||
|
||
vet: | ||
@echo ">> vetting code" | ||
@$(GO) vet $(pkgs) | ||
|
||
build: promu | ||
@echo ">> building binaries" | ||
@$(PROMU) build --prefix $(PREFIX) | ||
|
||
tarball: promu | ||
@echo ">> building release tarball" | ||
@$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR) | ||
|
||
docker: | ||
@echo ">> building docker image" | ||
@docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" . | ||
|
||
promu: | ||
@GOOS=$(shell uname -s | tr A-Z a-z) \ | ||
GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \ | ||
$(GO) get -u github.com/prometheus/promu | ||
|
||
|
||
.PHONY: all style format build test vet tarball docker promu |
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 @@ | ||
0.0.6 |
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,61 @@ | ||
machine: | ||
environment: | ||
DOCKER_IMAGE_NAME: prom/snmp-exporter | ||
QUAY_IMAGE_NAME: quay.io/prometheus/snmp-exporter | ||
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.6-base | ||
REPO_PATH: github.com/prometheus/snmp_exporter | ||
pre: | ||
- sudo curl -L -o /usr/bin/docker 'https://s3-external-1.amazonaws.com/circle-downloads/docker-1.9.1-circleci' | ||
- sudo chmod 0755 /usr/bin/docker | ||
- sudo curl -L 'https://github.com/aktau/github-release/releases/download/v0.6.2/linux-amd64-github-release.tar.bz2' | tar xvjf - --strip-components 3 -C $HOME/bin | ||
services: | ||
- docker | ||
|
||
dependencies: | ||
pre: | ||
- make promu | ||
- docker info | ||
override: | ||
- promu crossbuild | ||
- ln -s .build/linux-amd64/snmp_exporter snmp_exporter | ||
- | | ||
if [ -n "$CIRCLE_TAG" ]; then | ||
make docker DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME DOCKER_IMAGE_TAG=$CIRCLE_TAG | ||
make docker DOCKER_IMAGE_NAME=$QUAY_IMAGE_NAME DOCKER_IMAGE_TAG=$CIRCLE_TAG | ||
else | ||
make docker DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME | ||
make docker DOCKER_IMAGE_NAME=$QUAY_IMAGE_NAME | ||
fi | ||
post: | ||
- mkdir $CIRCLE_ARTIFACTS/binaries/ && cp -a .build/* $CIRCLE_ARTIFACTS/binaries/ | ||
- docker images | ||
|
||
test: | ||
override: | ||
- docker run --rm -t -v "$(pwd):/app" "${DOCKER_TEST_IMAGE_NAME}" -i "${REPO_PATH}" -T | ||
|
||
deployment: | ||
hub_branch: | ||
branch: master | ||
owner: prometheus | ||
commands: | ||
- docker login -e $DOCKER_EMAIL -u $DOCKER_LOGIN -p $DOCKER_PASSWORD | ||
- docker login -e $QUAY_EMAIL -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io | ||
- docker push $DOCKER_IMAGE_NAME | ||
- docker push $QUAY_IMAGE_NAME | ||
hub_tag: | ||
tag: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ | ||
owner: prometheus | ||
commands: | ||
- promu crossbuild tarballs | ||
- promu release .tarballs | ||
- mkdir $CIRCLE_ARTIFACTS/releases/ && cp -a .tarballs/* $CIRCLE_ARTIFACTS/releases/ | ||
- docker login -e $DOCKER_EMAIL -u $DOCKER_LOGIN -p $DOCKER_PASSWORD | ||
- docker login -e $QUAY_EMAIL -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io | ||
- | | ||
if [[ "$CIRCLE_TAG" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then | ||
docker tag "$DOCKER_IMAGE_NAME:$CIRCLE_TAG" "$DOCKER_IMAGE_NAME:latest" | ||
docker tag "$QUAY_IMAGE_NAME:$CIRCLE_TAG" "$QUAY_IMAGE_NAME:latest" | ||
fi | ||
- docker push $DOCKER_IMAGE_NAME | ||
- docker push $QUAY_IMAGE_NAME |