locked
Monitoring Linux - Look for files RRS feed

  • Question

  • Hello!

    I have a ManagementPack for a Linux-Application where I have to discover the "Node-Name" of a running Application

    The command is.

    sh -c "find /app/instance/ -type f -name 'test-*.service' | sed -e 's#\(\/app\/instance\/\)\(.*\)\(\/test-.*\/.*\.service\)#\2#' | sort | uniq"

    Result:

    test-node-1


    But if SCOM is running the discovery, the command after first "|" is cutting. So I would get for result:

    /app/instance/test-node-1/test-.../bin/test-....service
    /app/instance/test-node-1/test-.../bin/test-....service
    /app/instance/test-node-1/test-.../bin/test-....service
    /app/instance/test-node-1/test-.../bin/test-....service
    /app/instance/test-node-1/test-.../bin/test-....service
    /app/instance/test-node-1/test-.../bin/test-....service

    I want to discover the Nodename in "test-node-1". Is their a problem with pipe in SCOM? Another discovery with a pipe I don't have any problems.

    rg

    hansi


    • Edited by very_best Wednesday, May 13, 2020 12:32 PM
    Wednesday, May 13, 2020 12:30 PM

All replies

  • Hi,

    If the command contains multiple lines or special character, we may consider saving it in a .sh file and invoke it. For the similar scenario, we may refer to:

    SCOM 2012 - Linux Two-State Monitor With "Script In Script"
    https://www.stefanroth.net/2012/10/21/scom-2012-linux-two-state-monitor-with-script-in-script/
    Note: this is not from MS, just for your reference.

    Hope the above information helps.

    Regards,

    Alex Zhu
    -----------------------------------------------
    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.
    Friday, May 15, 2020 12:13 AM
  • Hi Hansi,

    was Alex able to answer your question? We would really appreciate a short feedback! 

    Thanks in advance for that!

    Regards,


    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer" where applicable. This helps the community, keeps the forums tidy, and recognizes useful contributions. Thanks!) Blog: https://blog.pohn.ch/ Twitter: @StoyanChalakov

    Monday, June 22, 2020 12:18 PM