ConfigException: No credentials being used on check_resources

Bug #1983613 reported by Rodrigo Barbieri
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
charm-openstack-service-checks
Fix Released
High
Robert Gildein

Bug Description

Deploying openstack-service-checks on focal-yoga, charm revision 16, looking at nagios I get the following alerts:

[2022-08-04 18:03:11] SERVICE ALERT: juju-juju-cf6c78-fy-nagios-11;juju-juju-cf6c78-fy-nagios-11-ports;UNKNOWN;HARD;4;<function check at 0x7f06af942af0> raised unknown exception '<class 'openstack.exceptions.ConfigException'>'
Service Unknown
[2022-08-04 18:03:01] SERVICE ALERT: juju-juju-cf6c78-fy-nagios-11;juju-juju-cf6c78-fy-nagios-11-floating_ips;UNKNOWN;SOFT;3;<function check at 0x7f4ab9b26af0> raised unknown exception '<class 'openstack.exceptions.ConfigException'>'
Service Unknown
[2022-08-04 18:02:31] SERVICE ALERT: juju-juju-cf6c78-fy-nagios-11;juju-juju-cf6c78-fy-nagios-11-servers;UNKNOWN;SOFT;3;<function check at 0x7f304d3a5af0> raised unknown exception '<class 'openstack.exceptions.ConfigException'>'

trying to run those checks from nagios result in error:

root@juju-cf6c78-fy-nagios-6:/usr/lib/nagios/plugins# /usr/lib/nagios/plugins/check_nrpe -H 10.5.2.86 -c check_servers -t 10
<function check at 0x7fe96537daf0> raised unknown exception '<class 'openstack.exceptions.ConfigException'>'
============================================================
Traceback (most recent call last):
  File "/usr/local/lib/nagios/plugins/nagios_plugin3.py", line 37, in try_check
    function(*args, **kwargs)
  File "/usr/local/lib/nagios/plugins/check_resources.py", line 252, in check
    connection = openstack.connect(cloud="envvars")
  File "/usr/lib/python3/dist-packages/openstack/__init__.py", line 58, in connect
    cloud_region = openstack.config.get_cloud_region(
  File "/usr/lib/python3/dist-packages/openstack/config/__init__.py", line 36, in get_cloud_region
    return config.get_one(options=parsed_options, **kwargs)
  File "/usr/lib/python3/dist-packages/openstack/config/loader.py", line 1068, in get_one
    config = self._get_base_cloud_config(cloud, profile)
  File "/usr/lib/python3/dist-packages/openstack/config/loader.py", line 474, in _get_base_cloud_config
    raise exceptions.ConfigExce

cinder services work though:

root@juju-cf6c78-fy-nagios-6:/usr/lib/nagios/plugins# /usr/lib/nagios/plugins/check_nrpe -H 10.5.2.86 -c check_cinder_services -t 10
OK: All cinder services happy

running from openstack-service-checks node:

root@juju-cf6c78-fy-nagios-11:~# /usr/local/lib/nagios/plugins/check_resources.py --all server
<function check at 0x7ff1605609d0> raised unknown exception '<class 'openstack.exceptions.ConfigException'>'
============================================================
Traceback (most recent call last):
  File "/usr/local/lib/nagios/plugins/nagios_plugin3.py", line 37, in try_check
    function(*args, **kwargs)
  File "/usr/local/lib/nagios/plugins/check_resources.py", line 252, in check
    connection = openstack.connect(cloud="envvars")
  File "/usr/lib/python3/dist-packages/openstack/__init__.py", line 58, in connect
    cloud_region = openstack.config.get_cloud_region(
  File "/usr/lib/python3/dist-packages/openstack/config/__init__.py", line 36, in get_cloud_region
    return config.get_one(options=parsed_options, **kwargs)
  File "/usr/lib/python3/dist-packages/openstack/config/loader.py", line 1068, in get_one
    config = self._get_base_cloud_config(cloud, profile)
  File "/usr/lib/python3/dist-packages/openstack/config/loader.py", line 474, in _get_base_cloud_config
    raise exceptions.ConfigException(
openstack.exceptions.ConfigException: Cloud envvars was not found.
============================================================

but sourcing the novarc nagios file works:

root@juju-cf6c78-fy-nagios-11:~# source /var/lib/nagios/nagios.novarc
root@juju-cf6c78-fy-nagios-11:/root# /usr/local/lib/nagios/plugins/check_resources.py --all server
OK: servers

Tags: bseng-342 sts

Related branches

Revision history for this message
Rodrigo Barbieri (rodrigo-barbieri2010) wrote :

check_cinder_services.py reads the credentials automatically:

parser.add_argument(
        "--env",
        dest="env",
        default="/var/lib/nagios/nagios.novarc",
        help="Novarc file to use for this check",
    )

tags: added: sts
Changed in charm-openstack-service-checks:
status: New → In Progress
assignee: nobody → Robert Gildein (rgildein)
importance: Undecided → High
Eric Chen (eric-chen)
tags: added: bseng-342
Changed in charm-openstack-service-checks:
status: In Progress → Fix Committed
Changed in charm-openstack-service-checks:
milestone: none → 22.10
Changed in charm-openstack-service-checks:
status: Fix Committed → Fix Released
Changed in charm-openstack-service-checks:
status: Fix Released → Fix Committed
Changed in charm-openstack-service-checks:
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.