locked
Setting SCOM alert on a Folder RRS feed

  • Question

  • Team,

    Is it possible to setup a SCOM alert on a particular folder. For Example I have a Folder "C:\Test" and when the files number in Temp folder increased/queued up to 5 or more then 5, it should sent a SCOM alert.

    I am not a SCOM Administrator or expert but needs to do this.

    Thanks in Advance


    Regards Rishi Aggarwal

    • Moved by Garth JonesMVP Friday, June 12, 2020 5:28 PM Not a CM12 Question
    Friday, June 12, 2020 3:12 PM

All replies

  • Hi,

    You can use the File System management pack for this, it has a monitor called "File Count Availability", it will monitor the number of files in a folder.

    You can change the threshold to what you want by creating overrides:

    Best regards,
    Leon


    Blog: https://thesystemcenterblog.com LinkedIn:


    • Edited by Leon Laude Friday, June 12, 2020 8:10 PM
    Friday, June 12, 2020 8:09 PM
  • Hi,

    As an alternative, we can create a monitor based on PS script, which can be tuned based on our requirements.



    create a monitor, name it and save it in an unsealed management pack.



    The script can be like this:

    'get file count
    $api = New-Object -comObject "MOM.ScriptAPI" 
    $PropertyBag = $api.CreatePropertyBag()
    $fc = (Get-ChildItem -path c:\temp -file | Measure-Object).Count
    $PropertyBag.AddValue("FileCount",$fc)
    $PropertyBag




    And the criteria should be like this:
    Property[@Name="FileCount"] is greater than or equal to xxx 



    For the step-by-step guide, we may refer to:
    Example of setting up a custom monitor in SCOM with a Powershell Script
    https://blog.ctglobalservices.com/powershell/clm/example-of-setting-up-a-custom-monitor-in-scom-with-a-powershell-script-monitor-nic-teams-in-scom/
    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.
    Monday, June 15, 2020 1:46 AM
  • Leon Laude and Alex Zhu separate provide two approach for achieve your objective. Besides, I will provdies another method, using basic script monitor with vbscript. The detail as

    SCript:

    *****************************************************************
    Dim oAPI, oBag
    Dim fs, f, s,folderspec

    set oAPI=CreateObject("MOM.ScriptAPI")
    set oBag=oAPI.CreatePropertyBag()

    folderspec="d:\temp"
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFolder(folderspec)

    s = f.files.count

    Call oBag.AddValue("FileCount","s")
    Call oAPI.Return(OBag)
    *******************************************************************

    Unhealthy expression:
    Property[@Name="FileCount"]     Greater than or equal to      5



    Roger
    Monday, June 15, 2020 5:13 AM
  • Hi,

    It seems there is no update for a couple of days. May we know the current status of the problem? Is there any other assistance we can provide?

    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, June 19, 2020 5:32 AM
  • Hi,

    Is there any updates for this problem? Here's a short summary of the thread status up to now. If you have time, we're glad to continue the trouble-shooting process. Thank you for your attention.

    Problem/Symptom:
    ===================
    Platform: System Center Operations Manager
    Problem details:
    Is it possible to setup a SCOM alert on a particular folder. For Example I have a Folder "C:\Test" and when the files number in Temp folder increased/queued up to 5 or more then 5, it should sent a SCOM alert.

    Analysis/Possible Cause:
    ===================
    N/A

    Solution/Workarounds:
    ===================
    Either of the following methods will do.
    1, use file system management pack and there is a built-in monitor we can configure.
       https://systemcenter.wiki/?GetCategory=File+System+Management+Pack
    2, create a monitor based on Powershell script
    3, create a monitor based on VB script

    Reference:
    ===================
    N/A

    If you have any questions in future, we warmly welcome you to post in this forum again.

    Have a nice day!

    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, July 17, 2020 5:49 AM