Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unable to get poller list message" when run Playbook #6

Open
sudoerss opened this issue Jan 9, 2019 · 10 comments
Open

"Unable to get poller list message" when run Playbook #6

sudoerss opened this issue Jan 9, 2019 · 10 comments

Comments

@sudoerss
Copy link

sudoerss commented Jan 9, 2019

The full traceback is:

WARNING: The below traceback may *not* be related to the actual failure.
  File "/tmp/ansible_centreon_host_payload_eGlT6L/__main__.py", line 173, in main
    if not centreon.exists_poller(instance):
  File "/usr/local/lib/python2.7/dist-packages/centreonapi/centreon.py", line 59, in exists_poller
    self.availablePoller = self.poller.list()
  File "/usr/local/lib/python2.7/dist-packages/centreonapi/webservice/configuration/poller.py", line 26, in list
    return self.webservice.call_clapi('show', 'INSTANCE')
  File "/usr/local/lib/python2.7/dist-packages/centreonapi/webservice/__init__.py", line 80, in call_clapi
    self.auth()
  File "/usr/local/lib/python2.7/dist-packages/centreonapi/webservice/__init__.py", line 59, in auth
    'password': self.authpass
  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 110, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)

fatal: [localhost -> localhost]: FAILED! =>

"msg": "Unable to get poller list"
@guillaumewatteeux
Copy link
Owner

Hi,

Could you paste your playbook ?

Do you have a correct SSL certificate on your platform ?

I think a auto signed certificate don't work with current version.

File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 497, in send
raise SSLError(e, request=request)

@sudoerss
Copy link
Author

sudoerss commented Jan 10, 2019

Hi,

Here is the Playbook

- name: Integrate Host in CENTREON
  hosts: localhost
  vars:
    centreon_url: "http://10.0.40.100/centreon"
    centreon_api_user: "admin"
    centreon_api_pass: "centreon"

    handlers:
    - name: "centreon api applycfg"
      centreon_poller:
        url: "{{ centreon_url }}"
        username: "{{ centreon_api_user }}"
        password: "{{ centreon_api_pass }}"
      listen: centreon api applycfg
      delegate_to: localhost

  tasks:
  - name: Create host in Centreon
    centreon_host:
      url: "{{ centreon_url }}"
      username: "{{ centreon_api_user }}"
      password: "{{ centreon_api_pass }}"
      name: cert-vm1
      alias: cert-vm1
      ipaddr: 10.0.48.25
      hosttemplates:
      - generic-host
      - WINDOWS_WITH_DISK_C
      hostgroups:
      - HOSTGROUP_TEST
      hostgroups_action: set
      instance: Central
      status: enabled
      state: present
      applycfg: False
    delegate_to: localhost
    notify: "centreon api applycfg"

@guillaumewatteeux
Copy link
Owner

Hi,

I'm refacto sdk project, but feu with this commit guillaumewatteeux/centreon-sdk-python@eaa7578

If work, i'll publish new release (0.0.3) To close this issue.

@sbraz
Copy link
Collaborator

sbraz commented Jan 10, 2019

What is the official repo for the Python API then? Is it your fork or centreon's one?
Also, would it be possible to upload the new release to PyPI?

@guillaumewatteeux
Copy link
Owner

Hi,

Centreon is the official repo. But I'm working on it and so quickly for me to work on my repo.

After confirmation about SSL issue , I'll push this commit on official repo, upload on pypi.

@sbraz
Copy link
Collaborator

sbraz commented Jan 10, 2019

I debugged the issue with @sudoerss and it was an SSL certificate verification issue indeed. Do you want us to try the commit you linked earlier after distrusting the certificate?

@camilleturiel
Copy link

Well I'm getting into the same issue

@camilleturiel
Copy link

camilleturiel commented Jan 10, 2019

Sorry guys, it was actually another issue that had nothing to do with it, however leading to the same error message (http_proxy env var was improperly set in my case)

@guillaumewatteeux
Copy link
Owner

HI,

I've just install centreon 18.10 on VM

$ cd centreon-sdk-python
$ git checkout eaa757898e32450510b8460ccd481be3c61c186c
$ pip install .
$ ipython
In [1]: from centreonapi.webservice import Webservice

In [2]: con1 = Webservice.getInstance("http://192.168.189.130/centreon", "admin", "centreon", check_ssl=False)

In [3]: con1.call_clapi('show', 'INSTANCE')
Out[3]:
{'result': [{'id': '1',
   'name': 'Central',
   'localhost': '1',
   'ip address': '127.0.0.1',
   'activate': '1',
   'status': '-',
   'init script': 'centengine',
   'bin': '/usr/sbin/centengine',
   'stats bin': '/usr/sbin/centenginestats',
   'ssh port': '22'}]}

In [4]: con2 = Webservice.getInstance("http://192.168.189.130/centreon", "admin", "centreon", check_ssl=True)

In [5]: con2.call_clapi('show', 'INSTANCE')
Out[5]:
{'result': [{'id': '1',
   'name': 'Central',
   'localhost': '1',
   'ip address': '127.0.0.1',
   'activate': '1',
   'status': '-',
   'init script': 'centengine',
   'bin': '/usr/sbin/centengine',
   'stats bin': '/usr/sbin/centenginestats',
   'ssh port': '22'}]}

Could you test with this command ?

@sbraz
Copy link
Collaborator

sbraz commented Jan 28, 2019

Works fine with your commit and master (guillaumewatteeux/centreon-sdk-python@a2eb536) but I still see warnings (that are supposed to be disabled by this):

/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)

Test code:

args = […]
from centreonapi.webservice import Webservice
Webservice.getInstance(*args, check_ssl=False).call_clapi("show", "INSTANCE")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants