Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prometheus-surfboard-exporter: init at 2.0.0 #31645

Merged
merged 2 commits into from May 2, 2018

Conversation

disassembler
Copy link
Member

@disassembler disassembler commented Nov 14, 2017

Motivation for this change

Haven't tested the nixos module yet (will try to tomorrow), but I tested running the exporter standalone and a curl of the metric page got me all my surfboard cable modem stats.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Copy link
Member

@fpletz fpletz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine to me. Thanks!

@Mic92
Copy link
Member

Mic92 commented Nov 14, 2017

nitpick for commit message:

nixos/prometheus-surfboard-exporter: add service

User = "nobody";
Restart = "always";
PrivateTmp = true;
WorkingDirectory = /tmp;
Copy link
Member

@Mic92 Mic92 Nov 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this application creates temporary files securely? There might be other applications racing for /tmp. Also a dedicated user different from nobody would be useful. Unfortunately we do not have the latest systemd release yet. Otherwise runtime directories could be created automatically for DynamicUser=true.

@disassembler
Copy link
Member Author

Looking at the code, doesn't look like it writes any files. Everything is stdout or the http socket opened. I've removed the work dir and private tmp attributes. I also fixed the commit message on service commit to prefix with nixos/

unitConfig.Documentation = "https://github.com/ipstatic/surfboard_exporter";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = "nobody";
Copy link
Member

@Mic92 Mic92 Nov 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following should also work here then:

DynamicUser = "yes";

instead of "nobody".

buildGoPackage rec {
name = "surfboard_exporter-${version}";
version = "2.0.0";
rev = version;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is redundant.

@WilliButz
Copy link
Member

@disassembler I adjusted the commit that adds the module, to work with the new prometheus exporters module (and also rebased this on the current master).

@Mic92
Copy link
Member

Mic92 commented Apr 21, 2018

@WilliButz can you open a pull request?

@WilliButz
Copy link
Member

@Mic92 sure if that's okay with @disassembler I open one in the next days.

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: prometheus-surfboard-exporter

Partial log (click to expand)

strip is /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/x9d90m3pyqsdq73dkrx3iq8yq7p1isqb-surfboard_exporter-2.0.0-bin/bin
patching script interpreter paths in /nix/store/x9d90m3pyqsdq73dkrx3iq8yq7p1isqb-surfboard_exporter-2.0.0-bin
checking for references to /build in /nix/store/x9d90m3pyqsdq73dkrx3iq8yq7p1isqb-surfboard_exporter-2.0.0-bin...
shrinking RPATHs of ELF executables and libraries in /nix/store/xjnikwhsq09fk262pcjfay797wxv67mr-surfboard_exporter-2.0.0
strip is /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/xjnikwhsq09fk262pcjfay797wxv67mr-surfboard_exporter-2.0.0
/nix/store/xjnikwhsq09fk262pcjfay797wxv67mr-surfboard_exporter-2.0.0/share/go/src/github.com/ipstatic/surfboard_exporter/after_success.sh: interpreter directive changed from "/bin/bash" to "/nix/store/xn5gv3lpfy91yvfy9b0i7klfcxh9xskz-bash-4.4-p19/bin/bash"
checking for references to /build in /nix/store/xjnikwhsq09fk262pcjfay797wxv67mr-surfboard_exporter-2.0.0...
/nix/store/x9d90m3pyqsdq73dkrx3iq8yq7p1isqb-surfboard_exporter-2.0.0-bin

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: prometheus-surfboard-exporter

Partial log (click to expand)

/private/tmp/nix-build-surfboard_exporter-2.0.0.drv-0/go /private/tmp/nix-build-surfboard_exporter-2.0.0.drv-0
/private/tmp/nix-build-surfboard_exporter-2.0.0.drv-0
post-installation fixup
strip is /nix/store/kdff2gim6417493yha769kh00n63lnrw-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/zbix4n1ipswnya1l7shp67r0d9ipwq53-surfboard_exporter-2.0.0-bin/bin
patching script interpreter paths in /nix/store/zbix4n1ipswnya1l7shp67r0d9ipwq53-surfboard_exporter-2.0.0-bin
strip is /nix/store/kdff2gim6417493yha769kh00n63lnrw-cctools-binutils-darwin/bin/strip
patching script interpreter paths in /nix/store/qy8ck7rf6prk1zc98p04c1naill576xc-surfboard_exporter-2.0.0
/nix/store/qy8ck7rf6prk1zc98p04c1naill576xc-surfboard_exporter-2.0.0/share/go/src/github.com/ipstatic/surfboard_exporter/after_success.sh: interpreter directive changed from "/bin/bash" to "/nix/store/r8bx3qf1bpncb14i9gzma4vr089pc3pv-bash-4.4-p19/bin/bash"
/nix/store/zbix4n1ipswnya1l7shp67r0d9ipwq53-surfboard_exporter-2.0.0-bin

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: prometheus-surfboard-exporter

Partial log (click to expand)

strip is /nix/store/gp7fylxwn18b7pl2c18ks89hsiaxyfvf-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/n34lzfiky5aviycxfy5g27azgnrj5qpr-surfboard_exporter-2.0.0-bin/bin
patching script interpreter paths in /nix/store/n34lzfiky5aviycxfy5g27azgnrj5qpr-surfboard_exporter-2.0.0-bin
checking for references to /build in /nix/store/n34lzfiky5aviycxfy5g27azgnrj5qpr-surfboard_exporter-2.0.0-bin...
shrinking RPATHs of ELF executables and libraries in /nix/store/5anw43shi54yjz9x2h8c6xgmfa7xgvna-surfboard_exporter-2.0.0
strip is /nix/store/gp7fylxwn18b7pl2c18ks89hsiaxyfvf-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/5anw43shi54yjz9x2h8c6xgmfa7xgvna-surfboard_exporter-2.0.0
/nix/store/5anw43shi54yjz9x2h8c6xgmfa7xgvna-surfboard_exporter-2.0.0/share/go/src/github.com/ipstatic/surfboard_exporter/after_success.sh: interpreter directive changed from "/bin/bash" to "/nix/store/a4qslf0yfs44mhnbagarn232sjnckhy0-bash-4.4-p19/bin/bash"
checking for references to /build in /nix/store/5anw43shi54yjz9x2h8c6xgmfa7xgvna-surfboard_exporter-2.0.0...
/nix/store/n34lzfiky5aviycxfy5g27azgnrj5qpr-surfboard_exporter-2.0.0-bin

@globin globin merged commit 78f09c9 into NixOS:master May 2, 2018
@disassembler disassembler deleted the surfboard branch May 2, 2018 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants