docker-compose


How to monitor / discover more docker containers with prometheus


I am using prometheus, node-exporter and grafana locally with docker-compose to see how metrics can be displayed. Is it possible to add a container as a service (such as apache \ nginx ) in the docker-compose.yml and have the service discovered so that its metrics are also taken into account? The documentation is not too helpful in explaining this.
If everything needs to run locally (ie, both your Prometheus and the monitored entities are on the same machine), I would not bother with proper auto-discovery. Rather, I'd just have a static config file in Prometheus listing each of the services it needs to monitor.
Each of these services would be running in a docker container, each with its own metric-exporting app (like the node-exporter or Telegraf). Yes, this means you'll need to extend your nginx-docker with telegraf (or other tool) to have a metric-emitting docker container.
that way, Prometheus would be scraping n urls for n services. You could probably run all them in --net=host mode, but then each service would need to export its metrics in a different port.
Keep in mind that when you gather metrics from within a docker container, some of metrics might be wrong, since the container has a limited view of the system. So OS/HW metrics might be off. But if you're interested in custom/app-level metrics, that should be fine.
so, to sum:
- each docker needs to run its own exporter (maybe exporting in a different port)
- prometheus should be configured to know where to look for each of these services.
if you really want auto-discovery, look into Consul and how it integrates with Prometheus. I'm told you can actually run consul-server AND consul-clients on the same machine, and with it you can setup Prometheus to read the list of services from Consul (meaning, have auto-discovery) without having to explicitly list each of them in the config file.
Using zookeeper should also work: your containers would register with zookeeper and Prometheus would be aware of them from zk (disclaimer: I've never tried this particular configuration).

Related Links

Django Docker-compose machine does not start web server
How should docker-compose jobs discover etcd?
docker compose adding nodes dynamically to nginx frontend
Docker Swarm - dependencies definition
docker-compose volume not mounted
Exposing sentry service in docker-compose file
Yesod and docker-compose logs in development mode
Docker compose to always deploy using latest image
JHipster - Doubts in the development using Microservices Architecture
Gogs + Drone getsockopt: connection refused
Concourse result keeps loading
Docker-compose: AttributeError: 'module' object has no attribute 'ssl'
scaling a service with docker compose
Docker Compose apparently ignores COMPOSE_FILE
Where does Docker install gems on a mac
What is the difference between docker-machine and docker-compose?

Categories

HOME
oop
swift3
itunesconnect
glsl
ms-application-insights
grid
msbi
webpack-dev-server
angularjs-ng-repeat
minimax
xmlhttprequest
infopath
background-image
smooth-scrolling
draw2d
caldav
multipart
connection-pooling
devexpress-mvc
ps
ckeditor4.x
suitescript
ballerinalang
wordpress-rest-api
urhosharp
flickr
intersection
pyenv
repeat
maven-2
multi-user
const
origami
latency
jslider
mediastream
blueimp
ninja-forms
android-graphview
python-venv
f#-fake
ocamlbuild
aot
liferay-ide
totalview
dynatable
timex
pyautogui
alarmmanager
x12
change-password
transaction-isolation
razorengine
chomsky-normal-form
code-translation
dcast
imageicon
play-json
gitk
persian
jain-sip
dnvm
hexagonal-tiles
azure-mobile-app
avd
wingdb
xcode5
system.io.packaging
nsurlrequest
farpoint-spread
nodeunit
data-layers
autofilter
mahara
google-voice
violation
forward-declaration
http-compression
shapado
github-archive
bash4
nude.js
copyfile
utm
vectorwise
windows-xp-embedded
cinder
viewdata
nyromodal
browser-state
html-help-workshop
cstring
unauthorized
managed-code
high-load
hotfix

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App