Ad Widget

Collapse

Run Zabbix Agent as Domain Admin

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mhk
    Junior Member
    • Dec 2020
    • 9

    #1

    Run Zabbix Agent as Domain Admin

    The Setup:
    I need a simple check for a possible Nextcloud synchronization error on our NAS.​
    So I wrote a simple PowerShell script to check for that and I want Zabbix to call and monitor this and throw an alarm, in case the value returns 1

    Code:
    $path = "\\nas\<path>\KeePass\Databases"
    $pattern = "corrupted"
    
    $search_results = Get-ChildItem -Path $path | Where-Object { ((! $_.PSIsContainer)) }
    
    foreach ($file in $search_results) {
        if ($file.name -like "*$pattern*") {
            return "1"
        }
    }
    return "0"​
    The Script is on a Windows Server with several tools and the synchronization happens on the NAS.

    The Problem:
    - The script itself it works just fine if you execute it locally.
    - But: if I try to call it through Zabbix (Zabbix-Agent 2 installed on the Win Server) though, I get a
    Code:
    PermissionDenied: (\\nas\<path>\KeePass\Databases:String) [Get-ChildItem], Unauthoriz
    edAccessException​
    However: If I change the path in the script to something local like "C:\Users\Administrator.DOMAIN\Documents" Zabbix can easily call the script and get a result.

    Which leads me to believe that my Zabbix-Agent runs with/ has local Admin rights, but not Domain rights.

    Is there any way to change the permissions with which Zabbix-Agent runs resp. executes the script?​
    Last edited by mhk; 04-07-2023, 08:53.
  • goran.q
    Junior Member
    • Nov 2021
    • 5

    #2
    Hi,
    Zabbix Agent is started under local system account on server, by default.
    You can change account under which Zabbix Agent service is running (Zabbix Agent service > Properties > Log on tab), although I think it is not good idea to run it as Domain Admin. Better is to create domain user, add it to local administrators group on server and give user required rights on NAS.

    Comment

    Working...