Comment 3 for bug 1879524

Revision history for this message
DUFOUR Olivier (odufourc) wrote :

The code has been tested in these scenarios :
* single RabbitMQ unit with NRPE subordinate
* clustered RabbitMQ with 3 units with NRPE subordinate
* single RabbitMQ unit without any NRPE subordinate

All of these RabbitMQ units are running from 3.9/stable charm.
For all of them, the upgrade of the charm now behaves properly and doesn't end in error either.

Before the ownership of the files would be following :ubuntu@juju-393eaf-0-lxd-1:~$ sudo -u nagios /usr/local/lib/nagios/plugins/check_rabbitmq_queues.py -c '\*' '\*' 100 200 -m 600 /var/lib/rabbitmq/data/juju-393eaf-0-lxd-1_queue_stats.dat
OK
ubuntu@juju-393eaf-0-lxd-1:~$ groups nagios
nagios : nagios
ubuntu@juju-393eaf-0-lxd-1:~$ sudo ls -l /var/lib/rabbitmq/
total 12
drwxr-xr-x 2 root root 4096 Oct 24 10:30 data
drwxr-xr-x 2 root root 4096 Oct 24 10:30 logs
drwxr-x--- 4 rabbitmq rabbitmq 4096 Oct 24 10:28 mnesia
ubuntu@juju-393eaf-0-lxd-1:~$ sudo ls -l /var/lib/rabbitmq/data/
total 8
-rw-r--r-- 1 root root 56 Oct 24 10:30 juju-393eaf-0-lxd-1_general_stats.dat
-rw-r--r-- 1 root root 88 Oct 24 10:30 juju-393eaf-0-lxd-1_queue_stats.dat

To check if Nagios NRPE is able to collect the stats (it should return 'OK') :
ubuntu@juju-393eaf-0-lxd-1:~$ cat /etc/nagios/nrpe.d/check_rabbitmq_queue.cfg | grep command | cut -f 2 -d '='
/usr/local/lib/nagios/plugins/check_rabbitmq_queues.py -c '\*' '\*' 100 200 -m 600 /var/lib/rabbitmq/data/juju-393eaf-0-lxd-1_queue_stats.dat
ubuntu@juju-393eaf-0-lxd-1:~$ sudo -u nagios /usr/local/lib/nagios/plugins/check_rabbitmq_queues.py -c '\*' '\*' 100 200 -m 600 /var/lib/rabbitmq/data/juju-393eaf-0-lxd-1_queue_stats.dat
OK

After Charm upgrade :
ubuntu@juju-393eaf-0-lxd-1:~$ sudo ls -l /var/lib/rabbitmq/
total 12
drwxr-x--- 2 rabbitmq rabbitmq 4096 Oct 24 10:30 data
drwxr-x--- 2 rabbitmq rabbitmq 4096 Oct 24 10:30 logs
drwxr-x--- 4 rabbitmq rabbitmq 4096 Oct 24 10:28 mnesia
ubuntu@juju-393eaf-0-lxd-1:~$ sudo ls -l /var/lib/rabbitmq/data
total 8
-rw-r----- 1 rabbitmq rabbitmq 56 Oct 24 10:30 juju-393eaf-0-lxd-1_general_stats.dat
-rw-r----- 1 rabbitmq rabbitmq 88 Oct 24ubuntu@juju-393eaf-0-lxd-1:~$ sudo -u nagios /usr/local/lib/nagios/plugins/check_rabbitmq_queues.py -c '\*' '\*' 100 200 -m 600 /var/lib/rabbitmq/data/juju-393eaf-0-lxd-1_queue_stats.dat
OK 10:30 juju-393eaf-0-lxd-1_queue_stats.dat
ubuntu@juju-393eaf-0-lxd-1:~$ groups nagios
nagios : nagios rabbitmqubuntu@juju-393eaf-0-lxd-1:~$ sudo -u nagios /usr/local/lib/nagios/plugins/check_rabbitmq_queues.py -c '\*' '\*' 100 200 -m 600 /var/lib/rabbitmq/data/juju-393eaf-0-lxd-1_queue_stats.dat
OKubuntu@juju-393eaf-0-lxd-1:~$ sudo -u nagios /usr/local/lib/nagios/plugins/check_rabbitmq_queues.py -c '\*' '\*' 100 200 -m 600 /var/lib/rabbitmq/data/juju-393eaf-0-lxd-1_queue_stats.dat
OK

And Nagios is still able to reach the required files :
ubuntu@juju-393eaf-0-lxd-1:~$ sudo -u nagios /usr/local/lib/nagios/plugins/check_rabbitmq_queues.py -c '\*' '\*' 100 200 -m 600 /var/lib/rabbitmq/data/juju-393eaf-0-lxd-1_queue_stats.dat
OK