Nsclient install

280 views
Skip to first unread message

Jeffrey Smith

unread,
Nov 27, 2013, 6:53:45 AM11/27/13
to puppet...@googlegroups.com
I am trying to install NSClient on windows 2008r2 using the below manifest


class nsclient ($nagiosservers) {

    if ($operatingsystem == "windows") {

        file { 'C:/NSClient':
            ensure  => directory,
            owner   => 'Administrator',
            mode    => '0755',
        }

        file { 'C:/NSClient/NSClient-0.3.9-x64.msi':
            ensure => present,
            owner   => 'Administrator',
            mode    => '0755',
            source  => "puppet:///modules/nsclient/NSClient-0.3.9-x64.msi",
            require => File['C:/NSClient'],
        }

        package { 'NSClient++ (x64)':
            ensure  => installed,
            provider => 'windows',
            source  => "C:\\NSClient\\NSClient-0.3.9-x64.msi",
            require => File['C:/NSClient/NSClient-0.3.9-x64.msi'],
        }

        service { 'NSClient++ (x64)':
            ensure  => running,
            enable  => true,
            require => Package['NSClient++ (x64)'],
        }

        file { 'C:/Program Files/NSClient++/NSC.ini':
            ensure  => file,
            owner   => 'Administrator',
            mode    => '0755',
            content => template("nsclient/NSC.ini.erb"),
            require => Package['NSClient++ (x64)'],
            notify  => Service['NSClient++ (x64)'],
        }

        file { 'C:/Program Files/NSClient++/scripts/check_bkp.bat':
            ensure  => file,
            owner   => 'SYSTEM',
            mode    => '0755',
            source  => 'puppet:///modules/nsclient/check_bkp.bat',
            require => Package['NSClient++ (x64)'],
        }
    }
    else {
        fail('This module is only supported on windows')
    }
}


I get the following errors during the initial run

Info: /Stage[main]/Nsclient/File[C:/Program Files/NSClient++/NSC.ini]: Scheduling refresh of Service[NSClient++ (x64)]
Error: /Stage[main]/Nsclient/Service[NSClient++ (x64)]: Could not evaluate: Cannot get status of NSClient++ (x64), error was: The specified service does not exist as an installed service.
Error: /Stage[main]/Nsclient/Service[NSClient++ (x64)]: Failed to call refresh: Cannot get status of NSClient++ (x64), error was: The specified service does not exist as an installed service.
Error: /Stage[main]/Nsclient/Service[NSClient++ (x64)]: Cannot get status of NSClient++ (x64), error was: The specified service does not exist as an installed service.

If I run the following to list the services

sc queryex type= service state= all | find "DISPLAY_NAME"

There is a row that says "DISPLAY_NAME: NSClient++ (x64)" so the service is there puppet is just not starting it.

any more runs of the agent return this error

Error: /Stage[main]/Nsclient/Service[nsclient]: Could not evaluate: Cannot get status of NSClient++ (x64), error was: The specified service does not exist as an installed service.

puppetmaster : 3.2.3
puppet agent : 3.1.1

Is there something wrong with my config or is puppet having a hard time with the special characters in the service display name ?

 

Felix Frank

unread,
Nov 28, 2013, 7:33:12 PM11/28/13
to puppet...@googlegroups.com
Hi,

so are the errors disappearing in subsequent agent runs?

Thanks,
Felix

Jeffrey Smith

unread,
Nov 29, 2013, 6:31:28 AM11/29/13
to puppet...@googlegroups.com
No I just keep getting the error


Error: /Stage[main]/Nsclient/Service[
nsclient]: Could not evaluate: Cannot get status of NSClient++ (x64), error was: The specified service does not exist as an installed service.


kaustubh chaudhari

unread,
Nov 29, 2013, 7:13:29 AM11/29/13
to puppet...@googlegroups.com
from what i have seen, this means you are not using the correct service name.

Install NS Client on a windows box manually, go to run -> services.msc -> Look for NS service in the properties of that you will see the service Name, Use this service name if your code!

Hope this help!

-Kaustubh

Jeffrey Smith

unread,
Nov 29, 2013, 7:41:27 AM11/29/13
to puppet...@googlegroups.com

The service name is "NSClient++ (x64)" and its listed there its just not starting it as its saying it cant find it.

Felix Frank

unread,
Nov 29, 2013, 8:01:25 AM11/29/13
to puppet...@googlegroups.com
Kaustubh's remarks may still have merit, though. Perhaps there is a
subtle typo (think trailing space or similar). Have you copy-pasted the
name from an authoritative source?

Regards,
Felix

Jeffrey Smith

unread,
Dec 1, 2013, 7:15:03 AM12/1/13
to puppet...@googlegroups.com
Hi Felix,

The DisplayName from the registry key HKEYY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\NSClientpp\DisplayName is "NSClient++ (x64)"  in binary it is 

A hexdump of whats in my puppet manifest on linux gives

534e 6c43 6569 746e 2b2b 2820 3678 2934
000a

while what regedit says its storing is

4e 00 53 00 43 00 6c 00
69 00 65 00 6e 00 74 00
2b 00 2b 00 20 00 28 00
78 00 36 00 34 00 29 00
00 00

Is it possible its a windows utf16 to utf8 on Linux issue? 

Josh Cooper

unread,
Dec 1, 2013, 4:37:58 PM12/1/13
to puppet...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/8a6ba694-1308-4276-aea0-bab2ac00a8cc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

You'll want to use the short name of the service not the display name:  http://docs.puppetlabs.com/references/latest/type.html#service-attribute-name

The easiest way to find out what name puppet uses is to run 'puppet resource service' when the service is installed and see what comes back.

Josh


--
Josh Cooper
Developer, Puppet Labs

Jeffrey Smith

unread,
Dec 2, 2013, 5:53:15 AM12/2/13
to puppet...@googlegroups.com
HI Josh

It seems the display name was wrong.

 service { 'nsclient':
            name    => 'NSClientpp',

            ensure  => running,
            enable  => true,
            require => Package['nsclient'],
        }


That now works.

Thanks for the help.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages