Ad Widget

Collapse

get spaces in response form batch file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • noortr01
    Junior Member
    • Aug 2017
    • 4

    #1

    get spaces in response form batch file

    Hello,

    I have a Question.
    I have made a bat file for some search in a txt document.

    The anser of the batch file is a nummer of licences that are in use.
    The batch file on a dos promt works fine. But i get spaces in the anser to zabbix.

    in the debug log i get this:
    EXECUTE_STR() command:'"C:\script\licexport.bat" 1' len:5 cmd_result:' 5'

    But when i look in notepadd ++ i get this
    EXECUTE_STR() command:'"C:\script\licexport.bat" 1' len:5 cmd_result:'FF FF FF FF 5'

    What can i my problem :-)
  • noortr01
    Junior Member
    • Aug 2017
    • 4

    #2
    I use this script.


    @echo off
    cls
    "C:\rlmutil" rlmstat -a > c:\script\lic.txt
    set logdisk=c:
    set log=c:\script\
    set max=40
    set /a counter=1
    set logfiles=lic.txt
    rem echo on
    rem %Logdisk%
    cd %log%
    :upcount
    for %%i in (%*) do set /a counter+=1
    findstr /C:"inuse: %counter%," %logfiles% >>NULL
    rem echo errorlevel %errorlevel%
    if %counter%==%max% goto maxlic
    if %errorlevel%==1 goto upcount
    rem if %errorlevel%==0 echo:OK "%counter% Licence in use of max licence = %max% ".
    if %errorlevel%==0 goto echocount
    goto end
    goto upcount

    :maxlic
    echo CRITICAL ERROR %max in use".

    :echocount
    cls
    echo %counter%


    I run this script by the zabbix_agentd.conf

    UserParameter=checklic[*],"C:\script\licexport.bat" $1


    $1 is 1. I check the loop from 1 to 40


    Get these error in zabbix server

    Received value [ 9] is not suitable for value type [Numeric (unsigned)] and data type [Decimal

    Comment

    • noortr01
      Junior Member
      • Aug 2017
      • 4

      #3
      Problem solved.
      I have made a rem for all CLS command's
      Strange!!

      Comment

      Working...