Fix some simple mistake
1.The configure is different to the output in install guide. 2.k8s_api has list_namespaced_pod() rather than list_namespaced_pods(). 3.Before division, we should check whether the divisor is zero. Change-Id: I9ca676eac4e3dcba4dcc5553bb5502896d73960e
This commit is contained in:
parent
4b4d4b0f84
commit
828aff671d
@ -111,12 +111,12 @@ service, you must create a database, service credentials, and API endpoints.
|
|||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ openstack service create --name magnum \
|
$ openstack service create --name magnum \
|
||||||
--description "Container Infrastructure Management Service" \
|
--description "OpenStack Container Infrastructure Management Service" \
|
||||||
container-infra
|
container-infra
|
||||||
+-------------+-------------------------------------------------------+
|
+-------------+-------------------------------------------------------+
|
||||||
| Field | Value |
|
| Field | Value |
|
||||||
+-------------+-------------------------------------------------------+
|
+-------------+-------------------------------------------------------+
|
||||||
| description | OpenStack Container Infrastructure Management service |
|
| description | OpenStack Container Infrastructure Management Service |
|
||||||
| enabled | True |
|
| enabled | True |
|
||||||
| id | 194faf83e8fd4e028e5ff75d3d8d0df2 |
|
| id | 194faf83e8fd4e028e5ff75d3d8d0df2 |
|
||||||
| name | magnum |
|
| name | magnum |
|
||||||
|
@ -74,12 +74,12 @@ service, you must create a database, service credentials, and API endpoints.
|
|||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ openstack service create --name magnum \
|
$ openstack service create --name magnum \
|
||||||
--description "Container Infrastructure Management Service" \
|
--description "OpenStack Container Infrastructure Management Service" \
|
||||||
container-infra
|
container-infra
|
||||||
+-------------+-------------------------------------------------------+
|
+-------------+-------------------------------------------------------+
|
||||||
| Field | Value |
|
| Field | Value |
|
||||||
+-------------+-------------------------------------------------------+
|
+-------------+-------------------------------------------------------+
|
||||||
| description | OpenStack Container Infrastructure Management service |
|
| description | OpenStack Container Infrastructure Management Service |
|
||||||
| enabled | True |
|
| enabled | True |
|
||||||
| id | 194faf83e8fd4e028e5ff75d3d8d0df2 |
|
| id | 194faf83e8fd4e028e5ff75d3d8d0df2 |
|
||||||
| name | magnum |
|
| name | magnum |
|
||||||
|
@ -68,7 +68,7 @@ class K8sMonitor(MonitorBase):
|
|||||||
def _parse_pod_info(self, pods):
|
def _parse_pod_info(self, pods):
|
||||||
"""Parse pods and retrieve memory and cpu details about each pod
|
"""Parse pods and retrieve memory and cpu details about each pod
|
||||||
|
|
||||||
:param pods: The output of k8s_api.list_namespaced_pods()
|
:param pods: The output of k8s_api.list_namespaced_pod()
|
||||||
For example:
|
For example:
|
||||||
{
|
{
|
||||||
'items': [{
|
'items': [{
|
||||||
|
@ -65,7 +65,7 @@ class MesosMonitor(MonitorBase):
|
|||||||
return self.data['mem_used'] * 100 / self.data['mem_total']
|
return self.data['mem_used'] * 100 / self.data['mem_total']
|
||||||
|
|
||||||
def compute_cpu_util(self):
|
def compute_cpu_util(self):
|
||||||
if self.data['cpu_used'] == 0:
|
if self.data['cpu_total'] == 0 or self.data['cpu_used'] == 0:
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
return self.data['cpu_used'] * 100 / self.data['cpu_total']
|
return self.data['cpu_used'] * 100 / self.data['cpu_total']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user