K
K
Kozlov2022-04-12 11:52:46
Zabbix
Kozlov, 2022-04-12 11:52:46

How to log in to Zabbix python requests?

You need to log in to zabbix to get the image of the charts using python. Before upgrading to 5.4, I logged in by passing zbx_sessionid. Now zbx_session is being transmitted in which various data is encrypted in base64.

{"sessionid":"a94b746df946a291da9ff434127ea64061","sign":"4fce0b085b49200765644c27e63ac8ebf1296561529ee02aa099e82394ae8e12ea"}

How to login in zabbix 5.4? where to get sign key?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kozlov, 2022-04-13
@romandkoz

Solved the issue through the basic authorization of requests.post

Working code for getting csv file problems
session = requests.Session()
session.post('http://zabbix.local', {
     'name':  'mylogin',
     'password': 'mypassword',
     'autologin': 1,
     'enter': 'Sign in'
})
result = session.get('http://zabbix.local/zabbix.php?action=problem.view.csv', headers=session.headers).content
print(result)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question