Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
joohanhong
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JooHan Hong
joohanhong
Commits
0620a731
Commit
0620a731
authored
Mar 11, 2021
by
JooHan Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2021-03-11, update1
parent
49a87956
Pipeline
#5169
passed with stages
in 46 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
117 additions
and
0 deletions
+117
-0
README.md
DOCKER/ZABBIX/README.md
+117
-0
No files found.
DOCKER/ZABBIX/README.md
0 → 100644
View file @
0620a731
[
![logo
](
https://www.hongsnet.net/images/logo.gif
)
](https://www.hongsnet.net)
# www.hongsnet.net monitoring
![
source_overview
](
./images/zabbix-monitoring.png
)
Dedicated 및 VM 시스템의 경우 Zabbix를 이용하여 모니터링 한다. 구성요소는 다음과 같다.
# 구성 요소
-
Dockerized Envionment
-
Mattermost Push Alert
-
Line Push Alert
## Dockerfile
```
bash
# cat Dockerfile
FROM registry.hongsnet.net/joohan.hong/docker/centos:7.6.1810
MAINTAINER Hongs <master@hongsnet.net>
ENV
TZ
=
Asia/Seoul
COPY config/yum.conf /etc/yum.conf
RUN
ln
-snf
/usr/share/zoneinfo/
$TZ
/etc/localtime
&&
echo
$TZ
>
/etc/timezone
&&
\
yum
-y
install
epel-release
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
RUN yum
-y
install
epel-release
RUN yum
-y
install
glibc glibc-common openssl-devel net-tools vi vim iproute wget postfix cronie crontabs supervisor
RUN rpm
-ivh
https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
COPY config/zabbix_server.conf /etc/zabbix/zabbix_server.conf
COPY config/supervisord.conf /etc/supervisor/supervisord.conf
COPY config/zabbix.conf /etc/supervisor/conf.d/zabbix.conf
COPY config/php.ini /etc/php.ini
RUN
chown
-R
apache.apache /etc/zabbix/web
RUN
rm
-rf
/etc/alternatives/zabbix-web-font
RUN
mv
/usr/share/fonts/dejavu/DejaVuSans.ttf /usr/share/fonts/dejavu/DejaVuSans.ttf_bak
COPY config/fonts/NanumFont/NanumGothic.ttf /usr/share/fonts/dejavu/DejaVuSans.ttf
COPY config/bashrc /root/.bashrc
RUN localedef
-f
UTF-8
-i
ko_KR ko_KR.utf8
EXPOSE 10051 443
CMD
[
"/usr/bin/supervisord"
,
"-c"
,
"/etc/supervisor/supervisord.conf"
]
```
## Mattermost Push Alert Script
```
bash
# cat mattermost.sh
#!/bin/bash
url
=
'https://chat.hongsnet.net/hooks/XXXXXXXXXXX'
username
=
'zabbix'
# Get the user/channel ($1), subject ($2), and message ($3)
to
=
"
$1
"
subject
=
"
$2
"
message
=
"
$3
"
recoversub
=
'^RECOVER(Y|ED)?$|^OK$|^Resolved.*'
problemsub
=
'^PROBLEM.*|^Problem.*'
if
[[
"
$subject
"
=
~
$recoversub
]]
;
then
emoji
=
':smile:'
color
=
'#0C7BDC'
elif
[[
"
$subject
"
=
~
$problemsub
]]
;
then
emoji
=
':frowning:'
color
=
'#FFC20A'
else
emoji
=
':question:'
color
=
'#CCCCCC'
fi
# Replace the above hard-coded Slack.com web-hook URL entirely, if one was passed via the optional 4th parameter
url
=
${
4
-
$url
}
# Use optional 5th parameter as proxy server for curl
proxy
=
${
5
-
""
}
if
[[
"
$proxy
"
!=
''
]]
;
then
proxy
=
"-x
$proxy
"
fi
# Build JSON payload which will be HTTP POST'ed to the Slack.com web-hook URL
payload
=
"payload={
\"
channel
\"
:
\"
${
to
//\
"/
\\\"
}
\"
,
\
\"
username
\"
:
\"
${
username
//\
"/
\\\"
}
\"
,
\
\"
attachments
\"
: [{
\"
fallback
\"
:
\"
${
subject
//\
"/
\\\"
}
\"
,
\"
title
\"
:
\"
${
subject
//\
"/
\\\"
}
\"
,
\"
text
\"
:
\"
${
message
//\
"/
\\\"
}
\"
,
\"
color
\"
:
\"
${
color
}
\"
}],
\
\"
icon_emoji
\"
:
\"
${
emoji
}
\"
}"
# Execute the HTTP POST request of the payload to Slack via curl, storing stdout (the response body)
return=
$(
curl
$proxy
-sm
5
--data-urlencode
"
${
payload
}
"
$url
-A
'zabbix-slack-alertscript / https://github.com/ericoc/zabbix-slack-alertscript'
)
# If the response body was not what was expected from Slack (
"ok"
), something went wrong so print the Slack error to stderr and exit with non-zero
if [[
"
$return
"
!=
'ok'
]]; then
>&2 echo
"
$return
"
exit 1
fi
```
## Line Push Alert Script
```
bash
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment