Ad Widget

Collapse

Zabbix Aganet Powershell script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zabbixx
    Member
    • Jul 2012
    • 71

    #1

    Zabbix Aganet Powershell script

    Hello,
    we want to check the ESX-Server after Coldstart, therefore we have an powershell script.

    but if i try to run this script the execution fails!!!!

    i did a sample "bat" file whit this content

    Code:
    echo START %date% %time% >> C:\zabbix\tmp.txt
    powershell.exe -command D:\source_dev\scripts\zabbix\check_ESX_after_start.ps1 -Hostname vcp64-esx-11.xxx.DOMAIN.de
    echo ENDE %date% %time% >> C:\zabbix\tmp.txt
    the script connects to the vcenter and check's the host! ( this tooks a long time ~40secs)

    content of the C:\zabbix\tmp.txt
    Code:
    START 02.06.2015 18:39:49,80 
    START 02.06.2015 18:41:11,57 
    START 02.06.2015 18:45:03,88 
    START 02.06.2015 18:46:05,36 
    START 02.06.2015 18:49:56,51
    (there is no END stamp!!!)

    I Ad a script to the zabbix Server for testing (testing execution from zabbix Server)

    CHECK ESX-HOST AFTER RESTART
    Code:
    cmd /c C:\zabbix\test.bat
    Why the script fails to execute ?
    And why there is no END stamp?


    if i create a simple powershellscript "C:\zabbix\test.ps1"
    Code:
    echo "test"
    and execute it in the bat file

    Code:
    echo START %date% %time% >> C:\zabbix\tmp.txt
    powershell.exe -command C:\zabbix\test.ps1
    echo ENDE %date% %time% >> C:\zabbix\tmp.txt
    now i got the Start and END stamps! in the tmp.txt

    Code:
    START 02.06.2015 19:02:18,24 
    ENDE 02.06.2015 19:02:18,62
    seems that the zabbix-agent hangs somwhere and dont execute the 3 command ????

    any idea ?
  • zabbixx
    Member
    • Jul 2012
    • 71

    #2
    Found the problem!
    the zabbix agent ist running under local Admin user as Service!
    and my script needs an other user, or one cridential box popus !

    Permission Problem.....

    I chnaged the Zabbix Service to one other account that i need!
    Last edited by zabbixx; 03-06-2015, 14:16.

    Comment

    Working...