forked from berwegera/unraid-check-mk-agent
-
Notifications
You must be signed in to change notification settings - Fork 2
/
check_mk_agent22.plg
200 lines (153 loc) · 4.94 KB
/
check_mk_agent22.plg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?xml version='1.0' standalone='yes'?>
<!DOCTYPE PLUGIN [
<!ENTITY name "check_mk_agent">
<!ENTITY author "donimax">
<!ENTITY version "2024.12.05.22">
<!ENTITY gitURL "https://raw.githubusercontent.com/&author;/unraid-check-mk-agent/master">
<!ENTITY pluginURL "&gitURL;/&name;22.plg">
<!ENTITY md5 "bf3a76e131e01e254ff84095b37fe4ea">
<!ENTITY plugin "/boot/config/plugins/&name;">
<!ENTITY emhttp "/usr/local/emhttp/plugins/&name;">
<!ENTITY xinetd "xinetd-2.3.15.4-x86_64-1_slonly">
<!ENTITY xinetdmd5 "1da784d01bd5c8a8edb05feeef1ac07e">
]>
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" min="6.8.3" support="https://github.com/donimax/unraid-check-mk-agent">
<CHANGES>
###2024.12.05
- Bumped checkmk_agent to 2.2.0p37
###2024.11.07
- Bumped checkmk_agent to 2.2.0p36
###2024.10.10
- Bumped checkmk_agent to 2.2.0p35
###2024.09.26
- Bumped checkmk_agent to 2.2.0p34
###2024.09.11
- Bumped checkmk_agent to 2.2.0p33
###2024.08.14
- Bumped checkmk_agent to 2.2.0p32
###2024.07.17
- Bumped checkmk_agent to 2.2.0p31
###2024.07.10
- Bumped checkmk_agent to 2.2.0p30
###2024.07.03
- Bumped checkmk_agent to 2.2.0p29
###2024.06.05
- Bumped checkmk_agent to 2.2.0p27
###2024.05.08
- Bumped checkmk_agent to 2.2.0p26
###2024.04.24
- Bumped checkmk_agent to 2.2.0p25
###2024.03.27
- Bumped checkmk_agent to 2.2.0p24
###2024.03.06
- Bumped checkmk_agent to 2.2.0p23
###2024.02.21
- Bumped checkmk_agent to 2.2.0p22
###2024.01.31
- Bumped checkmk_agent to 2.2.0p21
###2024.01.24
- Bumped checkmk_agent to 2.2.0p19
###2024.01.17
- Bumped checkmk_agent to 2.2.0p18
###2023.12.13
- Bumped checkmk_agent to 2.2.0p17
###2023.12.06
- Bumped checkmk_agent to 2.2.0p16
###2023.11.15
- Bumped checkmk_agent to 2.2.0p14
###2023.11.01
- Bumped checkmk_agent to 2.2.0p12
###2023.09.13
- Bumped checkmk_agent to 2.2.0p9
###2023.08.23
- Bumped checkmk_agent to 2.2.0p8
###2023.08.02
- Bumped checkmk_agent to 2.2.0p7
###2023.07.19
- Bumped checkmk_agent to 2.2.0p6
###2023.07.12
- Bumped checkmk_agent to 2.2.0p5
</CHANGES>
<FILE Run="/bin/bash">
<INLINE>
rm -f $(ls &plugin;/packages/&name;*.tgz 2>/dev/null|grep -v '&version;')
rm -f $(ls &plugin;/packages/*.txz 2>/dev/null|grep -v '&xinetd;')
</INLINE>
</FILE>
<FILE Name="&plugin;/packages/&name;-&version;.tgz" Run="upgradepkg --install-new">
<URL>&gitURL;/packages/&name;-&version;.tgz</URL>
<MD5>&md5;</MD5>
</FILE>
<FILE Name="&plugin;/packages/&xinetd;.txz" Run="upgradepkg --install-new">
<URL>&gitURL;/packages/&xinetd;.txz</URL>
<MD5>&xinetdmd5;</MD5>
</FILE>
<FILE Name="&emhttp;/README.md">
<INLINE>
**Checkmk-Agent 2.2.0**
Monitors local services and reports any issues to the Checkmk server.
The agents are passive and connect to TCP Port 6556. Only on receiving a Checkmk server query will they be activated and respond with the required data.
To install plugins place them in '/usr/lib/check_mk_agent/plugins'
To use encryption edit the file '/boot/config/plugins/check_mk_agent/encryption.cfg'
</INLINE>
</FILE>
<FILE Run="/bin/bash">
<INLINE>
#Create check_mk xinetd file
if [ ! -f "/etc/xinetd.d/check_mk" ]; then
cp /etc/check_mk/xinetd-service-template.cfg /etc/xinetd.d/check_mk
fi
#Download icon
if [ ! -f "&plugin;/checkmk.png" ]; then
wget -q -nc --show-progress --progress=bar:force:noscroll -O "&plugin;/&name;.png" "https://raw.githubusercontent.com/donimax/unraid-docker-templates/master/donimax/images/checkmk.png"
fi
#Create plugins directory and link directories
if [ ! -d "&plugin;/plugins" ]; then
mkdir -p &plugin;/plugins
ln -s /boot/config/plugins/check_mk_agent/plugins /usr/lib/check_mk_agent/plugins
else
ln -s /boot/config/plugins/check_mk_agent/plugins /usr/lib/check_mk_agent/plugins
fi
#Create encryption file and link file
if [ ! -f "&plugin;/encryption.cfg" ]; then
echo "ENCRYPTED=no
PASSPHRASE='YOURPASSPHRASE'" > &plugin;/encryption.cfg
chmod 600 &plugin;/encryption.cfg
ln -s &plugin;/encryption.cfg /etc/check_mk/encryption.cfg
else
chmod 600 &plugin;/encryption.cfg
ln -s &plugin;/encryption.cfg /etc/check_mk/encryption.cfg
fi
#Install icon
if [ ! -f "&emhttp;/images/&name;.png" ]; then
if [ ! -d "&emhttp;/images" ]; then
mkdir -p &emhttp;/images
fi
cp &plugin;/&name;.png &emhttp;/images/
fi
#Start xinetd
if [ -z "$(pidof xinetd)" ]; then
xinetd
fi
</INLINE>
</FILE>
<FILE Run="/bin/bash" Method="remove">
<INLINE>
echo "----------------------------------------"
echo "-------Uninstalling Checkmk-Agent-------"
echo "----------------------------------------"
# Kill xinetd and remove plugin related files
kill $(pidof xinetd) > /dev/null 2>&1
removepkg &name;-&version;.tgz
removepkg &xinetd;.tgz
rm -rf &plugin;
rm -rf &emhttp;
rm -rf /etc/xinetd.d/check_mk
echo
echo "----------------------------------------------------------"
echo "---------------Checkmk-Agent uninstalled!-----------------"
echo "----------------------------------------------------------"
echo
</INLINE>
</FILE>
</PLUGIN>