Ad Widget

Collapse

Juste pour le Fun tasklist et winexe

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • -pat-
    Junior Member
    • Sep 2006
    • 13

    #1

    Juste pour le Fun tasklist et winexe

    Bonjour à tous,

    Si vous avez un Trigger sur le Load d'un windows, et vous voulez voir d'un simple script les processus lancés sur ce windows je vous propose un petit script.

    Administration ->Scripts -> CONFIGURATION OF SCRIPTSListe des Processus

    Script Server /opt/zabbix/externalscripts/tasklist.sh {HOST.CONN}


    [root@zab externalscripts]# cat tasklist.sh
    FILEWIN=`mktemp`
    FILE=`mktemp`


    echo "tasklist & exit " | /opt/zabbix/externalscripts/winexe -U administrateur%zabbix //$1 cmd.exe 2>&1 >$FILEWIN

    iconv -c $FILEWIN > $FILE
    cat $FILE
    rm -f $FILE $FILEWIN
    [root@zab externalscripts]#
    Attention il y a deux lignes importants, il faut absolument le PIPE de winexe

    echo "tasklist & exit " | /opt/zabbix/externalscripts/winexe -U administrateur%zabbix //$1 cmd.exe

    sinon il y a une erreur
    tevent: EPOLL_CTL_ADD failed (Operation not permitted) - falling back to select()

    et l'autre ligne c'est le

    iconv -c $FILEWIN > $FILE

    sinon il y a une erreur de sorti

    Details
    ERROR: Cannot connect to the trapper port of zabbix server daemon, but it should be available to run the script.
    • Undefined index: data [include/classes/api/CAPIObject.php:44]
    • Invalid argument supplied for foreach() [include/config.inc.php:452]



    Voila si ça peut aider....
    Last edited by -pat-; 08-11-2012, 18:36.
  • -pat-
    Junior Member
    • Sep 2006
    • 13

    #2
    Juste pour le Fun tasklist, winexe et wmic

    reBonjour,

    Pour info il n'y a pas de problème avec wmic :

    Code:
    #!/bin/bash
    
    #Test le bon nombre de paramettre
    if [ $# -ne 1 ]
    then
      exit
    fi
    
    
    FILE=`mktemp`
    
    /opt/zabbix/externalscripts/wmic -U "administrateur%zabbix"  //$1 "Select PercentProcessorTime from Win32_PerfRawData_PerfProc_Process" | sort --field-separator='|'  -k2  -r -h | sed -e 's/|/\t/g' | column  -tx > $FILE
    
    #Test l'execution de la commande
    TEST=$?
    if [ $TEST -eq 1 ]
    then
       exit
    fi
    
    
    cat $FILE
    rm -f $FILE

    Comment

    Working...