Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Problem with check_nt and $

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    2

    Problem with check_nt and $

    Hello,
    I'm a problem with check_nt command and SERVICESTATE.
    I want check windows service MSSQL (name is : MSSQL$DB) and i don't arrive to do that.
    Cause $
    In Nagios, it's works fine.
    How do that?
    Thanks a lot
    Emilien RIPOLL


    Code:
    # Service Windows
    define command{ 
    	command_name	service_windows
    	command_line	$PLUGINSDIR$/check_nt -H $HOSTADDRESS$ -p 12489 -s "" -v SERVICESTATE -l $ARG1$ -d SHOWALL
    }
    
    
    #DB Service
    define service{
    	name				db_service
    	service_description		db Service
    	use				generic-service
    	check_command			service_windows!MSSQL$DB,SQLAgent$DB
    	host_name			SVRDB
    	icon_set			disk
    }
    i try:
    Code:
    check_command	service_windows!MSSQL\$DB,SQLAgent$DB
    check_command	service_windows!MSSQL$$DB,SQLAgent$DB
    check_command	service_windows!MSSQL$$$DB,SQLAgent$DB
    check_command	service_windows!MSSQL\\\$DB,SQLAgent$DB

  2. #2
    Administrator Frescha's Avatar
    Join Date
    May 2011
    Posts
    183

    Re: Problem with check_nt and $

    Hi,
    pls try 'MSSQL$$DB'

  3. #3
    Junior Member
    Join Date
    Nov 2011
    Posts
    2

    Re: Problem with check_nt and $

    i try
    Code:
    check_command			service_windows!'MSSQL$$DB','SQLAgent$$DB'
    but that doesn't work

  4. #4
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Problem with check_nt and $

    Yes, it's a problem with the macro resolving. we add the "deep resolving" feature, so you can call the argument $ARG1$ if you want, but here it's a problem. We should escape $$ before managing macros, and put it back after the macro management.

    I opened the bug ticket at https://github.com/naparuba/shinken/issues/78
    No direct support by personal message. Please open a thread so everyone can see the solution

  5. #5
    Junior Member
    Join Date
    Sep 2011
    Posts
    9

    Re: Problem with check_nt and $

    hi,
    I modified this file code (shinken/macroresolver.py at line 220).
    Code:
          for macro in macros:
            c_line = c_line.replace('$'+macro+'$', macros[macro]['val'])
          c_line = c_line.replace('##', '$') # JavamanXP
    and i modified my command file
    Code:
    #Adonix Service
    define service{
    	name				adonix_service
    	service_description		Adonix Service
    	use				generic-service
    	check_command			service_windows!MSSQL##DB,ULTRAVnc
    	host_name			SVRDB
    	icon_set			disk
    }
    and it's work fine ;D
    But, if i have a second service with $, it isn't work
    Code:
    #Adonix Service
    define service{
    	name				adonix_service
    	service_description		Adonix Service
    	use				generic-service
    	check_command			service_windows!MSSQL##DB,SQLAgent##DB,ULTRAVnc
    	host_name			SVRDB
    	icon_set			disk
    }
    :'(

  6. #6
    Junior Member
    Join Date
    Sep 2011
    Posts
    9

    Re: Problem with check_nt and $

    hi,
    I modified this file code (shinken/macroresolver.py at line 220).
    Code:
    c_line = c_line.replace('##', '$')
    for macro in macros:
        c_line = c_line.replace('$'+macro+'$', macros[macro]['val'])
    and it's work fine ;D

    Code:
    #Adonix Service
    define service{
    	name				adonix_service
    	service_description		Adonix Service
    	use				generic-service
    	check_command			service_windows!MSSQL##DB,SQLAgent##DB,ULTRAVnc
    	host_name			SVRDB
    	icon_set			disk
    }

  7. #7
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Problem with check_nt and $

    I think it will be easier to say to new suers to "double" the $$ than to put # instead
    No direct support by personal message. Please open a thread so everyone can see the solution

  8. #8
    Administrator
    Join Date
    Jun 2011
    Posts
    216

    Re: Problem with check_nt and $

    Maybe we can commit the code to convert the $$ into $ and consider this problem as solved

  9. #9
    Shinken project leader
    Join Date
    May 2011
    Location
    Bordeaux (France)
    Posts
    2,131

    Re: Problem with check_nt and $

    We just look at make the $$ ->DOLARD2 change at the begining and DOLARD2->$ transformation at the end and it's ok

    If you can do it, go for it
    No direct support by personal message. Please open a thread so everyone can see the solution

  10. #10
    Administrator
    Join Date
    Jun 2011
    Posts
    216

    Re: Problem with check_nt and $

    You know that I can modify the code to handle that, but you also know that I can't push on the GIT ;D

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •