diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2021-04-02 12:24:20 +0200 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2021-04-02 19:16:50 +0200 |
commit | 4794829734ec88d5ab7e70703968adaa0da78088 (patch) | |
tree | 7de99e21b0bab96157341d5b9d4204e08978820c /nixos/tests/prometheus-exporters.nix | |
parent | 763933b3d026b4894a84aaee88707cc4b718fc5f (diff) | |
download | nixpkgs-4794829734ec88d5ab7e70703968adaa0da78088.tar nixpkgs-4794829734ec88d5ab7e70703968adaa0da78088.tar.gz nixpkgs-4794829734ec88d5ab7e70703968adaa0da78088.tar.bz2 nixpkgs-4794829734ec88d5ab7e70703968adaa0da78088.tar.lz nixpkgs-4794829734ec88d5ab7e70703968adaa0da78088.tar.xz nixpkgs-4794829734ec88d5ab7e70703968adaa0da78088.tar.zst nixpkgs-4794829734ec88d5ab7e70703968adaa0da78088.zip |
prometheus-openldap-exporter: init at 2.1
Diffstat (limited to 'nixos/tests/prometheus-exporters.nix')
-rw-r--r-- | nixos/tests/prometheus-exporters.nix | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/nixos/tests/prometheus-exporters.nix b/nixos/tests/prometheus-exporters.nix index 290cb87abbe..c32cd341e5e 100644 --- a/nixos/tests/prometheus-exporters.nix +++ b/nixos/tests/prometheus-exporters.nix @@ -603,6 +603,66 @@ let ''; }; + openldap = { + exporterConfig = { + enable = true; + ldapCredentialFile = "${pkgs.writeText "exporter.yml" '' + ldapUser: "cn=root,dc=example" + ldapPass: "notapassword" + ''}"; + }; + metricProvider = { + services.openldap = { + enable = true; + settings.children = { + "cn=schema".includes = [ + "${pkgs.openldap}/etc/schema/core.ldif" + "${pkgs.openldap}/etc/schema/cosine.ldif" + "${pkgs.openldap}/etc/schema/inetorgperson.ldif" + "${pkgs.openldap}/etc/schema/nis.ldif" + ]; + "olcDatabase={1}mdb" = { + attrs = { + objectClass = [ "olcDatabaseConfig" "olcMdbConfig" ]; + olcDatabase = "{1}mdb"; + olcDbDirectory = "/var/db/openldap"; + olcSuffix = "dc=example"; + olcRootDN = { + # cn=root,dc=example + base64 = "Y249cm9vdCxkYz1leGFtcGxl"; + }; + olcRootPW = { + path = "${pkgs.writeText "rootpw" "notapassword"}"; + }; + }; + }; + "olcDatabase={2}monitor".attrs = { + objectClass = [ "olcDatabaseConfig" ]; + olcDatabase = "{2}monitor"; + olcAccess = [ "to dn.subtree=cn=monitor by users read" ]; + }; + }; + declarativeContents."dc=example" = '' + dn: dc=example + objectClass: domain + dc: example + + dn: ou=users,dc=example + objectClass: organizationalUnit + ou: users + ''; + }; + }; + exporterTest = '' + wait_for_unit("prometheus-openldap-exporter.service") + wait_for_open_port(389) + wait_for_open_port(9330) + wait_until_succeeds( + "curl -sSf http://localhost:9330/metrics | grep -q 'openldap_scrape{result=\"ok\"} 1'" + ) + ''; + }; + openvpn = { exporterConfig = { enable = true; |