# # Cookbook:: kosmos_prometheus # Recipe:: server # include_recipe "firewall" prometheus_install "prometheus" do version node["prometheus"]["version"] checksum node["prometheus"]["checksum"] end prometheus_config "prometheus" do global_config( "scrape_interval" => "30s", "evaluation_interval" => "30s" ) end prometheus_job "prometheus" do target "localhost:9090" end prometheus_job "node" do target "localhost:9100" end with_run_context :root do execute "reload prometheus config" do command "systemctl reload prometheus.service" action :nothing subscribes :run, "template[/opt/prometheus/prometheus.yml]", :delayed end end prometheus_service "prometheus" do cli_options({ "config.file" => "/opt/prometheus/prometheus.yml", "log.level" => "info", "query.max-concurrency" => 20, "query.lookback-delta" => "5m", "query.timeout" => "2m", "storage.tsdb.path" => "/var/lib/prometheus", "storage.tsdb.retention.time" => "15d", "web.listen-address" => ":9090" }) end firewall_rule "prometheus web" do port 9090 source "10.1.1.0/24" protocol :tcp command :allow end