i found a problem

Script is not working only in test mode "check_mk_agent test"

cmk-pusher run check_mk_agent with test mode:
command = ConfigSectionMap("check_mk")['path']+" test"

With  debug, adhoc, file  options it's running just fine.

Is in test mode , agent  has to run as in normal mode and only write to
stdout?








On Mon, Oct 17, 2016 at 10:21 AM, Pavel Vaysman <goa...@gmail.com> wrote:

> Hi,
> I added this line to to the script. it's create "log file" without problem.
> this is check_mk.ini file configuration:
>
> # Example configuration for Windows agent
> [global]
>     # Restrict access to certain IP addresses
>     # If ipv6 is enabled, all listed ipv4 adresses are also accepted as
>     # source adresses in their ipv6-mapped form. I.e. if
>     # 192.168.56.0/24 is listed, connections from
> 0:0:0:0:0:ffff:c0a8:3800/120
>     # are also possible
>     # only_from = 127.0.0.1 192.168.56.0/24 ::1
>
>     # Change port where the agent is listening ( default 6556 )
>     # port = 6556
>
>     # Disable ipv6 support. By default, ipv4 is always supported
>     # and ipv6 is enabled additionally if supported by the system.
>     # ipv6 = no
>
>     # Do only execute programs and scripts with
>     # the following suffixes (in local and plugins).
>     # Per default all extensions except txt and dir
>     # are being executed.
>     # execute = exe bat vbs
>
>     # Restrict the following configuration variables
>     # in [global] to the following hosts
>     # host = winsrv* zab???ad
>
>     # Just output certain sections (e.g. for upper hosts)
>     # sections = check_mk winperf
>
>     # output sections in realtime updates. Please note that not all
>     # sections can be used in realtime updates, the following is the
>     # complete list
>     # realtime_sections = mem df winperf_processor
>
>     # specifies how long (in seconds) realtime updates are sent to
>     # the last monitoring system that requested an update.
>     # this should be longer than the request frequency (usually
>     # one minute).
>     # Please note that any new request cancels previous realtime
>     # update schedules, so no more than one update is sent per second,
>     # no matter if this timeout is "too high" or how many monitoring
>     # systems are querying the agent.
>     # realtime_timeout = 90
>
>     # passphrase for encrypted communication. Currently this is only
>     # used in realtime updates
>     # passphrase = secret
>
>     # Write a logfile for tackling down crashes of the agent
>     # crash_debug = yes
>
>     # by default the agent flushes the socket for each agent section.
>     # this is mostly for debugging purposes in case the agent is slow
>     # to respond.
>     # Disabling this may (very) slightly reduce network traffic.
>     # section_flush = no
>
> [winperf]
>     # Select counters to extract. The following counters
>     # are needed by checks shipped with check_mk.
>     # counters = 10332:msx_queues
>     # counters = 638:tcp_conn
>
>
> [logfiles]
>     # # Define textfiles to be monitored, separated by |
>     # textfile = C:\tmp logfiles\message_*.log|D:\log\sample.txt
>     # # Set patterns for defined textfiles
>     # ok = Successfully logged in*
>     # crit = Error in*
>     # warn = Unable to contact*
>     # ignore = Backup * saved
>
>     # # Define additional textfiles with different patterns
>     # textfile = C:\tmp\memo.udf
>     # # Set patterns for defined textfile
>     # warn = *overdue*
>     # ok = *mail sent*
>
> [logwatch]
>     # Testing: output *all* messages from the eventlogs
>     # sendall = yes
>
>     # From application log send only critical messages
>     # logfile application = crit
>
>     # From system log send only warning/critical messages,
>     # but suppress any context messages
>     # logfile system = nocontext warn
>
>     # Switch all other logfiles off. Default is warn:
>     # send messages of type warn or crit
>     logfile * = off
>
> [mrpe]
>     # Run classical monitoring plugins. The word before the command
>     # line is the service description for the monitoring. Use backslashes
>     # in Windows-paths.
>     # check = IP_Configuration mrpe\check_ipconfig 1.2.3.4
>     # check = Whatever c:\myplugins\check_whatever -w 10 -c 20
>  check = HP_Smart_Array 
> c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
> -command ".'c:\medasys-monitor\mrpe\hp-raid.ps1'; exit($lastexitcode)"
> [fileinfo]
>     # path = C:\Programs\Foo\*.log
>     # path = M:\Bar Test\*.*
>
> [local]
>     # define timeouts for local scripts matching
>     # specific patterns - first match wins
>     # timeout *.vbs = 20
>     # timeout *.bat = 10
>     # timeout * = 30
>
> [plugins]
>     # example: the windows_updates.vbs
>     # plugin is executed asynchronous
>     # and is only updated every 3600 seconds
>     # it may fail (timeout / error) up to 3 times before the last known
> data is discarded
>     # execution windows_updates.vbs = async
>     # timeout windows_updates.vbs = 120
>     # cache_age windows_updates.vbs = 3600
>     # retry_count windows_udpates.vbs = 3
>
>     # define timeouts for plugin scripts matching
>     # specific patterns - first match wins
>     # timeout ps_perf.ps1 = 20
>     # timeout *.ps1 = 10
>     # timeout * = 30
>
>     # When using the Check_MK Inventory plugin, it is a good idea to make
> the
>     # plugin being executed asynchronous to prevent it from hooking up the
>     # whole agent processing. Additionally it should have a execution
> timeout.
>     # execution mk_inventory.ps1 = async
>     # timeout mk_inventory.ps1 = 240
>
> [ps]
>     # Experimental: Set to yes to use wmi for retrieving process
> information.
>     # This is required for the additional ps feature below.
>     # use_wmi = no
>     # Include the whole path of a process and its arguments in the process
> list.
>     # full_path = no
>
>
> On Mon, Oct 17, 2016 at 7:12 AM, Wouter <wblee...@gmail.com> wrote:
>
>> It is not related to your cmk-pusher script.
>>
>> Can you share the config of check_mk? The regular ini file in which you
>> added the mrpe command?
>> Also: can you follow up on my question to add the log write action as the
>> first line in your powershell script? It will (probably) show that the
>> powershell script cannot be executed at all. So in that case it is not
>> related to the commands in your scripts.
>>
>> Verstuurd vanaf mijn iPhone
>>
>> Op 16 okt. 2016 om 23:21 heeft Pavel Vaysman <goa...@gmail.com> het
>> volgende geschreven:
>>
>> i push result  with external python program.
>>
>> https://github.com/qmexnetworks/cmk-pusher-agent
>>
>> but it's not powershell problem...
>>
>> when i run this script manually from powershell it's working, from debug
>> mode in cmd "check_mk_agent debug" its working , but  "check_mk_agent test"
>>  - it failed with error..
>>
>> this  mrpe check is working with agent 1.2.6p12...
>>
>> On Oct 16, 2016 15:06, "Wouter" <wblee...@gmail.com> wrote:
>>
>>> So how is your agent started in your situation? You push the results, so
>>> it doesn't run as a service?
>>> Can you get a regular powershell script to write-out any output? When
>>> you add something like "add-content full-path-to-logfile.log test_txt" in
>>> the first line, is your script running at all?
>>>
>>> Verstuurd vanaf mijn iPhone
>>>
>>> Op 15 okt. 2016 om 09:05 heeft Pavel Vaysman <goa...@gmail.com> het
>>> volgende geschreven:
>>>
>>> I have about 300 server behind firewalls and nat and it's impossible to
>>> query check_mk agent and snmp from central check_mk server.
>>>
>>> So i run check_mk agent locally on server and push it's output to
>>> check_mk server.
>>>
>>> On Sat, Oct 15, 2016 at 12:05 AM, ml...@libero.it <ml...@libero.it>
>>> wrote:
>>>
>>>> Pavel,
>>>>
>>>> why are you using a powershell script? in my test environment I added
>>>> some proliant dl servers running linux + hp agents and it worked out of the
>>>> box. I did not try windows servers but it should be the same; I just
>>>> selected agent+snmp
>>>>
>>>>
>>>> ----Messaggio originale----
>>>> Da: "Pavel Vaysman" <goa...@gmail.com>
>>>> Data: 14/10/2016 17.27
>>>> A: <checkmk-en@lists.mathias-kettner.de>
>>>> Ogg: [Check_mk (english)] windows check_mk_agent 1.2.8p12 with
>>>> hpacucli.exe
>>>>
>>>>
>>>> Hi guys,
>>>>
>>>> i try to monitor hp raid with mrpe via check_mk_agent 1.2.8p12 with
>>>> hpacucli.exe.
>>>> I have powershell script that run hpacucli.exe and parsing it's output.
>>>> With check_mk_agent 1.2.6p16 it's working perfect.
>>>> With new check_mk agent 1.2.8pX it's return "ERROR: Cannot open console"
>>>> When i'm run check_mk agent 1.2.8pX with debug argument - it's working.
>>>> Right now , workaround - write hpacucli.exe output to file via windows
>>>> task scheduler and parse this txt file.
>>>>
>>>> Is it bug or may be i did mistake somewhere?
>>>>
>>>> Source Code
>>>>
>>>>    1.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_1_78d8c5>$array_config_util
>>>>    = "c:\hp\Bin\hpacucli.exe"
>>>>    2.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_2_78d8c5>try
>>>>    {
>>>>    3.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_3_78d8c5>
>>>>    $exec = & $array_config_util 'ctrl all show config'
>>>>    4.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_4_78d8c5>#write-host
>>>>    !!!!!!!!!!!!!!!!!!!!!
>>>>    5.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_5_78d8c5>#Write-Output
>>>>    $exec
>>>>    6.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_6_78d8c5>
>>>>    }
>>>>    7.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_7_78d8c5>catch
>>>>    {
>>>>    8.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_8_78d8c5>Write-Host
>>>>    "Problem checking array status)"
>>>>    9.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_9_78d8c5>exit
>>>>    3
>>>>    10.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_10_78d8c5>
>>>>    }
>>>>    11.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_11_78d8c5>#
>>>>    filter results for lines that talk about drives (physicaldrive,
>>>>    logicaldrive)
>>>>    12.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_12_78d8c5>#
>>>>    and do not end with "OK":
>>>>    13.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_13_78d8c5>$not_OK
>>>>    = $exec | Where-Object { $_ -like "*drive*" } | Where-Object { $_ 
>>>> -notlike
>>>>    "*OK*)" }
>>>>    14.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_14_78d8c5>#write-output
>>>>    "<<<>>>"
>>>>    15.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_15_78d8c5>#write-output
>>>>    $not_OK
>>>>    16.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_16_78d8c5>if
>>>>    ($not_OK.length -lt 1) {
>>>>    17.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_17_78d8c5>Write-Host
>>>>    "Array status appears OK"
>>>>    18.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_18_78d8c5>exit
>>>>    0
>>>>    19.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_19_78d8c5>
>>>>    }
>>>>    20.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_20_78d8c5>Write-Host
>>>>    "Array status not OK; please check RAID software"
>>>>    21.
>>>>    
>>>> <https://monitoring-portal.org/index.php?thread/38275-windows-check-mk-agent-1-2-8p12-with-hpacucli-exe/#codeLine_21_78d8c5>exit
>>>>    2
>>>>
>>>>
>>>>
>>>>
>>>
>
_______________________________________________
checkmk-en mailing list
checkmk-en@lists.mathias-kettner.de
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

Reply via email to