Forum Discussion

mark_rowlands's avatar
4 years ago

I think we have a 260 chracter length restriction problem

 
We are polling a biztalk cluster and looking at the receive ports, all a sudden we got a "no data" from all of them, while i was looking at this , I did a test poll and was slightly surprised by the response. Despite this clearly being an error, it exits with "0" success, which is not so helpful. 

collecting-papp08-biz.xxxxxxxxxx.intra-MON_xxxxxxxxxx_Biztalk_SendPorts-RB.RIP.AndraBolag.Orchestrations.Departments_1.0.0.0_RB.RIP.AndraBolag.Orchestrations.Departments.HandleDepartmentsAB_SndRcv_HRPlus_GetDepartment_Port_e6dd5c64fddc35ff.stdout.ps1

RB.RIP.AndraBolag.Orchestrations.Departments_1.0.0.0_RB.RIP.AndraBolag.Orchestrations.Departments.HandleDepartmentsAB_SndRcv_HRPlus_GetDepartment_Port_e6dd5c64fddc35ff

errOutput 	

& : The term 'C:\Program Files (x86)\LogicMonitor\Agent\tmp\datacollecting-papp07-biz.xxxxxxxxx.intra-MON_xxxxxxxxxx_B
iztalk_SendPorts-RB.RIP.AndraBolag.Orchestrations.Departments_1.0.0.0_RB.RIP.AndraBolag.Orchestrations.Departments.Hand
leDepartmentsAB_SndRcv_HRPlus_GetDepartment_Port_e6dd5c64fddc35ff.stdout.ps1' is not recognized as the name of a cmdlet
, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that th
e path is correct and try again.
At line:1 char:3
+ & "C:\Program Files (x86)\LogicMonitor\Agent\tmp\datacollecting-papp0 ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (C:\Program File...35ff.stdout.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
 

After a bit of fiddling about , I discovered that this was because the drive + name + extension +  nul  has a length greater than 260 characters. This is not currently permissible ( Microsoft are working on it )   The orchestration receive ports names are automatically generated so we cannot do much about those, Any workarounds?  Should I create a case with LM?

  • I would say open a ticket/chat with support and report it. What DataSource is that?

  • Monitor Biztalk SendPorts and alert in case status is Stopped or Unenlisted   , a powershell script.

  • Hmm, I can't find that DataSource in LM or in the community exchange. Was that something you custom wrote or got from another website?

    Based on the file name I'm guessing perhaps the ##wildvalue## or ##wildalias## the DataSource creates is too long, you may be able to modify the Auto Discover script to shorten it by only outputting the important part or even just capping the length to 200 or something like that. Might need to modify the main script also to account for that.

  • yes, it is a custom job that we wrote, LM support also suggested we try and truncate the names in some way.

  • Anonymous's avatar
    Anonymous

    Yes, i'd consider making shorter names/descriptions. But also remember, you can set some of those details as properties and even auto group instances based on a property value.

    Pick one thing that is sufficient to uniquely identify the instance and use that as the wild value. Set the wildalias to something easily displayable in the UI and in alert notifications. Set longer text in the description. 

    So, you might do the following:

    $drive##$name##$extension##customjob.nul=$nul

  • ok, what i did, it seems to work and it may or may not help someone else.  I have no idea if it is right or wrong, I am still not convinced this script / alarm point is implemented in the smartest or most efficient way, but I am very new to LogicMonitor and it needs to work today ?  ( and yes, I will be getting me some proper LM training!)

    The general process is this, a ps script runs on the Biztalkhost and generates a list of sendports. :-

    Then we have an embedded PS active discovery script which looks like this   ( the commented out sections I will come too later! )

    $hostname = "##system.sysname##.##system.domain##"
    $csvFilePath = "\\192.168.123.195\BizTalk_Monitoring$\" + $hostname + "_sendPorts.csv"
    #$regex= "RB\.RIP\.|Orchestrations\.|_e6dd5c64fddc35ff|_\d\.\d\.\d\.\d"
    
    # Get BizTalk Send Port Information
    
    if(Test-Path -Path $csvFilePath){
        $sendPorts = Import-Csv -Path $csvFilePath
    }
    
    foreach ($sendport in $sendPorts){
       $name  = $sendport.Name
    #   $alias = $sendport.Name
    #if (($sendport.Name.length) -gt 130 ) {
    #    $alias = $sendport.Name -replace $regex
    #}
    write-host "$name##$name" 
    #write-host "$name##$alias"
    #write-host "$alias##$name"
    }

     

    this produces a nice long list of datapoints in LM ( fig1.png)

    Then we run a collector script :-

    $hostname = "##system.sysname##.##system.domain##"
    $fileDateLimit = (get-date).addMinutes(-15)
    
    $csvFilePath = "\\192.168.123.195\BizTalk_Monitoring$\" + $hostname + "_sendPorts.csv"
    if(Test-Path -Path $csvFilePath){
        $fileDate = (get-item -Path $csvFilePath).lastwritetime
        [ARRAY]$sendPorts = Import-Csv -Path $csvFilePath
    
        if ($fileDate -gt $fileDateLimit){
            foreach ($sendPort in $sendPorts){
                #$Location = $recLocs | where-object {$_.Name -eq "##WILDVALUE##"}
                $status = $sendPort.Status
                $name = $sendPort.Name
                $stopped = $false
                
                # Check if manually stopped =  No alert
                if ($name -like "_STOP*"){
                    $stopped = $true
                    write-host $name".Status=2"
                }
                
                if (($status -eq 2 -or $status -eq 1) -and -not $stopped){
                    write-host $name".Status=1"
                }
                elseif (($status -ne 2 -or $status -ne 1) -and -not $stopped) {
                    write-host $name".Status=0"
                }
            }
        }
        elseif ($fileDate -lt $fileDateLimit){
            write-host $name".Status=100"
        }
    }

     

    and if we have a nice long name... the script fails.

    So I slapped in a little regex to remove some duplicate data in the names :-

    $regex= "RB\.RIP\.|Orchestrations\.|_e6dd5c64fddc35ff|_\d\.\d\.\d\.\d"

    foreach ($sendport in $sendPorts){
      $name  = $sendport.Name
      $alias = $sendport.Name
    if (($sendport.Name.length) -gt 130 ) {
        $alias = $sendport.Name -replace $regex
    }
    #write-host "$name##$name"

    #This seems to be the incantation that works.

    write-host "$name##$alias"

    }

    So I am guessing it is that second parameter "$alias" that provides the name of the script that LM runs in the collector phase. 

    Thanks to everyone for pointers and tips. most helpful.

  • Anonymous's avatar
    Anonymous

    I'd focus on whether or not you need all that in the wildvalue/wildalias to uniquely identify the instance. Wildvalue/wildalias should only contain the minimum necessary to uniquely identify the instance. If you just want that information visible, consider moving it to the description of the instance instead (or instance level properties).