-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
telegraf: init at 0.13.2 #18149
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
Closed
Closed
telegraf: init at 0.13.2 #18149
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,71 @@ | ||
| { config, lib, pkgs, ... }: | ||
|
|
||
| with lib; | ||
|
|
||
| let | ||
| cfg = config.services.telegraf; | ||
|
|
||
| configFile = pkgs.runCommand "config.toml" { | ||
| buildInputs = [ pkgs.remarshal ]; | ||
| } '' | ||
| remarshal -if json -of toml \ | ||
| < ${pkgs.writeText "config.json" (builtins.toJSON cfg.extraConfig)} \ | ||
| > $out | ||
| ''; | ||
| in | ||
| { | ||
|
|
||
| ###### interface | ||
|
|
||
| options = { | ||
|
|
||
| services.telegraf = { | ||
|
|
||
| enable = mkEnableOption "telegraf server"; | ||
|
|
||
| package = mkOption { | ||
| default = pkgs.telegraf; | ||
| defaultText = "pkgs.telegraf"; | ||
| description = "Which telegraf derivation to use"; | ||
| type = types.package; | ||
| }; | ||
|
|
||
| extraConfig = mkOption { | ||
| default = {}; | ||
| description = "Extra configuration options for telegraf"; | ||
| type = types.attrs; | ||
| }; | ||
| }; | ||
|
|
||
| }; | ||
|
|
||
|
|
||
| ###### implementation | ||
|
|
||
| config = mkIf config.services.telegraf.enable { | ||
|
|
||
| systemd.services.telegraf = { | ||
| description = "Telegraf Agent"; | ||
| wantedBy = [ "multi-user.target" ]; | ||
| after = [ "network-interfaces.target" ]; | ||
| serviceConfig = { | ||
| ExecStart = ''${cfg.package}/bin/telegraf -config "${configFile}"''; | ||
| User = "telegraf"; | ||
| Group = "telegraf"; | ||
| }; | ||
| }; | ||
|
|
||
| users.extraUsers = [{ | ||
| name = "telegraf"; | ||
| uid = config.ids.uids.telegraf; | ||
| description = "telegraf daemon user"; | ||
| }]; | ||
|
|
||
| users.extraGroups = [{ | ||
| name = "telegraf"; | ||
| gid = config.ids.gids.telegraf; | ||
| }]; | ||
| }; | ||
|
|
||
| } | ||
|
|
||
This file contains hidden or 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,27 @@ | ||
| { lib, buildGoPackage, fetchFromGitHub }: | ||
|
|
||
| buildGoPackage rec { | ||
| name = "telegraf-${version}"; | ||
| version = "0.13.2"; | ||
|
|
||
| src = fetchFromGitHub { | ||
| owner = "influxdata"; | ||
| repo = "telegraf"; | ||
| rev = "${version}"; | ||
| sha256 = "1zdb85wkx5q7c799sn695ckzym6avqz05xlvw0d1p919c2ilba9f"; | ||
| }; | ||
|
|
||
| goPackagePath = "github.com/influxdata/telegraf"; | ||
|
|
||
| # Generated with the `gdm2nix.rb` script and the `Godeps` file from the | ||
| # influxdb repo root. | ||
| goDeps = ./deps.json; | ||
|
|
||
| meta = with lib; { | ||
| description = " The plugin-driven server agent for collecting & reporting metrics. "; | ||
| license = licenses.mit; | ||
| homepage = https://github.com/influxdata/telegraf; | ||
| maintainers = with maintainers; [ roblabla ]; | ||
| platforms = platforms.linux; | ||
| }; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why you set this to
network-interfaces.targetinstead ofnetworking.target?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@groxxda good point. This target is actually used by quite a few services ... From the looks of it,
network-interfacesis akin to an implementation detail and shouldn't be referenced directly by ordinary services (which are probably best served by using special targets for ordering and whatnot).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joachifm a follow up to #18319 is on my to-do to get rid of
network-interfaces.targetsince so many targets tend to confuse everyone. upstream network targets should really be enough for ordinary services.feel free to assist 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure: see https://github.com/joachifm/nixpkgs/tree/network-interfaces for some wip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@groxxda it's a fairly mechanical translation, so needs a bit of sanity checking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joachifm sorry for not notifying you, I also started the work on this https://github.com/groxxda/nixpkgs/commits/network-interfaces
As you said, most is mechanical translation, but there are one or two exceptions.
Also I did a batch of changes to scripted-interfaces because I think ordering is broken there. But this needs more review and was blocking me from a pr. I'll push the current wip state soon
I'll have a look at your changes now