Check jboss own plugin crashed with message Exception: IndexError (list index out of range)

I upgraded check_mk from 1.6.p24 to 2.0.0p6. One of our own plugins check_jboss6 crash with message: Exception: IndexError (list index out of range)
Crash-ID: ae16745a-ed14-11eb-8fcb-0050569f9548
The same plugin is working fine with 1.6.p24 version. Please assist. Please find below the check plugin and the agent output:
#------------------------------------------------------------------------------

THIS MODULE IS MAINTAINED BY PUPPET !!

#------------------------------------------------------------------------------

factory_settings[“check_jboss6_default_levels”] = {
“availconn”: (80.0, 95.0), # percentage connections in use
}

#------------------------------------------------------------------------------

Inventory function

#------------------------------------------------------------------------------

def inventory_jboss6 (info):
inventory = []
for line in info:
instance = line[0]
port = line[1]
app = line[2]
ds = line[2]
stat = line[2]
metric = line[3]
queue = line[3]
if ‘serverState’ in stat:
my_inventory = instance + ’ serverState’
inventory.append( (my_inventory, None) )
if ‘httpConnectorStat’ in stat:
my_inventory = instance + ’ httpConnector’
inventory.append( (my_inventory, None) )
if ‘ajpConnectorStat’ in stat:
my_inventory = instance + ’ ajpConnector’
inventory.append( (my_inventory, None) )
if ‘activeSessions’ in metric:
my_inventory = instance + ’ Sessions ’ + app
inventory.append( (my_inventory, None) )
if ‘eJB’ in metric:
my_inventory = instance + ’ EnterpriseJavaBean ’ + app
inventory.append( (my_inventory, None) )
if ‘DataSource’ in metric:
my_inventory = instance + ’ DataSource ’ + ds
inventory.append( (my_inventory, None) )
if ‘JMS’ in stat:
my_inventory = instance + ’ JMS ’ + queue
inventory.append( (my_inventory, None) )
return inventory

#------------------------------------------------------------------------------

Check function

#------------------------------------------------------------------------------

def check_jboss6 (item, params, info):

