You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi i have created a zabbix frontend module to generate a audit report. For some requirement i want to fetch the current logged in user name for that session i want to fetch it and use it in the php code of zabbix module. How can i get the logged in user name for that session? i tried user.get api but it's not working
`function getLoggedInUsername($apiUrl, $apiToken)
{
$data = [
'jsonrpc' => '2.0',
'method' => 'user.get',
'params' => [
'output' => ['userid', 'alias'],
'selectMediatypes' => 'extend',
],
'auth' => $apiToken,
'id' => 1,
];
Hi i have created a zabbix frontend module to generate a audit report. For some requirement i want to fetch the current logged in user name for that session i want to fetch it and use it in the php code of zabbix module. How can i get the logged in user name for that session? i tried user.get api but it's not working
`function getLoggedInUsername($apiUrl, $apiToken)
{
$data = [
'jsonrpc' => '2.0',
'method' => 'user.get',
'params' => [
'output' => ['userid', 'alias'],
'selectMediatypes' => 'extend',
],
'auth' => $apiToken,
'id' => 1,
];
}
// Zabbix API URL and token
$zabbixApiUrl = 'https://zabbix url/zabbix/api_jsonrpc.php';
$zabbixApiToken = 'zabbix token'
// Get the currently logged-in username
$loggedInUsername = getLoggedInUsername($zabbixApiUrl, $zabbixApiToken);
echo "Retrieved Username (Main Script): $loggedInUsername\n";
`
i am getting the following Retrieved Username (Main Script):
The text was updated successfully, but these errors were encountered: