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
[WIP] icinga2: init at 2.7.0 #29577
[WIP] icinga2: init at 2.7.0 #29577
Conversation
6b0aeb5
to
3bd2864
Compare
pkgs/top-level/all-packages.nix
Outdated
@@ -11548,6 +11548,8 @@ with pkgs; | |||
erlang = erlang_basho_R16B02; | |||
}; | |||
|
|||
icinga2_client = callPackage ../servers/monitoring/icinga2/client.nix { }; |
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.
Why not just called it icinga2 and the other package icinga2-web 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.
This is how upstream names it.
79b8388
to
143609d
Compare
environment = pkgs.writeText "icinga-env" '' | ||
DAEMON=${pkgs.icinga2}/sbin/icinga2 | ||
ICINGA2_CONFIG_FILE=/etc/icinga2/icinga2.conf | ||
ICINGA2_RUN_DIR=/var/run |
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.
/var/run is deprecated - should be /run
cfg = config.services.icinga2; | ||
environment = pkgs.writeText "icinga-env" '' | ||
DAEMON=${pkgs.icinga2}/sbin/icinga2 | ||
ICINGA2_CONFIG_FILE=/etc/icinga2/icinga2.conf |
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.
Any reason we "pollute" /etc? Can't we write the config to the nix store?
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.
merely debugging trying to get the thing to run in the first place. My end goal is to have it be a src the user can define as say a git repository or tarball somewhere.
let | ||
cfg = config.services.icinga2; | ||
environment = pkgs.writeText "icinga-env" '' | ||
DAEMON=${pkgs.icinga2}/sbin/icinga2 |
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.
Should probably be lib.getBin pkgs.icinga2
DAEMON=${pkgs.icinga2}/sbin/icinga2 | ||
ICINGA2_CONFIG_FILE=/etc/icinga2/icinga2.conf | ||
ICINGA2_RUN_DIR=/var/run | ||
ICINGA2_STATE_DIR=/var/icinga2 |
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.
Should be /var/lib/icinga2 to be in line with other packages.
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.
What does upstream here? This should be the default otherwise there is an important reason.
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.
Most of the NixOS stuff ends up in /var/lib/[package]
so if all we need to do is define that variable, shouldn't we choose to be consistent with ourselves instead of just following upstream?
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.
Then we break documentation and third party-tools, which I find a more important aim then the aesthetics of consistency. We should always have an important reason before we break with upstream.
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.
It's /var/lib/icinga2 on centos 7 icinga instance I have, I'm changing it here.
EnvironmentFile = environment; | ||
ExecStart = "${pkgs.icinga2}/bin/icinga2 daemon -d"; | ||
ExecReload = "${pkgs.icinga2}/lib/icinga2/safe-reload ${environment}"; | ||
PIDFile = "/var/run/icinga2/icinga2.pid"; |
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.
You should use RuntimeDirectory = "icinga2";
to have /run/icinga2
created for you.
143609d
to
ec6e2ea
Compare
export MYSQL_INCLUDE_DIR=${mysql}/include/mysql | ||
''; | ||
|
||
buildInputs = [ cmake boost yajl openssl flex bison mysql postgresql ]; |
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.
cmake should be in nativeBuildInputs instead. Not sure about flex and bison but probably those too.
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.
correct, cmake, flex and bison should be there.
|
||
preConfigure = '' | ||
export MYSQL_INCLUDE_DIR=${mysql}/include/mysql | ||
''; |
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.
- preConfigure = ''
- export MYSQL_INCLUDE_DIR=${mysql}/include/mysql
- '';
+ MYSQL_INCLUDE_DIR="${mysql}/include/mysql";
It builds successfully now, and the service runs, but running icinga2 node wizard it tries writing to |
Latest changes create a new variable for config directory separate from the one used that mkdir is ran using. It's a hack, but service runs, icinga2 node wizard works, and icinga2 service continued to run after restart. Next steps here are to enable database backend and create a web2 package that can be launched with a php-fpm service. |
I don't use icinga2 anymore. If someone else wants to take this over, have fun, I'm closing. |
Motivation for this change
working on adding icinga client and server to nixos.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)