diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 03cd3ab9..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,136 +0,0 @@ ---- -version: 2.1 - -orbs: - prometheus: prometheus/prometheus@0.8.0 - -executors: - # Whenever the Go version is updated here, .promu.yml - # should also be updated. - golang: - docker: - - image: circleci/golang:1.15 - parameters: - working_dir: - type: string - default: ~/project - working_directory: << parameters.working_dir >> - -jobs: - test: - executor: golang - - steps: - - prometheus/setup_environment - - run: sudo apt-get -y install build-essential libsnmp-dev - - run: make - - run: git diff --exit-code - - prometheus/store_artifact: - file: snmp_exporter - - generator: - executor: - name: golang - working_dir: ~/project/generator - - environment: - MIBDIRS: mibs - steps: - - checkout: - path: ~/project - - run: sudo apt-get -y install build-essential diffutils libsnmp-dev p7zip-full - - run: make mibs - - run: make generator - - run: make parse_errors - - run: make generate - - run: diff -u ../snmp.yml snmp.yml - - publish_generator_master: - executor: golang - - steps: - - prometheus/setup_build_environment: - docker_version: 19.03.8 - - run: make -C generator docker - - run: make -C generator docker DOCKER_REPO=quay.io/prometheus - - run: docker images - - run: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD - - run: docker login -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io - - run: make -C generator docker-publish - - run: make -C generator docker-publish DOCKER_REPO=quay.io/prometheus - - publish_generator_release: - executor: golang - - steps: - - prometheus/setup_build_environment: - docker_version: 19.03.8 - - run: make -C generator docker DOCKER_IMAGE_TAG=$CIRCLE_TAG - - run: make -C generator docker DOCKER_IMAGE_TAG=$CIRCLE_TAG DOCKER_REPO=quay.io/prometheus - - run: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD - - run: docker login -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io - - run: | - if [[ "$CIRCLE_TAG" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then - make -C generator docker-tag-latest DOCKER_IMAGE_TAG="$CIRCLE_TAG" - make -C generator docker-tag-latest DOCKER_IMAGE_TAG="$CIRCLE_TAG" DOCKER_REPO=quay.io/prometheus - fi - - run: make -C generator docker-publish - - run: make -C generator docker-publish DOCKER_REPO=quay.io/prometheus - -workflows: - version: 2 - snmp_exporter: - jobs: - - test: - filters: - tags: - only: /.*/ - - prometheus/build: - name: build - filters: - tags: - only: /.*/ - - generator: - filters: - tags: - only: /.*/ - - prometheus/publish_master: - context: org-context - requires: - - test - - build - - generator - filters: - branches: - only: master - - prometheus/publish_release: - context: org-context - requires: - - test - - build - - generator - filters: - tags: - only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ - branches: - ignore: /.*/ - - publish_generator_master: - context: org-context - requires: - - test - - build - - generator - filters: - branches: - only: master - - publish_generator_release: - context: org-context - requires: - - test - - build - - generator - filters: - tags: - only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ - branches: - ignore: /.*/ diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 4007777e..00000000 --- a/.dockerignore +++ /dev/null @@ -1,7 +0,0 @@ -.build/ -.tarballs/ - -!.build/linux-amd64/ -!.build/linux-armv7 -!.build/linux-arm64 -!.build/linux-ppc64le diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 4c7059c1..44d0d9ce 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -10,13 +10,13 @@ following template. If you include CLI output, please run those programs with additional parameters: - snmp_exporter: `-log.level=debug` + snmp-export: `-L debug` snmpbulkget etc: `-On` --> ### Host operating system: output of `uname -a` -### snmp_exporter version: output of `snmp_exporter -version` +### snmp-export version: output of `snmp-export -V` ### What device/snmpwalk OID are you using? diff --git a/.gitignore b/.gitignore index 7442e0cb..437fd735 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,7 @@ _testmain.go *.exe dependencies-stamp -/snmp_exporter +/snmp-export /.build /.release /.tarballs diff --git a/Makefile b/Makefile index 5d975433..da2c23e0 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,6 @@ SHELL := $(shell [ -x /bin/ksh93 ] && echo '/bin/ksh93' || echo '/bin/bash' ) VERSION := 2.0.0 -PKG_PREFIX := github.com/prometheus/snmp_exporter PATCH ?= patch # If you have your libnetsnmp.so in a non-standard directory, you may set the @@ -92,7 +91,7 @@ clean-mibs: rm -rf $(MIBDIR) generator/mibs clean: clean-mibs - rm -rf bin snmp_exporter generator/generator + rm -rf bin snmp-export generator/generator realclean: clean go clean diff --git a/collector.go b/collector.go index 0f894380..18678c77 100644 --- a/collector.go +++ b/collector.go @@ -32,7 +32,7 @@ import ( "github.com/prometheus/client_golang/prometheus" "gopkg.in/alecthomas/kingpin.v2" - "github.com/prometheus/snmp_exporter/config" + "github.com/jelmd/snmp-export/config" ) var ( diff --git a/collector_test.go b/collector_test.go index 8d062780..6e07890a 100644 --- a/collector_test.go +++ b/collector_test.go @@ -24,7 +24,7 @@ import ( "github.com/prometheus/client_model/go" kingpin "gopkg.in/alecthomas/kingpin.v2" - "github.com/prometheus/snmp_exporter/config" + "github.com/jelmd/snmp-export/config" ) func TestPduToSample(t *testing.T) { diff --git a/config/config.go b/config/config.go index 44f6f3b4..51167c32 100644 --- a/config/config.go +++ b/config/config.go @@ -61,7 +61,7 @@ var ( } ) -// Config for the snmp_exporter. +// Config for snmp-export. type Config map[string]*Module type WalkParams struct { diff --git a/generator/README.md b/generator/README.md index 8689ea9c..0be09fda 100644 --- a/generator/README.md +++ b/generator/README.md @@ -558,7 +558,7 @@ unit1SensorSetHigh: Again, the 2nd regex pair is important, otherwise no match would happen for values != 0 and thus no new metric created (and the original gets dropped as usual). #### remap -This optional setting allows one to replace a metric's value using a map (instead of a bunch of regex pairs). After the optional regex\_extracts got applied, the value gets converted into its string representation and used as key for the lookup within the map. On match the value of the entry found becomes the metric's value. However, for `counter`, `gauge`, `Float`, `Double`, `DateAndTime` and `EnumAs*` a new value gets parsed as Float64 first - only if convertion succeeds, the new value will be set (otherwise the metric value is kept as is). If the result of a map lookup is `@drop@` the related metric gets dropped. For `Bits` no remapping gets applied (create an issue on [github](https://github.com/jelmd/snmp_exporter/issues), if you really need it). +This optional setting allows one to replace a metric's value using a map (instead of a bunch of regex pairs). After the optional regex\_extracts got applied, the value gets converted into its string representation and used as key for the lookup within the map. On match the value of the entry found becomes the metric's value. However, for `counter`, `gauge`, `Float`, `Double`, `DateAndTime` and `EnumAs*` a new value gets parsed as Float64 first - only if convertion succeeds, the new value will be set (otherwise the metric value is kept as is). If the result of a map lookup is `@drop@` the related metric gets dropped. For `Bits` no remapping gets applied (create an issue on [github](https://github.com/jelmd/snmp-export/issues), if you really need it). #### rename diff --git a/generator/config.go b/generator/config.go index e16173e3..62a17c9b 100644 --- a/generator/config.go +++ b/generator/config.go @@ -19,7 +19,7 @@ package main import ( "fmt" - "github.com/prometheus/snmp_exporter/config" + "github.com/jelmd/snmp-export/config" ) // The generator config. diff --git a/generator/generator.apc.yml b/generator/generator.apc.yml index 265cab1c..7b579cc9 100644 --- a/generator/generator.apc.yml +++ b/generator/generator.apc.yml @@ -1,5 +1,5 @@ # This is a configuration file for the -# https://github.com/jelmd/snmp_exporter/tree/main/generator +# https://github.com/jelmd/snmp-export/tree/main/generator # (C) 2022 by Jens Elkner (jel+snmpex@cs.uni-magdeburg.de) # # To translate it into a YAML spec conforming file, you need to pass it through diff --git a/generator/generator.cisco.yml b/generator/generator.cisco.yml index ae7cdb70..40c9dd54 100644 --- a/generator/generator.cisco.yml +++ b/generator/generator.cisco.yml @@ -1,5 +1,5 @@ # This is a configuration file for the -# https://github.com/jelmd/snmp_exporter/tree/main/generator +# https://github.com/jelmd/snmp-export/tree/main/generator # (C) 2022 by Jens Elkner (jel+snmpex@cs.uni-magdeburg.de) # To translate it into a YAML spec conforming file, you need to pass it through diff --git a/generator/generator.printer.yml b/generator/generator.printer.yml index 3af688a7..cd8a8a65 100644 --- a/generator/generator.printer.yml +++ b/generator/generator.printer.yml @@ -1,5 +1,5 @@ # This is a configuration file for the -# https://github.com/jelmd/snmp_exporter/tree/main/generator +# https://github.com/jelmd/snmp-export/tree/main/generator # (C) 2022 by Jens Elkner (jel+snmpex@cs.uni-magdeburg.de) # # To translate it into a YAML spec conforming file, you need to pass it through diff --git a/generator/generator.rittal.yml b/generator/generator.rittal.yml index d257d89d..832cf409 100644 --- a/generator/generator.rittal.yml +++ b/generator/generator.rittal.yml @@ -1,5 +1,5 @@ # This is a configuration file for the -# https://github.com/jelmd/snmp_exporter/tree/main/generator +# https://github.com/jelmd/snmp-export/tree/main/generator # (C) 2022 by Jens Elkner (jel+snmpex@cs.uni-magdeburg.de) # To translate it into a YAML spec conforming file, you need to pass it through diff --git a/generator/main.go b/generator/main.go index a53f9fed..3280b6e3 100644 --- a/generator/main.go +++ b/generator/main.go @@ -28,7 +28,7 @@ import ( "gopkg.in/alecthomas/kingpin.v2" yaml "gopkg.in/yaml.v3" - "github.com/prometheus/snmp_exporter/config" + "github.com/jelmd/snmp-export/config" ) // Version must be set via -ldflags '-X' @@ -61,7 +61,7 @@ func annotateOIDs(node *yaml.Node, nameToNode map[string]*Node) { } } -// Generate a snmp_exporter config and write it out. +// Generate a snmp-export config and write it out. func generateConfig(nodes *Node, nameToNode map[string]*Node, logger log.Logger) error { outputPath, err := filepath.Abs(*outputPath) if err != nil { diff --git a/generator/tree.go b/generator/tree.go index e9113bb4..54d6ab9f 100644 --- a/generator/tree.go +++ b/generator/tree.go @@ -26,7 +26,7 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" - "github.com/prometheus/snmp_exporter/config" + "github.com/jelmd/snmp-export/config" ) // These types have one following the other. diff --git a/generator/tree_test.go b/generator/tree_test.go index b753e0b0..a60b789f 100644 --- a/generator/tree_test.go +++ b/generator/tree_test.go @@ -19,7 +19,7 @@ import ( "testing" "github.com/go-kit/log" - "github.com/prometheus/snmp_exporter/config" + "github.com/jelmd/snmp-export/config" yaml "gopkg.in/yaml.v2" ) diff --git a/go.mod b/go.mod index 2442a943..28793853 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ -module github.com/prometheus/snmp_exporter +module github.com/jelmd/snmp-export require ( github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect - github.com/go-kit/kit v0.12.0 - github.com/go-kit/log v0.2.1 // indirect + github.com/go-kit/kit v0.12.0 // indirect + github.com/go-kit/log v0.2.1 github.com/gosnmp/gosnmp v1.35.0 github.com/prometheus/client_golang v1.12.1 github.com/prometheus/client_model v0.2.0 diff --git a/main.go b/main.go index 689439fb..8b38231f 100644 --- a/main.go +++ b/main.go @@ -32,7 +32,7 @@ import ( "gopkg.in/alecthomas/kingpin.v2" yaml "gopkg.in/yaml.v2" - "github.com/prometheus/snmp_exporter/config" + "github.com/jelmd/snmp-export/config" ) // Version must be set via -ldflags '-X'