Skip to content

Commit c5cbed1

Browse files
authored
winPB: Install NSClient++ On Windows Hosts For Nagios Monitoring (#2827)
* 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.
1 parent 6e8f3d7 commit c5cbed1

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

ansible/playbooks/AdoptOpenJDK_Windows_Playbook/group_vars/all/adoptopenjdk_variables.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ Nagios_Plugins: Disabled
1111
### Default JDK ###
1212
bootjdk: hotspot
1313
heapsize: normal
14+
15+
## Nagios Server Details
16+
Nagios_Master_IP: 78.47.239.96

ansible/playbooks/AdoptOpenJDK_Windows_Playbook/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
- Rust # IcedTea-Web
7373
- IcedTea-Web # For Jenkins webstart
7474
- WiX # For creating installers
75+
- NSClient # Required For Nagios Monitoring
7576
- shortNames
7677
- Dragonwell # Dragonwell bootstrap image
7778
- role: Thunderbird
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
####################################
3+
# NSCLient++ - Used For Nagios #
4+
####################################
5+
6+
- name: Test if NSClient++ is already installed
7+
win_stat:
8+
path: 'c:\nsclient\nscp.exe'
9+
register: nsclient_installed
10+
tags: NSClient
11+
12+
- name: Download NSClient installer (64-Bit)
13+
win_get_url:
14+
url: https://github.com/mickem/nscp/releases/download/0.5.2.39/NSCP-0.5.2.39-x64.msi
15+
dest: 'C:\temp\nscp.msi'
16+
force: no
17+
checksum: dfe93c293f30586b02510d8b7884e4e177b93a5fead8b5dc6de8103532e6e159
18+
checksum_algorithm: sha256
19+
when: (not nsclient_installed.stat.exists) and (ansible_architecture == "64-bit")
20+
tags: NSClient
21+
22+
- name: Download NSClient installer (32-Bit)
23+
win_get_url:
24+
url: https://github.com/mickem/nscp/releases/download/0.5.2.39/NSCP-0.5.2.39-Win32.msi
25+
dest: 'C:\temp\nscp.msi'
26+
force: no
27+
checksum: ca6a67fb01c1468f2b510fd2f9eb0750887db3fb49a0302732c1421c85c6627c
28+
checksum_algorithm: sha256
29+
when: (not nsclient_installed.stat.exists) and (ansible_architecture == "32-bit")
30+
tags: NSClient
31+
32+
- name: Install NSClient
33+
win_package:
34+
path: 'C:\temp\nscp.msi'
35+
creates_path: 'c:\nsclient\nscp.exe'
36+
state: present
37+
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
38+
when: (not nsclient_installed.stat.exists)
39+
tags: NSClient
40+
41+
- name: Enable External Script Options For NSClient
42+
raw: c:\nsclient\nscp settings --activate-module {{ item }}
43+
with_items:
44+
- CheckExternalScripts
45+
- CheckHelpers
46+
- CheckEventLog
47+
- CheckNSCP
48+
- CheckDisk
49+
- CheckSystem
50+
when: (not nsclient_installed.stat.exists)
51+
register: result
52+
failed_when: (result.rc == 0) or (result.rc == -1)
53+
tags: NSClient
54+
55+
- name: NSClient - Restart Service
56+
win_service:
57+
name: nscp
58+
state: restarted
59+
tags: NSClient
60+
61+
- name: Cleanup NSClient
62+
win_file:
63+
path: C:\temp\nscp.msi
64+
state: absent
65+
failed_when: false
66+
tags: NSClient

0 commit comments

Comments
 (0)