{ "Format": "hcl2", "JobID": "prometheus", "JobModifyIndex": 13995677, "Namespace": "default", "Source": "job \"prometheus\" {\n # region = \"global\"\n datacenters = [\"dc1\"]\n type = \"service\"\n\n # priority = 50\n\n constraint {\n attribute = \"${attr.kernel.name}\"\n value = \"linux\"\n }\n constraint {\n attribute = \"${attr.unique.hostname}\"\n operator = \"regexp\"\n value = \"odroid.*\"\n }\n\n # constraint {\n # \tattribute = \"${attr.unique.hostname}\"\n # operator = \"regexp\"\n # value = \"pi.*\"\n # }\n\n update {\n # Stagger updates every 60 seconds\n stagger = \"60s\"\n max_parallel = 1\n }\n group \"prometheus\" {\n count = 2\n\n restart {\n attempts = 2\n interval = \"1m\"\n delay = \"10s\"\n mode = \"delay\"\n }\n\n task \"prometheus\" {\n driver = \"docker\"\n\n config {\n image = \"prom/prometheus\"\nargs = [\"--web.enable-admin-api\",\"--config.file=/etc/prometheus/prometheus.yml\"]\n \n\n ports = [\"http\"]\n memory_hard_limit = \"512\"\n volumes = [\n \"local/prometheus.yml:/etc/prometheus/prometheus.yml\",\n \"local/alerts.yml:/etc/prometheus/alerts.yml\",\n ]\n\n // \"/mnt/gv0/prom_data:/data\",\n // \"/etc/localtime:/etc/localtime\",\n\n logging {\n type = \"json-file\"\n }\n }\n\n service {\n name = \"${TASKGROUP}\"\n tags = [\"global\", \"prometheus\"]\n port = \"http\"\n\n check {\n name = \"alive\"\n type = \"http\"\n interval = \"10s\"\n timeout = \"120s\"\n path = \"/status\"\n port = \"http\"\n }\n }\n\n template {\n change_mode = \"signal\"\n change_signal = \"SIGHUP\"\n data = \"{{ key \\\"prometheus_yml\\\" }}\"\n destination = \"local/prometheus.yml\"\n }\n\n template {\n change_mode = \"restart\"\n \n destination = \"local/alerts.yml\"\n data = \"{{ key \\\"alerts\\\" }}\"\n }\n resources {\n cpu = 500 # 500 MHz\n memory = 48 # 128MB\n }\n # Specify configuration related to log rotation\n logs {\n max_files = 10\n max_file_size = 15\n }\n kill_timeout = \"10s\"\n } ## end prometheus\n\n task \"alertmanager\" {\n driver = \"docker\"\n\n config {\n image = \"prom/alertmanager\"\n\n ports = [\"alerthttp\"]\n\n // volumes = [\n // \"local/alertmanager.yml:/etc/prometheus/prometheus.yml\",\n // ]\n args = [\"--config.file=/local/alertmanager.yml\"]\n // \"/mnt/gv0/prom_data:/data\",\n // \"/etc/localtime:/etc/localtime\",\n\n logging {\n type = \"json-file\"\n }\n }\n\n service {\n name = \"${TASK}\"\n tags = [\"global\", \"prometheus\"]\n port = \"alerthttp\"\n\n check {\n name = \"alive\"\n type = \"http\"\n interval = \"60s\"\n timeout = \"120s\"\n path = \"/status\"\n port = \"http\"\n }\n }\n\n template {\n data = <