Skip to content

telegraf: init at 0.13.2#18149

Closed
roblabla wants to merge 1 commit intoNixOS:masterfrom
roblabla:feature-addTelegraf
Closed

telegraf: init at 0.13.2#18149
roblabla wants to merge 1 commit intoNixOS:masterfrom
roblabla:feature-addTelegraf

Conversation

@roblabla
Copy link
Contributor

Motivation for this change

Adds telegraf, a plugin-driven server agent for collecting & reporting metrics commonly used with influxdb as a more flexible replacement for collectd.

Things done
  • Tested using sandboxing
    (nix.useChroot on NixOS,
    or option build-use-chroot in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • OS X
    • Linux
  • 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.

@mention-bot
Copy link

@roblabla, thanks for your PR! By analyzing the annotation information on this pull request, we identified @edolstra, @joachifm and @offlinehacker to be potential reviewers

@joachifm
Copy link
Contributor

Looks like this needs a rebase

Copy link
Contributor

Choose a reason for hiding this comment

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

What is the use case for making this configurable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Having the "package" configurable allows using a different version of the package with the service unit. I believe most of the packages have it ?

Copy link
Contributor

Choose a reason for hiding this comment

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

But why is that useful in this case. What I'm getting at is that adding options just because you can should be avoided.

Copy link
Contributor

Choose a reason for hiding this comment

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

That said, it's up to you of course, you know the service better than I.

Copy link
Contributor Author

@roblabla roblabla Aug 31, 2016

Choose a reason for hiding this comment

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

I often have packages that are outdated on nixos. Being able to quickly override the package from my configuration.nix allows me to quickly test if a new version will need some changes to the nix definition or not.

TBH, I can remove this either way. I included it mostly because it seems to be there in most other nix services. I've often found it useful, so I kind of just always put it in my packages.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think your use case would be covered by packageOverrides. I've no idea how many existing services have a legitimate use case for this type of option, but I know a fair amount have not.

Copy link
Contributor

Choose a reason for hiding this comment

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

(In my opinion).

Copy link
Contributor Author

@roblabla roblabla Aug 31, 2016

Choose a reason for hiding this comment

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

I don't understand how packageOverrides would fix my problem. As far as I understand, packageOverride works for the "nix-env" use-case, but it doesn't modify the package that will be used for the NixOS service ?

How can I create a nixos configuration.nix that enables a service but uses a different version of the package using packageOverrides ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Package overrides is not really about nix-env, it is a general mechanism for extending/changing the package set.

For example,

  nixpkgs.config.packageOverrides = super: {
     telegraf = super.callPackage ./my/newer/telegraf.nix {};
  }

ought to affect uses of pkgs.telegraf in the service definition. You should be able to do the same via ~/.nixpkgs/config.nix.

@roblabla roblabla force-pushed the feature-addTelegraf branch from 33dcd9b to 9fbdb31 Compare August 31, 2016 15:17
@joachifm joachifm mentioned this pull request Sep 8, 2016
7 tasks
systemd.services.telegraf = {
description = "Telegraf Agent";
wantedBy = [ "multi-user.target" ];
after = [ "network-interfaces.target" ];
Copy link
Contributor

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.target instead of networking.target?

Copy link
Contributor

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-interfaces is 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).

Copy link
Contributor

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.target since so many targets tend to confuse everyone. upstream network targets should really be enough for ordinary services.
feel free to assist 😉

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

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

Copy link
Contributor

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

@groxxda
Copy link
Contributor

groxxda commented Sep 8, 2016

I'm with @joachifm on the package option. Also group is probably unneeded. But these two are up to you.
But the networking-interfaces thing looks wrong to me.

@joachifm
Copy link
Contributor

Superceded by #18437

@joachifm joachifm closed this Sep 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants