HewlettPackard / oneview-ansible-collection

Ansible Collection and Sample Playbooks for HPE OneView
Apache License 2.0
26 stars 22 forks source link

server_hardware_facts #282

Closed pawelfi closed 10 months ago

pawelfi commented 11 months ago

Hello. It looks that optional fields in gathering information about server hardware utilization don't work.

- name: Gather all facts about a Server Hardware
  oneview_server_hardware_facts:
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 1200
    name: "Encl1, bay 1"
    options:
      - utilization:           # optional
          fields: 'AveragePower'
          filter: ['startDate=2016-05-30T03:29:42.000Z']
          view: 'day'
  delegate_to: localhost
- debug: var=server_hardware_utilization

Instead of values it shows "Warning" array

When using just this code:

- name: Gather all facts about a Server Hardware
  oneview_server_hardware_facts:
    hostname: 172.16.101.48
    username: administrator
    password: my_password
    api_version: 1200
    name: "Encl1, bay 1"
    options:
      - utilization
  delegate_to: localhost
- debug: var=server_hardware_utilization

It showes me output for AveragePower, cpuUtilization.... just not formated but like a lot of json data:

"metricSamples": [
1702053300000,
244
]
[.....

Could you please check the issue?

akshith-gunasheelan commented 11 months ago

Hi @pawelfi thank you for raising the issue. We will look into it and get back to you.

akshith-gunasheelan commented 11 months ago

Hi @pawelfi we tried running the script you have shared and it seems to be working fine. Could you please elaborate on the issue. If you get any warning array could you share the warning message which you are getting.

pawelfi commented 11 months ago
ansible-playbook check_utilization.yaml  -e "composer_ip=xxx.xxx.xxx.xx" -e "name='server_name, bay x'"
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
[WARNING]: Found variable using reserved name: name

PLAY [localhost] *********************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************************************************************************
ok: [localhost]

TASK [Check current time for next steps] *********************************************************************************************************************************************************************
ok: [localhost]

TASK [Get utilization fact of server] ************************************************************************************************************************************************************************
[WARNING]: The value {'utilization': {'filter': ['startDate=2023-12-14T12:06:04Z'], 'fields': 'AveragePower', 'view': 'day'}} (type dict) in a string field was converted to "{'utilization': {'filter':
['startDate=2023-12-14T12:06:04Z'], 'fields': 'AveragePower', 'view': 'day'}}" (type string). If this does not look like what you expect, quote the entire value to ensure it does not change.
ok: [localhost -> localhost]

TASK [debug] *************************************************************************************************************************************************************************************************
ok: [localhost] => {
    "server_hardware_utilization": "VARIABLE IS NOT DEFINED!"
}

PLAY RECAP ***************************************************************************************************************************************************************************************************
localhost                  : ok=4    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
akshith-gunasheelan commented 11 months ago

Thanks @pawelfi we will add this issue into our backlog and take it up as per priority

pawelfi commented 10 months ago

Hello, Is there any progress in finding the issue?

akshith-gunasheelan commented 10 months ago

Hello @pawelfi the issue has been identified and taken up by the team, thank you.

akshith-gunasheelan commented 10 months ago

Hello @pawelfi we have made a fix for the issue and it will be available in the next release, thank you.