Fix Ceph collectd plugin errors for OSP17
Ceph SocketPath has changed in OSP17. Now the path includes fsid also. Change-Id: I2afb25cf2ef971b668c9c92f9552f35863ee0eb3
This commit is contained in:
parent
e3c8ec2285
commit
8485df3535
@ -313,8 +313,11 @@ class CollectdCephStorage(object):
|
||||
if check_output:
|
||||
output = subprocess.check_output(command)
|
||||
else:
|
||||
stdin, stdout, stderr = os.popen3(' '.join(command))
|
||||
output = stdout.read()
|
||||
process = subprocess.Popen(' '.join(command), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
stdout, stderr = process.communicate()
|
||||
if process.returncode != 0:
|
||||
raise RuntimeError("Error occurred: {}".format(stderr.decode('utf-8')))
|
||||
output = stdout.decode('utf-8')
|
||||
except Exception as exc:
|
||||
collectd.error(
|
||||
'collectd-ceph-storage: {} exception: {}'.format(command, exc))
|
||||
|
@ -342,6 +342,17 @@
|
||||
when: "('CephStorage' in group_names and ceph_storage_collectd_plugin)"
|
||||
# End CephStorage OSD monitoring
|
||||
|
||||
- name: Get Ceph cluster fsid
|
||||
shell: ls /var/run/ceph/
|
||||
register: ceph_cluster_fsid
|
||||
become: true
|
||||
when: "rhosp_version is version('17.0', '>=')"
|
||||
delegate_to: controller-0
|
||||
|
||||
- name: set fact for ceph cluster id
|
||||
set_fact:
|
||||
ceph_cluster_fsid: "{{ ceph_cluster_fsid.stdout }}"
|
||||
|
||||
- name: Configure collectd.conf
|
||||
template:
|
||||
src: "{{config_type}}.collectd.conf.j2"
|
||||
|
@ -110,7 +110,11 @@ PreCacheChain "PreCache"
|
||||
LongRunAvgLatency false
|
||||
ConvertSpecialMetricTypes true
|
||||
<Daemon "osd.{{inventory_hostname}}.{{cephstorage_osd_socket.stdout}}">
|
||||
{% if rhosp_version | float >= 17.0 %}
|
||||
SocketPath "/var/run/ceph/{{ceph_cluster_fsid}}/ceph-osd.{{cephstorage_osd_socket.stdout}}.asok"
|
||||
{% else %}
|
||||
SocketPath "/var/run/ceph/ceph-osd.{{cephstorage_osd_socket.stdout}}.asok"
|
||||
{% endif %}
|
||||
</Daemon>
|
||||
</Plugin>
|
||||
|
||||
|
@ -204,7 +204,11 @@ PreCacheChain "PreCache"
|
||||
LongRunAvgLatency false
|
||||
ConvertSpecialMetricTypes true
|
||||
<Daemon "mon.{{inventory_hostname}}">
|
||||
{% if rhosp_version | float >= 17.0 %}
|
||||
SocketPath "/var/run/ceph/{{ceph_cluster_fsid}}/ceph-mon.{{inventory_hostname}}.asok"
|
||||
{% else %}
|
||||
SocketPath "/var/run/ceph/ceph-mon.{{inventory_hostname}}.asok"
|
||||
{% endif %}
|
||||
</Daemon>
|
||||
</Plugin>
|
||||
|
||||
|
@ -165,6 +165,17 @@
|
||||
when: "('CephStorage' in group_names and ceph_storage_collectd_plugin) and (rhosp_version is version('17.0', '<'))"
|
||||
# End CephStorage OSD monitoring
|
||||
|
||||
- name: Get Ceph cluster fsid
|
||||
shell: ls /var/run/ceph/
|
||||
register: ceph_cluster_fsid
|
||||
become: true
|
||||
when: "rhosp_version is version('17.0', '>=')"
|
||||
delegate_to: controller-0
|
||||
|
||||
- name: set fact for ceph cluster id
|
||||
set_fact:
|
||||
ceph_cluster_fsid: "{{ ceph_cluster_fsid.stdout }}"
|
||||
|
||||
- name: Get 1st OSD socket
|
||||
shell: cephadm shell -- ls /var/run/ceph/ | head -n 1 | egrep -o '[0-9]+'
|
||||
register: cephstorage_osd_socket
|
||||
|
@ -109,7 +109,11 @@ PreCacheChain "PreCache"
|
||||
LongRunAvgLatency false
|
||||
ConvertSpecialMetricTypes true
|
||||
<Daemon "osd.{{inventory_hostname}}.{{cephstorage_osd_socket.stdout}}">
|
||||
{% if rhosp_version | float >= 17.0 %}
|
||||
SocketPath "/var/run/ceph/{{ceph_cluster_fsid}}/ceph-osd.{{cephstorage_osd_socket.stdout}}.asok"
|
||||
{% else %}
|
||||
SocketPath "/var/run/ceph/ceph-osd.{{cephstorage_osd_socket.stdout}}.asok"
|
||||
{% endif %}
|
||||
</Daemon>
|
||||
</Plugin>
|
||||
|
||||
|
@ -121,7 +121,11 @@ PreCacheChain "PreCache"
|
||||
LongRunAvgLatency false
|
||||
ConvertSpecialMetricTypes true
|
||||
<Daemon "mon.{{inventory_hostname}}">
|
||||
{% if rhosp_version | float >= 17.0 %}
|
||||
SocketPath "/var/run/ceph/{{ceph_cluster_fsid}}/ceph-mon.{{inventory_hostname}}.asok"
|
||||
{% else %}
|
||||
SocketPath "/var/run/ceph/ceph-mon.{{inventory_hostname}}.asok"
|
||||
{% endif %}
|
||||
</Daemon>
|
||||
</Plugin>
|
||||
|
||||
|
@ -313,8 +313,11 @@ class CollectdCephStorage(object):
|
||||
if check_output:
|
||||
output = subprocess.check_output(command)
|
||||
else:
|
||||
stdin, stdout, stderr = os.popen3(' '.join(command))
|
||||
output = stdout.read()
|
||||
process = subprocess.Popen(' '.join(command), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
stdout, stderr = process.communicate()
|
||||
if process.returncode != 0:
|
||||
raise RuntimeError("Error occurred: {}".format(stderr.decode('utf-8')))
|
||||
output = stdout.decode('utf-8')
|
||||
except Exception as exc:
|
||||
collectd.error(
|
||||
'collectd-ceph-storage: {} exception: {}'.format(command, exc))
|
||||
|
Loading…
x
Reference in New Issue
Block a user