When setting the nagios_additional_checks options to '{"ceph_slow_requests": "slow requests"}' the nagios plugin fails to run

Bug #2008784 reported by Marcelo Subtil Marcal
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Ceph Monitor Charm
Fix Released
Undecided
Facundo Ciccioli

Bug Description

Setting nagios_additional_checks='{"ceph_slow_requests": "slow requests"}' as juju-lint requires, causes the error on nagios: "NRPE: Unable to read output"

The nagios command definition is rendered as following:
```
$ cat check_ceph-ceph_slow_requests.cfg
# check ceph-ceph_slow_requests
# The following header was added automatically by juju
# Modifying it will affect nagios monitoring and alerting
# servicegroups: juju
command[check_ceph-ceph_slow_requests]=/usr/local/lib/nagios/plugins/check_ceph_status.py -f /var/lib/nagios/cat-ceph-status.txt --additional_check '"slow' 'requests"' --additional_check_critical
```

Running the command by hand:
```
$ /usr/local/lib/nagios/plugins/check_ceph_status.py -f /var/lib/nagios/cat-ceph-status.txt --additional_check '"slow' 'requests"' --additional_check_critical
usage: check_ceph_status.py [-h] [-f STATUS_FILE] [--degraded_thresh DEGRADED_THRESH] [--misplaced_thresh MISPLACED_THRESH] [--recovery_rate RECOVERY_RATE]
                            [--raise_nodeepscrub] [--additional_check ADDITIONAL_CHECK] [--additional_check_critical] [--check_num_osds]
check_ceph_status.py: error: unrecognized arguments: requests"
```

== Env
OS Version: jammy/yoga

Charm version:
Channel: quincy/stable
Rev: 149

Changed in charm-ceph-mon:
status: New → Incomplete
status: Incomplete → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-ceph-mon (master)
Changed in charm-ceph-mon:
status: Confirmed → In Progress
Changed in charm-ceph-mon:
assignee: nobody → Facundo Ciccioli (fandanbango)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-ceph-mon (master)

Reviewed: https://review.opendev.org/c/openstack/charm-ceph-mon/+/877109
Committed: https://opendev.org/openstack/charm-ceph-mon/commit/b9f78052035ab7e8a58b6b77e8d6c4fbe8abef0c
Submitter: "Zuul (22348)"
Branch: master

commit b9f78052035ab7e8a58b6b77e8d6c4fbe8abef0c
Author: Facundo Ciccioli <email address hidden>
Date: Fri Mar 10 18:02:34 2023 +0100

    Fix Nagios additional checks functionality

    Commit 40b22e3d on juju/charm-helpers repo introduced shell quoting of
    each argument passed to the check, turning the quoting of the double quotes
    done here not only unnecessary but also damaging to the final command.

    Closes-Bug: #2008784
    Change-Id: Ifedd5875d27e72a857b01a48afcd058476734695
    func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/1022

Changed in charm-ceph-mon:
status: In Progress → Fix Committed
Revision history for this message
Paul Goins (vultaire) wrote :

Is this released yet?

Revision history for this message
Luciano Lo Giudice (lmlogiudice) wrote :

The change is on both edge and quincy, yes.

Changed in charm-ceph-mon:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.