nsclient #6

Supports: win2012 win2012r2 win2012hv win2012hvr2 win2016 win2016nano


NSClient is an agent designed originaly to work with Nagios but has since evolved into a fully fledged monitring agent which can be used with numerous monitoring tools.

# Windows Juju charm for NSClient++

This is a subordinate charm that attaches to any principle charm through a local-monitors interface. If there is no local-monitors interface on the principle charm, the implicit juju-info interface is used for getting general info from the charm.

Installing, configuring and testing

Assuming you already have a Juju environment already set up and a Windows 2012 R2 machine deployed, download the charm onto a machine that can issue Juju commands, deploy the nagios charm, a windows charm (e.g mssql-express) and the NSClient++ subordinate charm:

juju deploy nagios
juju deploy cs:~cloudbaseit/win2012r2/mssql-express
juju deploy --repository /path/to/charms/directory local:win2012r2/nsclient

Create relations between mssql-express - nsclient and nsclient-nagios:

juju add-relation mssql-express nsclient
juju add-relation nsclient:monitors nagios:monitors  (this relation must be made through the 'monitors' interface)


When this charm is deployed, being a subordinate charm, it is added to the Juju environment without being deployed to any node. The actual deployment and install is done when a relation is set between a principle charm and nsclient charm. So after setting a relation with a principle charm, nsclient is deployed on the same node the principle charm is running on.

Ideally, the principle charm should have a 'local-monitors' interface. Through this interface, the principle charm can send the resources Nagios should monitor.

By default, on every relation set, there are 3 fields monitored: CPU usage, Memory Usage and Disk Usage. This fields can not be changed and are automatically added to the monitored node.

When the relation with the Nagios charm is set, NSclient pulls the Nagios server's private-address and sets it in the allowed hosts of its configuration file. Then, it sends 3 fields through the monitors interface to the Nagios server: target-addres, target-id and monitors (ip address, hostname and what to monitor). The monitors field contains the default checks + checks sent from the principle charm thorough the local-monitors interface.


Besides the self-explanatory entries in the config, you can also manually add check fields to the monitors.yaml. The monitors field accepts a strict input. For more details see monitors.yaml section below.


Check requests can be sent from the principle charm to NSClient charm through the local-monitors interface, who in turn forwards it to the Nagios charm through the monitors interface.

An example of monitors field sent through the local-monitors interface :

# this is a monitors yaml
  # inform Nagios that this is a remote check and not a local one.
    # define the check type. This version of the charm
    # only supports nrpe checks. Future versions will add other types of checks.
      # name given by us for the command that will appear in
      # the Nagios webui dashboard (can be arbitrary)
        # the actual command that Nagios will run. In this example the
        # command is 'alias_event_log' that checks the event logs from the principle charms host.
        # Nagios interprets it as 'check_nrpe -H <ipaddress of remote host> -c alias_event_log'
        command: alias_event_log

The alias commands are already predefined in NSClient. We can also give a standard nrpe command. So instead of command: alias_event_log we can do command: CheckEventLog and we can add -a for extra arguments. For more information visit NSClient++ documentation for aliases and Nagios documentation for check_nrpe commands.

Additional checks can also be set through the monitors config option:

juju set nsclient monitors: "monitors:
        command: alias_event_log"

The format is very important. If the formatting of the config is wrong, Nagios charm will complain about this and enter in error state.


(boolean) Determines whether or not we will allow clients to specify arguments to commands that are executed.
(boolean) Indicates if this NSClient permits sending some characters which are consired harmful through NRPE. See 'http://docs.nsclient.org/faq/' at section 'Nasty metacharacters'.
(string) These are the Nagios servers allowed to connect to this NSClient. Multiple hosts can be given as a comma-delimited list.
(boolean) Send more than 1 return packet to allow response to go beyond payload size.
(boolean) Boolean value which indicates if HTTPS insecure connections are permitted.
(string) Download URL for the Windows MSI or ZIP installer. If this is not set, charm uses the juju resources or the default upstream installers.
(string) Additional check fields. See README for more details and usage.
(int) The TCP port used by NSClient to listen for requests.
(int) Port used by a server that listens for incoming check_nt connection and processes incoming requests.
(string) Password to use for Nagios administrative access. This is used only for check_nt protocol.
(string) Options for configuring NSClient SSL.
(boolean) This option controls if SSL is enabled or not.