This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcheck_mk_agent.plg
118 lines (98 loc) · 3.59 KB
/
check_mk_agent.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
<?xml version='1.0' standalone='yes'?>
<!DOCTYPE PLUGIN [
<!ENTITY name "check_mk_agent">
<!ENTITY author "ich777">
<!ENTITY version "2021.06.11a">
<!ENTITY gitURL "https://raw.githubusercontent.com/&author;/unraid-check-mk-agent/master">
<!ENTITY pluginURL "&gitURL;/&name;.plg">
<!ENTITY md5 "8172444f3c5b6b86a09ec3b05825714a">
<!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://forums.unraid.net/topic/83786-support-ich777-application-dockers/">
<CHANGES>
###2021.06.10a
- Bumped checkmk_agent to v2.0.0p5
###2021.06.10
- Initial release based on checkmk_agent v1.5.0p25
</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**
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 '/boot/config/plugins/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>
#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/ich777/docker-templates/master/ich777/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;
echo
echo "----------------------------------------------------------"
echo "---------------Checkmk-Agent uninstalled!-----------------"
echo "----------------------------------------------------------"
echo
</INLINE>
</FILE>
</PLUGIN>