4 Replies Latest reply on Jun 14, 2019 2:58 PM by Brendan Murray

    Is there a way to monitor number of sessions/connections coming in to a DB from an application ?

    Kaushik KM

      Hi All,


      we sometimes get more than 500 connections from an application to a server where there is INFORMIX database is running.

      we need an alert when the connections go higher than 520.


      we have patrol agent running on the DB server(HP UX OS). no DB KM. just OS monitoring.

      Thanks in advance.

      Kaushik KM

        • 1. Re: Is there a way to monitor number of sessions/connections coming in to a DB from an application ?
          Bhuvaneswaran Ekanathan

          Kaushik KM


          If you can get number of DB connections by executing OS command line, you can use PATROL for Scripting KM,


          System requirements - Documentation for BMC PATROL for Scripting 2.0 - BMC Documentation


          If DB logs are configurable to record exceptions for number of connections, you can use LOG Monitoring & generate event based on match strings,


          Home - Documentation for BMC PATROL for Log Management 2.7 - BMC Documentation




          • 2. Re: Is there a way to monitor number of sessions/connections coming in to a DB from an application ?
            Brendan Murray

            Hi Kaushik,


            There is (almost) always a way.


            It looks like Informix provides a SQL query that will return the number of concurrent connections to the database. I am not sure that the query described in the article I link to is precisely the correct one, but if it isn't, I would think there must be a query that will work. You may need to ask your DBAs.


            Assuming that Informix provides a command line SQL client from which you can issue the query, you can use either Sentry Monitoring Studio or PATROL for Scripting to run the query and capture the current number of database connections as a PATROL parameter. From there, it's just  a matter of setting a threshold for your 520 connection limit.





            1 of 1 people found this helpful
            • 3. Re: Is there a way to monitor number of sessions/connections coming in to a DB from an application ?
              Kaushik KM

              Hi Brendan Murray Bhuvaneswaran Ekanathan,
              Thank you for the ideas. currently not looking forward to install sentry/Patrol for scripting KM for this.


              DBA team can run a query and redirect their total connections to a log file. so i would prefer LOG KM which is already present in the agent now.

              my question:


              the string would look something like below at the end of the file:


              283 active, 2176 total, 313 maximum concurrent



              how to i monitor or alert when the number just before "active" goes above 520 ?do you think we can write a regex and match any number greater than 520 ? let me test and update.


              Thanks in advance,

              Kaushik KM

              • 4. Re: Is there a way to monitor number of sessions/connections coming in to a DB from an application ?
                Brendan Murray

                Hi Kaushik,


                A regex should not be necessary for the numeric comparison. It might be necessary for the search criterion. The Log KM has built-in functionality for performing numeric comparisons. I have not used this feature myself, so be warned that everything I say below is based purely on my reading of the documentation. The documentation provides an example using messages about print queue length.


                First, you would specify a text log search that matches the string containing the database connections information. If your log file contains only these entries, that should be pretty easy.


                Then you would fill out the Number search portion of the text search configuration. The screen shot below is from TrueSight Operations Management. If you are using a PATROL Console, the form will look different, but the same fields should be there.


                Log KM Numeric Comparison.png


                The Number Search allows you to test whether a number extracted from a log message falls within a numeric range. In your case, the range is between 520 and infinity, so we only need to specify the start of the range, i.e. 520.


                The Operator will be < , i.e. less than. That's because the comparison is done this way:


                First Number Operator Extracted Number


                i.e. Is 520 less than the number extracted from the log message? It's a backwards way of saying "is the number in the log message greater than 520?"


                You can leave the Second number blank because you don't care about the upper value of the range. The upper value is infinity. The second Operator will (I assume) be ignored if the Second number is blank.


                The Begin Token and End Tokens indicate which components of the log message should be evaluated. They also define a range. A "token" in this context is any string of characters separated by "white space". You can think of a token as being the same as a "word" (as opposed to a character). So, in your example:


                283 active, 2176 total, 313 maximum concurrent


                your message has 7 tokens, or words. (I am not sure how the commas are handled, so my count may not be exactly correct.) Luckily, the token you want is the first one. So your Begin Token is 1, meaning you want to extract the first word of the line and perform your numeric comparison on it. As long as the first word contains a decimal (Base 10) number, the numeric comparison will be performed.


                Your End Token will also be 1 because the format of your log messages is fixed. The active connections number is always the first "word" in the message. If your messages were variable, as in the print queue example in the documentation, you could specify an End Token of 4, for example, and each of the first four words in the message would be evaluated to see if it contains a number. Only the first number found is used in the numeric comparison. The documentation explains this in more detail.


                If you try this, please update this post with your results. That way your experience will benefit everyone on Communities.







                2 of 2 people found this helpful