self.monitor_thread.start()\r
\r
# helper tools\r
+ self.pushgateway_process = self.start_PushGateway()\r
self.prometheus_process = self.start_Prometheus()\r
self.cadvisor_process = self.start_cadvisor()\r
\r
logging.info('Start Prometheus container {0}'.format(cmd))\r
return Popen(cmd)\r
\r
+ def start_PushGateway(self, port=9091):\r
+ cmd = ["docker",\r
+ "run",\r
+ "-d",\r
+ "-p", "{0}:9091".format(port),\r
+ "--name", "pushgateway",\r
+ "prom/pushgateway"\r
+ ]\r
+\r
+ logging.info('Start Prometheus Push Gateway container {0}'.format(cmd))\r
+ return Popen(cmd)\r
+\r
def start_cadvisor(self, port=8090):\r
cmd = ["docker",\r
"run",\r
self.prometheus_process.kill()\r
self._stop_container('prometheus')\r
\r
+ if self.pushgateway_process is not None:\r
+ logging.info('stopping pushgateway container')\r
+ self.pushgateway_process.terminate()\r
+ self.pushgateway_process.kill()\r
+ self._stop_container('pushgateway')\r
+\r
if self.cadvisor_process is not None:\r
logging.info('stopping cadvisor container')\r
self.cadvisor_process.terminate()\r
target_groups:
- targets: ['172.17.0.1:8090']
+ - job_name: 'PushGateway'
+
+ # Override the global default and scrape targets from this job every 5 seconds.
+ scrape_interval: 5s
+
+ target_groups:
+ - targets: ['172.17.0.1:9091']
+