How can I find out what the the last replication packet processed?

I’m working on setting up monitoring of my local musicbrainz docker instance with Nagios and I’ve got my script able to tell me when my local instance differs from the published version on GitHub, i.e. when a new version is released. What I’m wondering now is if there is a way to query the docker system to see what the last replication packet that was processed is? I know I could login and use docker-compose to look through the mirror.log file but it would be nice if there was a command that could be run so I could feed the result to a script and to my Nagios system so it would show up in a single location. After all that what monitoring is for. :stuck_out_tongue_winking_eye:


You can rely on the replication_control table. See:

docker-compose exec db psql -U musicbrainz -d musicbrainz_db \
    -x -c 'SELECT * FROM replication_control'

To retrieve the replication packet number only:

docker-compose exec db psql -U musicbrainz -d musicbrainz_db \
    -c 'COPY(SELECT current_replication_sequence FROM replication_control) TO STDOUT'

That is just what I needed! Thanks so much for the quick reply.