Skip to content

Commit

Permalink
winPB: Install NSClient++ On Windows Hosts For Nagios Monitoring (#2827)
Browse files Browse the repository at this point in the history
* Add new Ansible role

Install NSClient, and include the nagios server variables.

* Include new NSClient role.

* Fix typo in new nsclient role name

* Temp Disable Cuda

* Fix type on ansible_architecture var name

* Debug NSClient Tasks

* Temp Changes For Debugging.

* Debugging

* Correct typo in ansible architecture

* Debug MSI Installer Hanging Issue

* Fix Install task to use win_package

* Remove debugging.

* Undo all debugs except for CUDA

* RE-enable cuda

* Remove redundant variable.
  • Loading branch information
steelhead31 authored Nov 29, 2022
1 parent 6e8f3d7 commit c5cbed1
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ Nagios_Plugins: Disabled
### Default JDK ###
bootjdk: hotspot
heapsize: normal

## Nagios Server Details
Nagios_Master_IP: 78.47.239.96
1 change: 1 addition & 0 deletions ansible/playbooks/AdoptOpenJDK_Windows_Playbook/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
- Rust # IcedTea-Web
- IcedTea-Web # For Jenkins webstart
- WiX # For creating installers
- NSClient # Required For Nagios Monitoring
- shortNames
- Dragonwell # Dragonwell bootstrap image
- role: Thunderbird
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
####################################
# NSCLient++ - Used For Nagios #
####################################

- name: Test if NSClient++ is already installed
win_stat:
path: 'c:\nsclient\nscp.exe'
register: nsclient_installed
tags: NSClient

- name: Download NSClient installer (64-Bit)
win_get_url:
url: https://github.com/mickem/nscp/releases/download/0.5.2.39/NSCP-0.5.2.39-x64.msi
dest: 'C:\temp\nscp.msi'
force: no
checksum: dfe93c293f30586b02510d8b7884e4e177b93a5fead8b5dc6de8103532e6e159
checksum_algorithm: sha256
when: (not nsclient_installed.stat.exists) and (ansible_architecture == "64-bit")
tags: NSClient

- name: Download NSClient installer (32-Bit)
win_get_url:
url: https://github.com/mickem/nscp/releases/download/0.5.2.39/NSCP-0.5.2.39-Win32.msi
dest: 'C:\temp\nscp.msi'
force: no
checksum: ca6a67fb01c1468f2b510fd2f9eb0750887db3fb49a0302732c1421c85c6627c
checksum_algorithm: sha256
when: (not nsclient_installed.stat.exists) and (ansible_architecture == "32-bit")
tags: NSClient

- name: Install NSClient
win_package:
path: 'C:\temp\nscp.msi'
creates_path: 'c:\nsclient\nscp.exe'
state: present
arguments: /l* C:\temp\nscp.log /quiet INSTALLLOCATION=c:\nsclient CONF_CAN_CHANGE=1 MONITORING_TOOL=none ALLOWED_HOSTS=127.0.0.1,{{ Nagios_Master_IP }} ADD_DEFAULTS=1 CONF_CHECKS=1 CONF_NSCLIENT=1 /quiet
when: (not nsclient_installed.stat.exists)
tags: NSClient

- name: Enable External Script Options For NSClient
raw: c:\nsclient\nscp settings --activate-module {{ item }}
with_items:
- CheckExternalScripts
- CheckHelpers
- CheckEventLog
- CheckNSCP
- CheckDisk
- CheckSystem
when: (not nsclient_installed.stat.exists)
register: result
failed_when: (result.rc == 0) or (result.rc == -1)
tags: NSClient

- name: NSClient - Restart Service
win_service:
name: nscp
state: restarted
tags: NSClient

- name: Cleanup NSClient
win_file:
path: C:\temp\nscp.msi
state: absent
failed_when: false
tags: NSClient

0 comments on commit c5cbed1

Please sign in to comment.