-
Notifications
You must be signed in to change notification settings - Fork 3
Implement Prometheus Metrics #4
Conversation
Hi @mpereira / @samvantran,
currently i am using curl to get cassandra_exporter jar from git, but once all things are ok i will upload this jar to http://downloads.mesosphere.com. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operator/templates/stateful-set.yaml
Outdated
@@ -46,7 +46,7 @@ spec: | |||
imagePullPolicy: Always | |||
# Dockerfile based on: | |||
# https://github.com/docker-library/cassandra/blob/master/3.11/Dockerfile | |||
image: mpereira/cassandra:3.11.4 | |||
image: viivek46/cassandra:3.11.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, can we add tooling to use non-personal images? and can we add additional versioning so that we don't overwrite each other's images?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to use the Cassandra image, right?
Here's what I propose in terms of KUDO Cassandra depending on the cassandra_exporter repository:
- Add cassandra_exporter it as a git submodule under
vendor/cassandra_exporter
- Create a symlink from
images/Dockerfile.prometheus-exporter
tovendor/cassandra_exporter/docker/Dockerfile
- Build/push
mesosphere/cassandra_exporter
Docker image based onimages/Dockerfile.prometheus-exporter
(can be personal for now until I finish implementing Docker image build support) and use that for the prometheus exporter container. - Revert the changes in the Cassandra node Dockerfile and pod.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds kind of involved - why don't we make this a separate ticket for now so that we don't block the metrics work. If we're okay with personal images for now, let's continue using them until the Docker image build support is in place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, step 3 above calls out that the image can be personal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert line 49 for now @viivek46.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have modified exporter docker file, as cassandra_exporter.jar file was not accessible by non root user, and i skipped step 1,2 from Murilo's suggestion and copy paste run.sh and docker file from crito's repo and modify them in our repo.
Co-Authored-By: Sam Tran <[email protected]>
operator/templates/stateful-set.yaml
Outdated
@@ -46,7 +46,7 @@ spec: | |||
imagePullPolicy: Always | |||
# Dockerfile based on: | |||
# https://github.com/docker-library/cassandra/blob/master/3.11/Dockerfile | |||
image: mpereira/cassandra:3.11.4 | |||
image: viivek46/cassandra:3.11.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to use the Cassandra image, right?
Here's what I propose in terms of KUDO Cassandra depending on the cassandra_exporter repository:
- Add cassandra_exporter it as a git submodule under
vendor/cassandra_exporter
- Create a symlink from
images/Dockerfile.prometheus-exporter
tovendor/cassandra_exporter/docker/Dockerfile
- Build/push
mesosphere/cassandra_exporter
Docker image based onimages/Dockerfile.prometheus-exporter
(can be personal for now until I finish implementing Docker image build support) and use that for the prometheus exporter container. - Revert the changes in the Cassandra node Dockerfile and pod.
Hey @viivek46, thanks for your initial work! Changes mostly look good, I left a few comments regarding some changes. Also, we'll probably want an integration test to make sure this actually works. Maybe we can work on it together? Since I'm still wrapping up #3. A useful sanity integration test could be similar as the one we have for the DC/OS Cassandra service: https://github.com/mesosphere/dcos-commons/blob/1809d70db5acd6aa8620a82c6a786e3a25d63f89/frameworks/cassandra/tests/test_sanity.py#L85-L104 |
Also, I think it's ok that for this PR to not make |
Created https://jira.mesosphere.com/browse/DCOS-60293 for the above. |
operator/templates/stateful-set.yaml
Outdated
@@ -46,7 +46,7 @@ spec: | |||
imagePullPolicy: Always | |||
# Dockerfile based on: | |||
# https://github.com/docker-library/cassandra/blob/master/3.11/Dockerfile | |||
image: mpereira/cassandra:3.11.4 | |||
image: viivek46/cassandra:3.11.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert line 49 for now @viivek46.
docs/monitoring.md
Outdated
|
||
``` | ||
kubectl create -f resources/service-monitor.yaml | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add instructions to how to import the Grafana dashboard. And probably remove what's currently written, since the service monitor will be installed by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct with new changes which include automation I will update this instructions, i just pushed code as "wip" as we were discussing about cassandra_exporter image issue.
Currently I am just updating doc, about adding instructions Grafana dashboard i still need to work out that, as provided json in cassandra_export was not working on my first test.
Co-Authored-By: Murilo Pereira <[email protected]>
* Unify handling of Docker images. * Build Prometheus exporter Docker image too. * Set both Docker image namespaces to "mesosphere". * Make Prometheus exporter image version composite as well. * Change Prometheus exporter Docker image name. * Snapshot Docker image versions. * Improve documentation. Remove KUDO-specific details. * Add automatic formatting for Markdown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @viivek46!
@@ -0,0 +1,3 @@ | |||
FROM criteord/cassandra_exporter:2.2.1 | |||
|
|||
RUN chown 999:999 /opt/cassandra_exporter/cassandra_exporter.jar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@viivek46 can you please explain why we need to chown
the file? What runs as UID 999 and why does it need to own this JAR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@porridge: can you please explain why we need to chown the file? What runs as UID 999 and why does it need to own this JAR?
Because of the pod security context this image container runs under.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mpereira . However chown
-ing the file gives the process the permission to modify the code to be run, which is frowned upon from security PoV.
I'm guessing the intent probably to chmod a+r
it...
-rw-rwx--- 1 root root 4607224 Jan 30 2019 cassandra_exporter.jar
```
Right. So the fix should actually be done upstream, let me take a stab at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The permissions are now [fixed](criteo/cassandra_exporter#68) in upstream repo, so we can drop [the chown](#4 (review)): ``` porridge@beczulka:~$ docker run criteord/cassandra_exporter:2.3.2 ls -l /opt/cassandra_exporter Unable to find image 'criteord/cassandra_exporter:2.3.2' locally 2.3.2: Pulling from criteord/cassandra_exporter bc51dd8edc1b: Pull complete d1d06863bb82: Pull complete adf4d10a782b: Pull complete 7db4424ff270: Pull complete e008a301333c: Pull complete 10121b885a52: Pull complete 0d34188e8091: Pull complete fc3c7604e1c5: Pull complete 019737f36353: Pull complete a26e5d6f647b: Pull complete 3b6b59aecfbd: Pull complete Digest: sha256:9fe7cfef9b03ca294c80e5da098add4698c4103bbddf382dd93d2e01a073d6e3 Status: Downloaded newer image for criteord/cassandra_exporter:2.3.2 total 4760 -rw-rw-r-- 1 root root 4871483 Feb 10 13:31 cassandra_exporter.jar porridge@beczulka:~$ ```
The permissions are now [fixed](criteo/cassandra_exporter#68) in upstream repo, so we can drop [the chown](#4 (review)): ``` porridge@beczulka:~$ docker run criteord/cassandra_exporter:2.3.2 ls -l /opt/cassandra_exporter Unable to find image 'criteord/cassandra_exporter:2.3.2' locally 2.3.2: Pulling from criteord/cassandra_exporter bc51dd8edc1b: Pull complete d1d06863bb82: Pull complete adf4d10a782b: Pull complete 7db4424ff270: Pull complete e008a301333c: Pull complete 10121b885a52: Pull complete 0d34188e8091: Pull complete fc3c7604e1c5: Pull complete 019737f36353: Pull complete a26e5d6f647b: Pull complete 3b6b59aecfbd: Pull complete Digest: sha256:9fe7cfef9b03ca294c80e5da098add4698c4103bbddf382dd93d2e01a073d6e3 Status: Downloaded newer image for criteord/cassandra_exporter:2.3.2 total 4760 -rw-rw-r-- 1 root root 4871483 Feb 10 13:31 cassandra_exporter.jar porridge@beczulka:~$ ```
The permissions are now [fixed](criteo/cassandra_exporter#68) in upstream repo, so we can drop [the chown](#4 (review)): ``` porridge@beczulka:~$ docker run criteord/cassandra_exporter:2.3.2 ls -l /opt/cassandra_exporter Unable to find image 'criteord/cassandra_exporter:2.3.2' locally 2.3.2: Pulling from criteord/cassandra_exporter bc51dd8edc1b: Pull complete d1d06863bb82: Pull complete adf4d10a782b: Pull complete 7db4424ff270: Pull complete e008a301333c: Pull complete 10121b885a52: Pull complete 0d34188e8091: Pull complete fc3c7604e1c5: Pull complete 019737f36353: Pull complete a26e5d6f647b: Pull complete 3b6b59aecfbd: Pull complete Digest: sha256:9fe7cfef9b03ca294c80e5da098add4698c4103bbddf382dd93d2e01a073d6e3 Status: Downloaded newer image for criteord/cassandra_exporter:2.3.2 total 4760 -rw-rw-r-- 1 root root 4871483 Feb 10 13:31 cassandra_exporter.jar porridge@beczulka:~$ ``` We actually bump to 2.3.3 since the earlier one was non-functional.
The permissions are now [fixed](criteo/cassandra_exporter#68) in upstream repo, so we can drop [the chown](#4 (review)): ``` porridge@beczulka:~$ docker run criteord/cassandra_exporter:2.3.2 ls -l /opt/cassandra_exporter Unable to find image 'criteord/cassandra_exporter:2.3.2' locally 2.3.2: Pulling from criteord/cassandra_exporter bc51dd8edc1b: Pull complete d1d06863bb82: Pull complete adf4d10a782b: Pull complete 7db4424ff270: Pull complete e008a301333c: Pull complete 10121b885a52: Pull complete 0d34188e8091: Pull complete fc3c7604e1c5: Pull complete 019737f36353: Pull complete a26e5d6f647b: Pull complete 3b6b59aecfbd: Pull complete Digest: sha256:9fe7cfef9b03ca294c80e5da098add4698c4103bbddf382dd93d2e01a073d6e3 Status: Downloaded newer image for criteord/cassandra_exporter:2.3.2 total 4760 -rw-rw-r-- 1 root root 4871483 Feb 10 13:31 cassandra_exporter.jar porridge@beczulka:~$ ``` We actually bump to 2.3.3 since the earlier one was non-functional. Also rename a parameter in cassandra config as the old one is not recognized.
The permissions are now [fixed](criteo/cassandra_exporter#68) in upstream repo, so we can drop [the chown](#4 (review)): ``` porridge@beczulka:~$ docker run criteord/cassandra_exporter:2.3.2 ls -l /opt/cassandra_exporter Unable to find image 'criteord/cassandra_exporter:2.3.2' locally 2.3.2: Pulling from criteord/cassandra_exporter bc51dd8edc1b: Pull complete d1d06863bb82: Pull complete adf4d10a782b: Pull complete 7db4424ff270: Pull complete e008a301333c: Pull complete 10121b885a52: Pull complete 0d34188e8091: Pull complete fc3c7604e1c5: Pull complete 019737f36353: Pull complete a26e5d6f647b: Pull complete 3b6b59aecfbd: Pull complete Digest: sha256:9fe7cfef9b03ca294c80e5da098add4698c4103bbddf382dd93d2e01a073d6e3 Status: Downloaded newer image for criteord/cassandra_exporter:2.3.2 total 4760 -rw-rw-r-- 1 root root 4871483 Feb 10 13:31 cassandra_exporter.jar porridge@beczulka:~$ ``` We actually bump to 2.3.3 since the earlier one was non-functional. Also rename a parameter in cassandra config as the old one is not recognized.
The permissions are now [fixed](criteo/cassandra_exporter#68) in upstream repo, so we can drop [the chown](#4 (review)): ``` porridge@beczulka:~$ docker run criteord/cassandra_exporter:2.3.2 ls -l /opt/cassandra_exporter Unable to find image 'criteord/cassandra_exporter:2.3.2' locally 2.3.2: Pulling from criteord/cassandra_exporter bc51dd8edc1b: Pull complete d1d06863bb82: Pull complete adf4d10a782b: Pull complete 7db4424ff270: Pull complete e008a301333c: Pull complete 10121b885a52: Pull complete 0d34188e8091: Pull complete fc3c7604e1c5: Pull complete 019737f36353: Pull complete a26e5d6f647b: Pull complete 3b6b59aecfbd: Pull complete Digest: sha256:9fe7cfef9b03ca294c80e5da098add4698c4103bbddf382dd93d2e01a073d6e3 Status: Downloaded newer image for criteord/cassandra_exporter:2.3.2 total 4760 -rw-rw-r-- 1 root root 4871483 Feb 10 13:31 cassandra_exporter.jar porridge@beczulka:~$ ``` We actually bump to 2.3.4 since there were other problems with 2.3.2 and 2.3.3.
What changes are proposed in this PR?
Resolves DCOS-59498
This PR Implement Prometheus Metrics for kudo Cassandra operator. we have used criteo cassandra_exporter to export Cassandra metrics.
To implement this below decisions are made :
How were these changes tested?
Manually tested and Below are steps to check