Hi I am trying to get the graph image connecting to the frontend via http request in python.
I know how to get the graph image, but I cant figure out how to login with urlib2.
What i have actualy is that :
Since its the first time i use urllib, it can come from that, or just i dont get how to connect to zabbix and handle the connection. PLease help me find out how to do that.
I know how to get the graph image, but I cant figure out how to login with urlib2.
What i have actualy is that :
Code:
def login(config):
url = u'%s/index.php' % config.zabbix_frontend_url
data = urlencode(dict(
form='1',
form_refresh='1',
name=config.zabbix_username,
password=config.zabbix_password,
enter='Enter'))
cookie_jar = CookieJar()
cookie_processor = HTTPCookieProcessor(cookie_jar)
opener = build_opener(cookie_processor)
# since we only call the index page to login, we are not interested in the output
# TODO error handling
install_opener(opener)
urlopen(url, data)
Comment