Move web port to an attribute
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
node.default["kosmos_prometheus"]["version"] = "3.13.0"
|
node.default["kosmos_prometheus"]["version"] = "3.13.0"
|
||||||
node.default["kosmos_prometheus"]["checksum"] = "744d93324cc024d82089921737bd797474d7f1e5dbbfd1c6b387bad258538cb9"
|
node.default["kosmos_prometheus"]["checksum"] = "744d93324cc024d82089921737bd797474d7f1e5dbbfd1c6b387bad258538cb9"
|
||||||
|
|
||||||
|
node.default["kosmos_prometheus"]["web"]["port"] = "9090"
|
||||||
|
|
||||||
node.default["kosmos_prometheus"]["alertmanager"]["version"] = "0.33.0"
|
node.default["kosmos_prometheus"]["alertmanager"]["version"] = "0.33.0"
|
||||||
node.default["kosmos_prometheus"]["alertmanager"]["checksum"] = "8ce11c42e8a6dfbbf93a59c0b193cb1329210b36d0c7ef3df7b745608675a1d1"
|
node.default["kosmos_prometheus"]["alertmanager"]["checksum"] = "8ce11c42e8a6dfbbf93a59c0b193cb1329210b36d0c7ef3df7b745608675a1d1"
|
||||||
|
|
||||||
@@ -21,7 +23,7 @@ node.default["kosmos_prometheus"]["alerting"] = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node.default["kosmos_prometheus"]["jobs"] = {
|
node.default["kosmos_prometheus"]["jobs"] = {
|
||||||
"prometheus" => { "targets" => [{ "target" => "localhost:9090", "instance" => "localhost" }] },
|
"prometheus" => { "targets" => [{ "target" => "localhost:#{node["kosmos_prometheus"]["web"]["port"]}", "instance" => "localhost" }] },
|
||||||
}
|
}
|
||||||
|
|
||||||
node.default["kosmos_prometheus"]["rule_files"] = []
|
node.default["kosmos_prometheus"]["rule_files"] = []
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ checksum = node["kosmos_prometheus"]["checksum"]
|
|||||||
tarball = "#{Chef::Config[:file_cache_path]}/prometheus-#{version}.linux-amd64.tar.gz"
|
tarball = "#{Chef::Config[:file_cache_path]}/prometheus-#{version}.linux-amd64.tar.gz"
|
||||||
binary_url = "https://github.com/prometheus/prometheus/releases/download/v#{version}/prometheus-#{version}.linux-amd64.tar.gz"
|
binary_url = "https://github.com/prometheus/prometheus/releases/download/v#{version}/prometheus-#{version}.linux-amd64.tar.gz"
|
||||||
|
|
||||||
|
web_port = node["kosmos_prometheus"]["web"]["port"]
|
||||||
|
|
||||||
group "prometheus"
|
group "prometheus"
|
||||||
|
|
||||||
user "prometheus" do
|
user "prometheus" do
|
||||||
@@ -110,7 +112,7 @@ systemd_unit "prometheus.service" do
|
|||||||
Type: "simple",
|
Type: "simple",
|
||||||
User: "prometheus",
|
User: "prometheus",
|
||||||
Group: "prometheus",
|
Group: "prometheus",
|
||||||
ExecStart: "/usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus --storage.tsdb.retention.time=15d --web.listen-address=:9090 --web.enable-lifecycle",
|
ExecStart: "/usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus --storage.tsdb.retention.time=15d --web.listen-address=:#{web_port} --web.enable-lifecycle",
|
||||||
ExecReload: "/bin/kill -HUP $MAINPID",
|
ExecReload: "/bin/kill -HUP $MAINPID",
|
||||||
Restart: "on-failure",
|
Restart: "on-failure",
|
||||||
RestartSec: "5",
|
RestartSec: "5",
|
||||||
@@ -128,7 +130,7 @@ service "prometheus" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
firewall_rule "prometheus web" do
|
firewall_rule "prometheus web" do
|
||||||
port 9090
|
port web_port
|
||||||
source "10.1.1.0/24"
|
source "10.1.1.0/24"
|
||||||
protocol :tcp
|
protocol :tcp
|
||||||
command :allow
|
command :allow
|
||||||
|
|||||||
Reference in New Issue
Block a user