for line in info:
instance = line[0]
port = line[1]
app = line[2]
ds = line[2]
stat = line[2]
metric = line[3]
queue = line[3]

  rc = 0
  if 'serverState' in item and instance in item:
     if not 'running' in metric:
        return (1, metric)
     else:
        return (0, metric)


  if 'EnterpriseJavaBean' in item and  metric == 'eJB' and instance in item:
     rc = 0
     peakConcurrentInvocations = int(line[4])
     waitTimewaitTime          = int(line[5])
     executionTime             = int(line[6])
     invocations               = int(line[7])
     message = str(peakConcurrentInvocations) + " peakConcurrentInvocations, " + \
            str(waitTimewaitTime)             + " waitTimewaitTime, " + \
            str(executionTime)                + " executionTime, " + \
            str(invocations)                  + " invocations"
     return (rc, message, [
        ( "peakConcurrentInvocations", peakConcurrentInvocations ),
        ( "waitTimewaitTime",          waitTimewaitTime ),
        ( "executionTime",             executionTime ),
        ( "invocations",               invocations ),
     ])

  elif 'Sessions' in item and metric == 'activeSessions' and app in item and instance in item:
     activeSessions    = int(line[4])
     maxActiveSessions = int(line[5])
     expiredSessions   = int(line[6])
     rejectedSessions  = int(line[7])

     message = str(activeSessions) + " activeSessions, " + \
            str(maxActiveSessions) + " maxActiveSessions, " + \
            str(expiredSessions)   + " expiredSessions, " + \
            str(rejectedSessions)  + " rejectedSessions"
     return (rc, message, [
        ( "activeSessions",    activeSessions ),
        ( "maxActiveSessions", maxActiveSessions ),
        ( "expiredSessions",   expiredSessions ),
        ( "rejectedSessions",  rejectedSessions ),
     ])

  elif 'DataSource' in item and metric == 'DataSourceStats' and ds in item and instance in item:
     ActiveCount          = int(line[4])
     AvailableCount       = int(line[5])
     AverageBlockingTime  = int(line[6])
     AverageCreationTime  = int(line[7])
     CreatedCount         = int(line[8])
     DestroyedCount       = int(line[9])
     InUseCount           = int(line[10])
     MaxCreationTime      = int(line[11])
     MaxUsedCount         = int(line[12])
     MaxWaitCount         = int(line[13])
     MaxWaitTime          = int(line[14])
     TimedOut             = int(line[15])
     TotalBlockingTime    = int(line[16])
     TotalCreationTime    = int(line[17])

     ds_thresh = params.get("availconn")

     if ds_thresh == None: # no levels
         warn, crit = 80.0, 95.0
     else:
         warn, crit = ds_thresh

     inUsePercent = 1;
     alertMessage =  ''
     if AvailableCount == 0 and InUseCount == 0:
        rc = 0
     elif AvailableCount == 0 and InUseCount > 0:
        rc = 2
        alertMessage = ' (Alert for no available datasource connections)'
     else:
        rc = 0

     if TimedOut == 999:
        rc = 2
        lertMessage = ' (Alert for unavailable datasource)'

     message = "ActiveCount: " + str(ActiveCount) + \
               " AvailableCount: " + str(AvailableCount) + \
               " AverageBlockingTime: " + str(AverageBlockingTime) + \
               " AverageCreationTime: " + str(AverageCreationTime) + \
               " CreatedCount: " + str(CreatedCount) + \
               " DestroyedCount: " + str(DestroyedCount) + \
               " InUseCount: " + str(InUseCount) + \
               " MaxCreationTime: " + str(MaxCreationTime) + \
               " MaxUsedCount: " + str(MaxUsedCount) + \
               " TimedOut: " + str(TimedOut) + \
               " TotalBlockingTime: " + str(TotalBlockingTime) + \
               " TotalCreationTime: " + str(TotalCreationTime) + \
               " " + alertMessage
     return (rc, message, [
        ( "ActiveCount",          ActiveCount ),
        ( "AvailableCount",       AvailableCount ),
        ( "AverageBlockingTime",  AverageBlockingTime ),
        ( "AverageCreationTime",  AverageCreationTime ),
        ( "CreatedCount",         CreatedCount ),
        ( "DestroyedCount",       DestroyedCount ),
        ( "InUseCount",           InUseCount ),
        ( "MaxCreationTime",      MaxCreationTime ),
        ( "MaxUsedCount",         MaxUsedCount ),
        ( "TimedOut",             TimedOut ),
        ( "TotalBlockingTime",    TotalBlockingTime ),
        ( "TotalCreationTime",    TotalCreationTime ),
     ])

  elif 'httpConnector' in item and stat == 'httpConnectorStat' and instance in item:
     BytesReceived    = int(line[3])
     BytesSent        = int(line[4])
     message = str(BytesReceived) + " BytesReceived, " + \
         str(BytesSent) + " BytesSent"
     return (rc, message, [
        ( "BytesReceived", BytesReceived ),
        ( "BytesSent", BytesSent ),
     ])

  elif 'ajpConnector' in item and stat == 'ajpConnectorStat' and instance in item:
     BytesReceived    = int(line[3])
     BytesSent        = int(line[4])
     message = str(BytesReceived) + " BytesReceived, " + \
         str(BytesSent) + " BytesSent"
     return (rc, message, [
        ( "BytesReceived", BytesReceived ),
        ( "BytesSent", BytesSent ),
     ])

  elif 'JMS' in item and 'DLQ' in item:
     dlq_messageCount  = int(line[5])
     consumerCount     = int(line[6])
     messagesAdded     = int(line[7])
     scheduledCount    = int(line[8])
     message = str(dlq_messageCount) + " Messages in DLQ"
     if dlq_messageCount > 0:
        rc = 1
     else:
        rc = 0
     return (rc, message, [
           ( "DLQ Message Count", dlq_messageCount ),
           ( "Consumer Count", consumerCount ),
           ( "Messages Added", messagesAdded ),
           ( "Scheduled Count", scheduledCount ),
     ])

  elif 'JMS' in item and 'ExpiryQueue' in item:
     ExpiryQueue_messageCount    = int(line[5])
     consumerCount               = int(line[6])
     messagesAdded               = int(line[7])
     scheduledCount              = int(line[8])
     message = str(ExpiryQueue_messageCount) + " Messages in Queue"
     if ExpiryQueue_messageCount > 0:
        rc = 1
     else:
        rc = 0
     return (rc, message, [
           ( "ExpiryQueue Message Count", ExpiryQueue_messageCount ),
           ( "Consumer Count", consumerCount ),
           ( "Messages Added", messagesAdded ),
           ( "Scheduled Count", scheduledCount ),
     ])

#------------------------------------------------------------------------------

Check parameters

#------------------------------------------------------------------------------

