Open sudoerss opened 5 years ago
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)
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"
Hi,
I'm refacto sdk project, but feu with this commit https://github.com/guillaumewatteeux/centreon-sdk-python/commit/eaa757898e32450510b8460ccd481be3c61c186c
If work, i'll publish new release (0.0.3) To close this issue.
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?
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.
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?
Well I'm getting into the same issue
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)
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 ?
Works fine with your commit and master (guillaumewatteeux/centreon-sdk-python@a2eb536fbf82f9c159158a85afd144ebe3e07060) 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")
The full traceback is: