You are not logged in.
Pages: 1
Hey guys,
If anyone is interested, I'm putting together a python api to interface with GLPI webservice. Initial thought was to be able to use it to create a nagios plugin that automatically generates tickets when servers fail. Good for metrics and all that.
Hope someone finds it useful.
https://github.com/mcphargus/python-glpi
If this has been done before, someone please point me at the current code and I'll be happy to contribute or start using it.
Warm regards,
Clint
Offline
Great idea !
I don't think anybody have work on this before (or have make its work publicly available).
If you agree, I can add a link from the Webservice wiki page to your project (which could probably have be hosted on glpi forge...)
Small note
self.url = 'http://'+host+'/plugins/webservices/rest.php?'
You probably also need a "baseurl" option.
I don't know if "rest" is the best choice... I know there is some issues with multi-line data encoding.
params = {'method':'glpi.status',
'session':self.session}
A few methods, this one included, doesn't required an open session.
Why a try / raise block, only for connect method ? other could also fail.
Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/
Offline
Feel free to add a link from the webservices wiki.
I'll add a baseurl option, but I'm a little worried that urllib2 might not like SSL/TLS, so anyone trying to use an https connection might have issues. I'll research this further.
A few methods, this one included, doesn't required an open session.
Duly noted, I've made connecting optional where a session is not required.
I don't know if "rest" is the best choice... I know there is some issues with multi-line data encoding.
I haven't spent lots of time with SOAP or XML-RPC webservices in python, and I'm pretty sure some methods, like glpi.addTicketDocument, will have a problem with base64 encoded documents being shoved into a GET request, mostly due to request size constraints. I'll do my best to address these concerns in documentation.
Why a try / raise block, only for connect method ? other could also fail.
I have a ton of error handling to add, and I'll be adding as time permits.
Offline
Feel free to add a link from the webservices wiki.
Done.
I'll add a baseurl option, but I'm a little worried that urllib2 might not like SSL/TLS, so anyone trying to use an https connection might have issues. I'll research this further
I don"t mean the "http" part of the URL, but the part between "host" and "/plugins/webs...". Default value should be "/glpi"
Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/
Offline
I don"t mean the "http" part of the URL, but the part between "host" and "/plugins/webs...". Default value should be "/glpi"
I see what you mean. That makes sense.
Default is now "/glpi". It can be changed by setting the BASEURL property after instantiating the GLPI class.
It's added now.
Offline
Pages: 1