ihatemodels / zabbix2glpi

Open and assign GLPI Tickets based on Zabbix events
14 stars 6 forks source link

Issue when executing this scripts #1

Closed ferielyessad closed 1 year ago

ferielyessad commented 2 years ago

Hello,

I followed the procedure of this project, I executed the scripts contained in this project but it doesn't work, here is the error returned after executing this command on our zabbix server:

python3 glpi_ticket.py -host "HOST.NAME" -eid "456" -tid "123" -tn "TRIGGER.NAME" -user "UserName in GLPI to assign the ticket"

/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py:1020: InsecureRequestWarning: Unverified HTTPS request is being made to host 'x.x.x.x'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings InsecureRequestWarning, Traceback (most recent call last): File "/usr/lib/zabbix/alertscripts/glpi.py", line 136, in __set_session result = response.json()['session_token'] TypeError: list indices must be integers or slices, not str

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "glpi_ticket.py", line 80, in main() File "glpi_ticket.py", line 60, in main url="https://x.x.x.x/apirest.php/") File "/usr/lib/zabbix/alertscripts/glpi.py", line 91, in init self.__set_session() File "/usr/lib/zabbix/alertscripts/glpi.py", line 139, in __set_session raise ConnectionError("Can't connect to glpi server") ConnectionError: Can't connect to glpi server

Please help me to solve this issues!

Best Regards

ihatemodels commented 1 year ago

Sorry for the late response. It seems that your certificate of the GLPI is signed by unknown authority. Maybe you use custom certs. You can add , verify=False) to the end of the line here: https://github.com/ihatemodels/zabbix2glpi/blob/cf99f6ec7e76e6af610a648bb7a68e66506433e5/glpi.py#L127 Which should look like this:

response = requests.get(init_url, headers=headers, timeout=5, verify=False)