summary refs log tree commit diff
path: root/pkgs/servers/monitoring/prometheus/jmx-httpserver.nix
blob: 459ddf01de3c55fc9f6c9b2220ff4806d94ee0ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ lib, stdenv, fetchurl, jre, makeWrapper }:

let
  version = "0.15.0";
  jarName = "jmx_prometheus_httpserver-${version}-jar-with-dependencies.jar";
  mavenUrl = "mirror://maven/io/prometheus/jmx/jmx_prometheus_httpserver/${version}/${jarName}";
in stdenv.mkDerivation {
  inherit version jarName;

  name = "jmx-prometheus-httpserver-${version}";

  src = fetchurl {
    url = mavenUrl;
    sha256 = "0fr3svn8kjp7bq1wzbkvv5awylwn8b01bngj04zvk7fpzqpgs7mz";
  };

  nativeBuildInputs = [ makeWrapper ];
  buildInputs = [ jre ];

  dontUnpack = true;

  installPhase = ''
    mkdir -p $out/libexec
    mkdir -p $out/bin
    cp $src $out/libexec/$jarName
    makeWrapper "${jre}/bin/java" $out/bin/jmx_prometheus_httpserver --add-flags "-jar $out/libexec/$jarName"
  '';

  meta = with lib; {
    homepage = "https://github.com/prometheus/jmx_exporter";
    description = "A process for exposing JMX Beans via HTTP for Prometheus consumption";
    license = licenses.asl20;
    maintainers = [ maintainers.offline ];
    platforms = platforms.unix;
  };
}