Menu

PerfMon counter with colon in name returns -1

Help
Adrian C
2007-01-02
2013-04-25
  • Adrian C

    Adrian C - 2007-01-02

    I'm having a slight problem with trying to refer to a PerfMon counter with a colon in the name.

    From the command line,
      ./check_nt -H <host> -v COUNTER -l "\\SQLServer:General Statistics\\User Connections"
    returns
      \SQLServer:General Statistics\User Connections = 11.00

    Great - exactly what I want.

    From within Nagios, passing
      "\\SQLServer:General Statistics\\User Connections":200:250
    to the check command
      $USER1$/check_nt -H $HOSTADDRESS$ -v COUNTER -l $ARG1$ -w $ARG2$ -c $ARG3$
    returns
      \SQLServer -w General Statistics\User Connections = -1.00

    It appears to be interpreting the colon in the counter name as a delimiter between arguments, and splitting the counter name.

    Thoughts as to the best way to handle this?

     
    • tony

      tony - 2007-01-02

      I agree, from your explanation, since it works from the command line, it looks like Nagios is using the Colen as a delimiter.
      I believe this is documented, or something simmilar somewhere in the Nagios Manual, However, it is a big manual and sometimes difficult to find small things like this.

      Try the following tests and one should work.
      I currently do not have a running Nagios instance, so please post back here when you get it working.

      one thing to try is to escape the :  using \:
      a second thing I would recomend is moving the " to the check command.
      as thus
      From service configuration
      \\SQLServer:General Statistics\\User Connections:200:250
      to the check command
      $USER1$/check_nt -H $HOSTADDRESS$ -v COUNTER -l "$ARG1$" -w $ARG2$ -c $ARG3$

      Please let us know what works.

      TOny

       
    • Adrian C

      Adrian C - 2007-01-02

      TOny,

      I should have said in my original post that I'd tried \: which changes the return to
        \SQLServer\ -w General Statistics\User Connections = -1.00

      It's still taking the colon despite the standard escape backslash.

      If I move the quotes, still no banana. The return then becomes
        \SQLServer = -1.00

      You're not wrong about the Nagios documentation...

       
    • tony

      tony - 2007-01-02

      I looked up in the documentaion and in my past emails and I do not recall issues using the : in the past,
      here is the link to the nagios DOc on commands http://nagios.sourceforge.net/docs/2_0/xodtemplate.html#command

      I just reread your initial post using the following syntex:
      "\\SQLServer:General Statistics\\User Connections":200:250
      to the check command
      $USER1$/check_nt -H $HOSTADDRESS$ -v COUNTER -l $ARG1$ -w $ARG2$ -c $ARG3$

      Based on this, it looks like oyu are using the : as a command delimiter, the defult use to be ! I would have to look if this has changed in the new Nagios docs but it looks like that is the source of the problem.

      TO workaround either change your delimiter, and all your check commands respectfully or try the following:
      check_command test_sql        200:250
      to the check command
      define check_sql .........
      $USER1$/check_nt -H $HOSTADDRESS$ -v COUNTER -l "\\SQLServer:General Statistics\\User Connections" -w $ARG1$ -c $ARG2$

      This is short hand, since I am still in the process of building a new nagios test box but I think it gets the sugestion accross.  in this syntex I do not know if there should be \\ or \ for th slashes.

      naturally this could also be put into a wrapper script, but that should not be nessisary.

      Personly I like to define the check command check_nc_net_l_w_c but this would not work for your example due to the issue with the :
      $USER1$/check_nt -H $HOSTADDRESS$ -v $ARG1$ -l $ARG2$ -w $ARG3$ -c $ARG4$

      I hope this assists in resolving the issue, please follow up.

      TOny

       
      • Adrian C

        Adrian C - 2007-01-02

        <daylight starts to dawn>

        I wonder...

        I'm using NagiosWeb to set up the services, which specifies ":" as the delimiter... "|" doesn't work... (Use that to delimit the warning and critical thresholds, and it returns a 127 Out Of Bounds)

        I've also tried using :: in place of the single colon in the middle of the counter name, and it still doesn't play.

        Hmmm. Interesting... Time to go and ask the NagiosWeb boys, I think... Looks like this is falling down a hole between two add-ons.

        Can't I just blame Microsoft for having a colon in the middle of the SQLServer PerfMon counters? Please?

         
    • Adrian C

      Adrian C - 2007-01-02

      OK, it's definitely a NagiosWeb problem.

      services.cfg has
              check_command           Win_PerfMon!"\\SQLServer!General Statistics\\User Connections"!200!250
      in the service definition. Change that to the correct
              check_command           Win_PerfMon!"\\SQLServer:General Statistics\\User Connections"!200!250
      and it works fine.

      My apologies for doubting nc_net and check_nt...

       
      • tony

        tony - 2007-01-02

        ? How did the problem get there?
        was it a tool that built your Configuration file, or did someone just edit it wrong to begin with?

        If it was a tool, was it a bug that added the : or just a typo during configuration.  if it was a bug, should the author of the tool be notified?

        tony

         
    • Adrian C

      Adrian C - 2007-01-03

      > ? How did the problem get there? 
      > was it a tool that built your Configuration file, or did someone just edit it wrong to begin with?

      Yes, it was. NagiosWeb - decent project, apart from this...

      > If it was a tool, was it a bug that added the : or just a typo during configuration.

      Seems to be a bug in the cfg write process. It just replaces all ":" with "!"

      > if it was a bug, should the author of the tool be notified?

      Should be, and have been...

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.