check_info[“check_jboss6”] = {
‘check_function’ : check_jboss6,
‘inventory_function’ : inventory_jboss6,
‘service_description’ : “JVM %s”,
‘has_perfdata’ : True,
‘group’ : ‘check_jboss6’,
‘default_levels_variable’ : 'check

############################################################################

<<<check_jboss6>>>
jboss 8080 serverState running
jboss 8080 JMS ExpiryQueue message-count 0 0 0 0
jboss 8080 JMS DLQ message-count 0 0 0 0
jboss 8080 is-bhrg-v2-ear.ear/wus/isbhrg-v2.0 activeSessions -1 0 0 0
jboss 8080 is-bhrg-v2-ear.ear/BhrgLogicBean eJB 0 0 0 0
jboss 8080 is-gar-ear.ear/wus/isgar-v1.0 activeSessions -1 0 0 0
jboss 8080 is-gar-ear.ear/GarLogicBean eJB 0 0 0 0
jboss 8080 is-bhrg-v2-validation-ear.ear/validation/bhrg-v2.0 activeSessions -1 0 0 0
jboss 8080 is-bhrg-v2-validation-ear.ear/BhrgValidationBean eJB 0 0 0 0
jboss 8080 is-gar-validation-ear.ear/validation/gar activeSessions -1 0 0 0
jboss 8080 is-gar-validation-ear.ear/GarValidationBean eJB 0 0 0 0
jboss 8080 is-bhrgt-v1-ear.ear/wus/isbhrgt-v1.0 activeSessions -1 0 0 0
jboss 8080 is-bhrgt-v1-ear.ear/BhrGtLogicBean eJB 0 0 0 0
jboss 8080 is-gld-ear.ear/wus/isgld-v1.0 activeSessions -1 0 0 0
jboss 8080 is-gld-ear.ear/GldLogicBean eJB 0 0 0 0
jboss 8080 is-bhrgt-v1-validation-ear.ear/validation/bhrgt activeSessions -1 0 0 0
jboss 8080 is-bhrgt-v1-validation-ear.ear/BhrGtValidationBean eJB 0 0 0 0
jboss 8080 is-gld-validation-ear.ear/validation/gld activeSessions -1 0 0 0
jboss 8080 is-gld-validation-ear.ear/GldValidationBean eJB 0 0 0 0
jboss 8080 is-bhrgt-v2-1-ear.ear/wus/isbhrgt-v2.1 activeSessions -1 0 0 0
jboss 8080 is-bhrgt-v2-1-ear.ear/BhrGtLogicBean eJB 0 0 0 0
jboss 8080 is-gmn-ear.ear/wus/isgmn-v1.0 activeSessions -1 0 0 0
jboss 8080 is-gmn-ear.ear/GmnLogicBean eJB 0 0 0 0
jboss 8080 is-bhrgt-v2-1-validation-ear.ear/validation/bhrgt-v2.1 activeSessions -1 0 0 0
jboss 8080 is-bhrgt-v2-1-validation-ear.ear/BhrGtValidationBean eJB 0 0 0 0
jboss 8080 is-gmn-validation-ear.ear/validation/gmn activeSessions -1 0 0 0
jboss 8080 is-gmn-validation-ear.ear/GmnValidationBean eJB 0 0 0 0
jboss 8080 is-bhrp-v2-ear.ear/wus/isbhrp-v2.0 activeSessions -1 0 0 0
jboss 8080 is-bhrp-v2-ear.ear/BhrLogicBean eJB 0 0 0 0
jboss 8080 is-gmw-ear.ear/wus/isgmw-v1.1 activeSessions -1 0 0 0
jboss 8080 is-gmw-ear.ear/GmwLogicBean eJB 0 0 0 0
jboss 8080 is-bhrp-v2-validation-ear.ear/validation/bhrp-v2.0 activeSessions -1 0 0 0
jboss 8080 is-bhrp-v2-validation-ear.ear/BhrValidationBean eJB 0 0 0 0
jboss 8080 is-gmw-validation-ear.ear/validation/gmw activeSessions -1 0 0 0
jboss 8080 is-gmw-validation-ear.ear/GmwValidationBean eJB 0 0 0 0
jboss 8080 is-cpt-ear.ear/wus/iscpt-v1.1 activeSessions -1 0 0 0
jboss 8080 is-cpt-ear.ear/CptLogicBean eJB 0 0 0 0
jboss 8080 is-sfr-v2-ear.ear/wus/issfr-v2.0 activeSessions -1 0 0 0
jboss 8080 is-sfr-v2-ear.ear/SfrLogicBean eJB 0 0 0 0
jboss 8080 is-cpt-validation-ear.ear/validation/cpt activeSessions -1 0 0 0
jboss 8080 is-cpt-validation-ear.ear/CptValidationBean eJB 0 0 0 0
jboss 8080 is-sfr-v2-validation-ear.ear/validation/sfr-v2 activeSessions -1 0 0 0
jboss 8080 is-sfr-v2-validation-ear.ear/SfrValidationBean eJB 0 0 0 0
jboss 8080 BroRealmDS DataSourceStats 0 20 0 80 2 2 0 98 1 0 0 2 0 161
jboss 8080 ExampleDS DataSourceStats 0 0 0 0 0 0 0 0 0 0 0 0 0 0
jboss 8080 BroDS DataSourceStats 0 50 1 79 27 27 0 197 5 0 1 27 4 2134

Hi,
have you read this post?
https://blog.checkmk.com/migrating-check-plug-ins-to-checkmk-2.0

Karl

1 Like

Thanks Karl,
I migrated the plugins to the new style Writing your own check plug-ins
Kind regards,
Jamal

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.