Activation of generated Linux Script Monitors

Uwe Aul 1 Reputation point
2020-08-31T09:28:45.683+00:00

Hi,

I created a UNIX/Linux Script Two State Monitor via Powershell Script. The monitor is disabled and shown in the SCOM GUI. After adding an override to enable the monitor for a specific server, the monitor gets initialised in the health explorer of that server:

21500-image.png

So far, so good. But the monitor script seems to be never executed, since the status should change to critical imediately.
If I open the monitor in the GUI and do a small change so that the monitor is saved, so script is executed and the monitor is working as expected.
Are there some extra tasks executed in the background, when I save a linux monitor in the GUI? Can I initiate those tasks via powershell?
If needed, I can provide the script I use.

Thank you very much in advance.

Operations Manager
Operations Manager
A family of System Center products that provide infrastructure monitoring, help ensure the predictable performance and availability of vital applications, and offer comprehensive monitoring for datacenters and cloud, both private and public.
1,441 questions
0 comments No comments
{count} votes

12 answers

Sort by: Most helpful
  1. CyrAz 5,181 Reputation points
    2020-08-31T12:34:18.6+00:00

    That's an interesting way of creating monitors, not very common but should work nonetheless.

    I just had a quick look and I saw at least the following issue : if I understand the monitor correctly, you are trying to measure the number of instances of a process and alert if it's not between a min and max value.

    However in the Expression, you use Type="String" : that can't work for a numeric comparision, you need to use Integer instead.

    Edit : could you post the actual resulting .xml code of the management pack ?

    1 person found this answer helpful.
    0 comments No comments

  2. SChalakov 10,371 Reputation points MVP
    2020-08-31T11:22:25.437+00:00

    Hi @Uwe Aul ,

    there is a chance that your script isn't returning the data in the right form so the data isn't handled properly. Can you post more details about the script and how exactly the monitor has been configured? Are you using the SquaredUP PowerShell MP for that? If not I would recommend you switching to this MP and configuring your monitor, based on the MP template:

    The PowerShell Monitoring Management Pack

    Hope I was able to help!

    ----------

    (If the reply was helpful please don't forget to upvote or accept as answer, thank you)
    Regards,
    Stoyan

    0 comments No comments

  3. Uwe Aul 1 Reputation point
    2020-08-31T12:08:03.72+00:00

    Hi @SChalakov

    please see my script attached.

    21586-script.txt

    The shell script is base-64 encoded.
    Cleartext: pgrep -fl ProcName | wc -l

    I used shell script monitor for that, because our linux servers don't have powershell installed.

    Thank you!!

    0 comments No comments

  4. SChalakov 10,371 Reputation points MVP
    2020-08-31T12:50:26.667+00:00

    Hi @Uwe Aul ,

    @CyrilAzoulay has a point here. This is pretty strange:

    <Value Type="String">$MinNum</Value>  
    

    and

    <Value Type="String">$MaxNum</Value>  
    

    Regards,
    Stoyan

    0 comments No comments

  5. Uwe Aul 1 Reputation point
    2020-09-01T07:01:54.69+00:00

    Hi,

    I created a monitor with Type="Integer" (look for UnitMonitor ID="ATS.Linux.Process.ProcUwe39.5" in the XML file), but the error is the same.

    Here is the resulting xml-file:
    21884-atstestuwe.xml

    I think the string comparison I used before is not a problem, because SCOM generates exactly the same XML comparison if I create the monitor using the GUI (see UnitMonitor ID="UIGeneratedMonitor337d843a91794a4c8a0deb101e8dd5fb" in my XML file). Seems that SCOM expects STDOUT to be a string per default and therefore compares with a string.

    0 comments No comments