# HG changeset patch # User kiyama # Date 1643090014 -32400 # Node ID c48aa8767fe6af40ec5673d0b3cf759ae85c4c3d # Parent b6dde3a2e38e478b5e59209df29b8c959869e59c add experiment diff -r b6dde3a2e38e -r c48aa8767fe6 .DS_Store Binary file .DS_Store has changed diff -r b6dde3a2e38e -r c48aa8767fe6 .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Tue Jan 25 14:53:34 2022 +0900 @@ -0,0 +1,11 @@ +thesis.log +e-thesis.sty +thesis.aux +thesis.fdb_latexmk +thesis.lot +thesis.toc +thesis.bbl +thesis.fls +thesis.blg +thesis.lof +thesis.synctex.gz diff -r b6dde3a2e38e -r c48aa8767fe6 mindmap.xmind Binary file mindmap.xmind has changed diff -r b6dde3a2e38e -r c48aa8767fe6 paper/.DS_Store Binary file paper/.DS_Store has changed diff -r b6dde3a2e38e -r c48aa8767fe6 paper/figs/grafana-login.png Binary file paper/figs/grafana-login.png has changed diff -r b6dde3a2e38e -r c48aa8767fe6 paper/figs/monitoring-system.png Binary file paper/figs/monitoring-system.png has changed diff -r b6dde3a2e38e -r c48aa8767fe6 paper/figs/prometheus-expr.png Binary file paper/figs/prometheus-expr.png has changed diff -r b6dde3a2e38e -r c48aa8767fe6 paper/src/docker-compose.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/paper/src/docker-compose.yml Tue Jan 25 14:53:34 2022 +0900 @@ -0,0 +1,50 @@ +version: '3' +services: + prometheus: + image: prom/prometheus + container_name: prometheus + volumes: + - ./prometheus:/etc/prometheus + - ./prometheus/alert.rules:/etc/prometheus/alert.rules + restart: always + ports: + - 9090:9090 + grafana: + image: grafana/grafana:latest + container_name: grafana + restart: always + ports: + - 3000:3000 + user: '0' + + volumes: + - ./var-lib-grafana:/var/lib/grafana + - ./grafana/grafana.ini:/etc/grafana/grafana.ini + alertmanager: + image: prom/alertmanager + container_name: alertmanager + volumes: + - ./alertmanager:/etc/prometheus + command: "--config.file=/etc/prometheus/alertmanager.yml" + ports: + - 9093:9093 + + loki: + image: grafana/loki:2.0.0 + container_name: loki + volumes: + - ./loki/local-config.yaml:/etc/loki/local-config.yaml + - ./loki/config:/loki/rules + command: + - "--config.file=/etc/loki/local-config.yaml" + ports: + - 3100:3100 + restart: always + promtail: + image: grafana/promtail + container_name: promtail + volumes: + - ./promtail/config.yml:/etc/promtail/config.yml + - ./promtail/test.log:/var/log/test.log + ports: + - 8080:8080 \ No newline at end of file diff -r b6dde3a2e38e -r c48aa8767fe6 paper/text/experiment.aux --- a/paper/text/experiment.aux Sun Jan 16 19:28:18 2022 +0900 +++ b/paper/text/experiment.aux Tue Jan 25 14:53:34 2022 +0900 @@ -2,13 +2,21 @@ \@writefile{toc}{\contentsline {chapter}{\numberline {第4章}提案手法}{7}\protected@file@percent } \@writefile{lof}{\addvspace {10\jsc@mpt }} \@writefile{lot}{\addvspace {10\jsc@mpt }} -\@writefile{toc}{\contentsline {section}{\numberline {4.1}死活監視}{7}\protected@file@percent } -\@writefile{toc}{\contentsline {section}{\numberline {4.2}ログ収集}{7}\protected@file@percent } -\@writefile{toc}{\contentsline {section}{\numberline {4.3}データ可視化}{7}\protected@file@percent } -\@writefile{toc}{\contentsline {section}{\numberline {4.4}アラート送信}{7}\protected@file@percent } -\@writefile{toc}{\contentsline {section}{\numberline {4.5}mattermostからのalert変更}{7}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {4.1}検証環境}{7}\protected@file@percent } +\newlabel{src:Queue.h}{{4.1}{7}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {4.1}docker-compose.yml}{7}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {4.1}{\ignorespaces monitoring-system}}{9}\protected@file@percent } +\newlabel{fig:monitoring-system}{{4.1}{9}} +\@writefile{toc}{\contentsline {section}{\numberline {4.2}システム監視}{9}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {4.2}{\ignorespaces monitoring-system}}{10}\protected@file@percent } +\newlabel{fig:prometheus-expr}{{4.2}{10}} +\@writefile{lof}{\contentsline {figure}{\numberline {4.3}{\ignorespaces grafana-login}}{11}\protected@file@percent } +\newlabel{fig:grafana-login}{{4.3}{11}} +\@writefile{toc}{\contentsline {section}{\numberline {4.3}ログ収集}{11}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {4.4}アラート送信}{11}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {4.5}mattermostからのalert変更}{11}\protected@file@percent } \@setckpt{./text/experiment}{ -\setcounter{page}{8} +\setcounter{page}{12} \setcounter{equation}{0} \setcounter{enumi}{0} \setcounter{enumii}{0} @@ -23,7 +31,9 @@ \setcounter{subsubsection}{0} \setcounter{paragraph}{0} \setcounter{subparagraph}{0} -\setcounter{figure}{0} +\setcounter{figure}{3} \setcounter{table}{0} \setcounter{parentequation}{0} +\setcounter{lstnumber}{51} +\setcounter{lstlisting}{1} } diff -r b6dde3a2e38e -r c48aa8767fe6 paper/text/experiment.tex --- a/paper/text/experiment.tex Sun Jan 16 19:28:18 2022 +0900 +++ b/paper/text/experiment.tex Tue Jan 25 14:53:34 2022 +0900 @@ -1,6 +1,66 @@ \chapter{提案手法} -\section{死活監視} +本研究では,システム障害の早期発見のために学科システムに監視システムの構築方法とその際に発生するアラートルールの属人化を防ぐためのスラッシュコマンドを用いたアラートルールの編集方法を提案する. + +\section{検証環境} +本実験では全ての監視システムをコンテナ上に構築しており,docker-compose.ymlファイルからpodmanでコンテナを作成する形を取っている. +作成したdocker-compose.ymlファイルを載せる. +\lstinputlisting[label=src:Queue.h, caption=docker-compose.yml]{src/docker-compose.yml} + +サービスの死活監視はprometheus,ログ収集はloki,それらのデータ可視化はgrafana,アラート送信はalertmanagerを用いて構築している. +システム監視の構成図を\ref{fig:monitoring-system}に示す. +exporter,alertmanagerはprometheusのコンポーネントとなっており,exporterで各サービスのメトリック情報をprometheusに対して送信している. +また,prometheusの独自のクエリ言語であるpromQLで設定した条件を満たした際にalertmanagerに対してアラートを送信する.\\ +使用するクエリ言語がlogQLに変わったりなどしているがlokiもpromethrus同様にログを収集し,アラートを送信している. + + +\begin{figure}[htbp] + \begin{center} + \includegraphics[width=130mm]{figs/monitoring-system.png} + \caption[monitoring-system]{構成図.} + \label{fig:monitoring-system} + \end{center} +\end{figure} + +\section{システム監視} +各サービスのリソース・死活監視はpromethrusを用いて行っている.\\ +図\ref{fig:prometheus-expr}に各expoterサーバーからprometheusに集めた情報をブラウザを通じて表示する様子を示す. + +\newpage + +\begin{figure}[htbp] + \begin{center} + \includegraphics[width=130mm]{figs/prometheus-expr.png} + \caption[monitoring-system]{promethrusでのグラフを用いたデータの可視化.} + \label{fig:prometheus-expr} + \end{center} +\end{figure} + +しかし,prometheusのグラフでは表示のカスタマイズや可視化したダッシュボードの登録,ログイン認証をサポートしていない. +そこでデータの可視化はgrafanaを用いた. +図\ref{fig:grafana-login}にgrafanaでのログイン画面を示す.\\ +図\ref{fig:grafana-login}に示すようにgrafanaを用いてダッシュボードの作成ができる. +また,これらのダッシュボードはカスタムすることが出来よく使用する情報を登録することが可能である. + +\begin{figure}[htbp] + \begin{center} + \includegraphics[width=130mm]{figs/grafana-login.png} + \caption[grafana-login]{grafanaでのlogin画面.} + \label{fig:grafana-login} + \end{center} +\end{figure} + +\newpage + \section{ログ収集} -\section{データ可視化} +ログ収集はlokiを用いて + + + \section{アラート送信} -\section{mattermostからのalert変更} \ No newline at end of file +prometheus,lokiは設定ファイルにalertmanagerのurlを記入することで連携が可能。 +alertmanagerからmattermostに対しアラートを送信する際はmattermostのwebhook機能を用いて送信している。 +以下がアラート送信の様子である。 + +\section{mattermostからのalert変更} +スラッシュコマンドの一覧 +実際にアラートルールが設定される様子。 diff -r b6dde3a2e38e -r c48aa8767fe6 paper/text/introduction.aux --- a/paper/text/introduction.aux Sun Jan 16 19:28:18 2022 +0900 +++ b/paper/text/introduction.aux Tue Jan 25 14:53:34 2022 +0900 @@ -23,4 +23,6 @@ \setcounter{figure}{0} \setcounter{table}{0} \setcounter{parentequation}{0} +\setcounter{lstnumber}{1} +\setcounter{lstlisting}{0} } diff -r b6dde3a2e38e -r c48aa8767fe6 paper/text/reference.aux --- a/paper/text/reference.aux Sun Jan 16 19:28:18 2022 +0900 +++ b/paper/text/reference.aux Tue Jan 25 14:53:34 2022 +0900 @@ -1,29 +1,21 @@ \relax \bibcite{ref-related-work}{1} -\bibcite{ref-jsps}{2} -\bibcite{ref-ieice}{3} -\bibcite{ref-ipsj}{4} -\bibcite{ref-journal}{5} -\bibcite{ref-journal-ex}{6} -\bibcite{ref-book}{7} -\bibcite{ref-book-ex}{8} -\bibcite{ref-proceedings}{9} -\bibcite{ref-proceedings-ex}{10} -\bibcite{ref-web}{11} -\bibcite{ref-report1}{12} -\bibcite{ref-report2}{13} -\@writefile{toc}{\contentsline {chapter}{参考文献}{10}\protected@file@percent } +\bibcite{ref-journal}{2} +\bibcite{ref-book}{3} +\bibcite{ref-proceedings}{4} +\bibcite{ref-report1}{5} +\@writefile{toc}{\contentsline {chapter}{参考文献}{15}\protected@file@percent } \@setckpt{./text/reference}{ -\setcounter{page}{11} +\setcounter{page}{16} \setcounter{equation}{0} \setcounter{enumi}{0} \setcounter{enumii}{0} \setcounter{enumiii}{0} -\setcounter{enumiv}{13} +\setcounter{enumiv}{5} \setcounter{footnote}{0} \setcounter{mpfootnote}{0} \setcounter{part}{0} -\setcounter{chapter}{5} +\setcounter{chapter}{6} \setcounter{section}{0} \setcounter{subsection}{0} \setcounter{subsubsection}{0} @@ -32,4 +24,6 @@ \setcounter{figure}{0} \setcounter{table}{0} \setcounter{parentequation}{0} +\setcounter{lstnumber}{51} +\setcounter{lstlisting}{0} } diff -r b6dde3a2e38e -r c48aa8767fe6 paper/text/reference.tex --- a/paper/text/reference.tex Sun Jan 16 19:28:18 2022 +0900 +++ b/paper/text/reference.tex Tue Jan 25 14:53:34 2022 +0900 @@ -1,41 +1,17 @@ \begin{thebibliography}{99} \bibitem{ref-related-work} -論文の読み方・書き方, 金森 由博, \url{http://kanamori.cs.tsukuba.ac.jp/docs/how_to_read_and_write_papers.html}, 2021/09/28. - -\bibitem{ref-jsps} -研究者のみなさまへ~責任ある研究活動を目指して~, 国立研究開発法人科学技術振興機構, \url{https://www.jst.go.jp/researchintegrity/shiryo/pamph_for_researcher.pdf}, 2020. - -\bibitem{ref-ieice} -和文論文誌投稿のしおり, 電子情報通信学会, \url{https://www.ieice.org/jpn/shiori/iss_2.html#2.6}, 2021/09/28. - -\bibitem{ref-ipsj} -論文誌ジャーナル原稿執筆案内, 情報処理学会, \url{https://www.ipsj.or.jp/journal/submit/ronbun_j_prms.html}, 2021/09/28. +Prometheus - Monitoring system \& time series database, Prometheus.io, \url{https://prometheus.io/}, 2022/01/28. \bibitem{ref-journal} 著者名, ``論文タイトル,'' 雑誌名, vol, no, page, year. -\bibitem{ref-journal-ex} -國田 樹, 遠藤聡志, ``学術論文の出典記載例,'' 知能情報学会誌, vol. 3, no. 2, pp.8-13, 2021. - \bibitem{ref-book} 著者名, ``書籍タイトル,'' (編集者名), 出版社名, 発行都市名, 発行年. -\bibitem{ref-book-ex} -國田樹, ``著書の出典記載例,'' 知能情報出版, 沖縄, 2021. - \bibitem{ref-proceedings} 著者名, ``論文タイトル,'' 学会名もしくは会議名, no.論文番号, ページ, 開催都市名, 開催国名, year. -\bibitem{ref-proceedings-ex} -國田樹, 遠藤聡志, ``学会論文の出典記載例'' 第2回知能情報国際会議, no.2-1234, pp.1-8, Okinawa, Japan, 2021. - -\bibitem{ref-web} -著者名(サイト管理者と同一の場合は省略可), Webページタイトル, サイト管理者名等, URL(url命令を使用すること), 参照年月日. - \bibitem{ref-report1} 見延庄太郎,理系のためのレポート・論文完全ナビ,講談社, 2016. -\bibitem{ref-report2} -福地健太郎,理工系のためのよい文章の書き方,翔泳社, 2019. - \end{thebibliography} diff -r b6dde3a2e38e -r c48aa8767fe6 paper/text/summary.aux --- a/paper/text/summary.aux Sun Jan 16 19:28:18 2022 +0900 +++ b/paper/text/summary.aux Tue Jan 25 14:53:34 2022 +0900 @@ -1,6 +1,11 @@ \relax +\@writefile{toc}{\contentsline {chapter}{\numberline {第5章}まとめ}{12}\protected@file@percent } +\@writefile{lof}{\addvspace {10\jsc@mpt }} +\@writefile{lot}{\addvspace {10\jsc@mpt }} +\@writefile{toc}{\contentsline {section}{\numberline {5.1}総括}{12}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {5.2}今後の課題}{12}\protected@file@percent } \@setckpt{./text/summary}{ -\setcounter{page}{8} +\setcounter{page}{13} \setcounter{equation}{0} \setcounter{enumi}{0} \setcounter{enumii}{0} @@ -9,8 +14,8 @@ \setcounter{footnote}{0} \setcounter{mpfootnote}{0} \setcounter{part}{0} -\setcounter{chapter}{4} -\setcounter{section}{5} +\setcounter{chapter}{5} +\setcounter{section}{2} \setcounter{subsection}{0} \setcounter{subsubsection}{0} \setcounter{paragraph}{0} @@ -18,4 +23,6 @@ \setcounter{figure}{0} \setcounter{table}{0} \setcounter{parentequation}{0} +\setcounter{lstnumber}{51} +\setcounter{lstlisting}{0} } diff -r b6dde3a2e38e -r c48aa8767fe6 paper/text/summary.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/paper/text/summary.tex Tue Jan 25 14:53:34 2022 +0900 @@ -0,0 +1,3 @@ +\chapter{まとめ} +\section{総括} +\section{今後の課題} \ No newline at end of file diff -r b6dde3a2e38e -r c48aa8767fe6 paper/text/system.aux --- a/paper/text/system.aux Sun Jan 16 19:28:18 2022 +0900 +++ b/paper/text/system.aux Tue Jan 25 14:53:34 2022 +0900 @@ -23,4 +23,6 @@ \setcounter{figure}{0} \setcounter{table}{0} \setcounter{parentequation}{0} +\setcounter{lstnumber}{1} +\setcounter{lstlisting}{0} } diff -r b6dde3a2e38e -r c48aa8767fe6 paper/text/system.tex --- a/paper/text/system.tex Sun Jan 16 19:28:18 2022 +0900 +++ b/paper/text/system.tex Tue Jan 25 14:53:34 2022 +0900 @@ -1,17 +1,14 @@ \chapter{現在の学科システム} -本章では、 +本章では現在の学科システムの問題点及び監視システムを導入する際に発生するであろう問題点について述べる. \section{問題点} -・当初(今でも)学科システムにはシステム監視、ログ収集、アラート送信などの異常検知の機能が無く、システム障害やサイバー攻撃の早期発見・事後対応が困難になっていた。 +現在学科システムにはシステム監視、ログ収集、アラート送信などの異常検知の機能が無く,システム障害やサイバー攻撃の早期発見・事後対応が困難である. -・実際に2021/08月にはレンタルサーバーと基幹サーバーで障害が発生した。その時の障害の原因としては機器の物理故障とドライバのアップデートによる物だった。その為、システム監視やログ収集によって解決できる問題ではないが原因の調査する際に大いに役立つものと考える +実際に2021/08月にはレンタルサーバーと基幹サーバーで障害が発生した.その際に利用者からサーバー上で動作しているサービスが使用出来ないという報告を受けて障害に気づいた.また,該当サーバーが物理故障しており,原因調査の為ログを確認したかったがサーバーにアクセス出来なかった為調査開始に時間がかかった. -・また、10月から11月にかけては学科で運用しているgitlabが脆弱性を突かれ攻撃された。このケースでは攻撃を受ける前に総当たり攻撃の失敗やgitlabの使用者に対して警告メールが飛ぶなどの予兆があった為、監視システムを用いることで事前に攻撃を防げたものと考える。 +また,10月から11月にかけては学科で運用しているgitlabが脆弱性を突かれ攻撃された.実際に攻撃を受ける前に総当たり攻撃が失敗していたりユーザーに対して警告メールが送信されていたが攻撃に使用されているのに気づいたのは報告を受けてからだった. \section{監視システムを運用する上での課題} -・また、これらの監視システムを導入し、運用する上でも課題があると考える。 -システムのリソースなどの情報やログをブラウザから見れるようにする事でCLIで確認するよりもみやすくなる。 -しかし、その中から人の目で不審なログやシステムの不調をピンポイントで見つけるのは困難である。その為、アラート機能を活用する事で管理者は必要な情報(インシデントに直結するような情報)のみを入手することができる。 +監視システムを運用していく中でアラートルールは通知される量やその精度に応じて調整する必要があり,障害は個人ではなく組織として対応する為全ての変更はグループ全体が理解しているのが好ましい. -適切なアラートルールを設定する際にノウハウが属人化する恐れがある -現在、scrapboxに記事を書いているが第三者に伝わり切らない場合や禁輸漏れがある。 -記事として纏めても各々が検索して確認しないといけない \ No newline at end of file +しかし通常では一人がサーバーにアクセスしてCLI上での変更が必要となる. +上記の方法では第三者に編集内容を伝える方法としてログなどにまとめるしか無く,また第三者はログを自分で探す必要がある. diff -r b6dde3a2e38e -r c48aa8767fe6 paper/text/technology.aux --- a/paper/text/technology.aux Sun Jan 16 19:28:18 2022 +0900 +++ b/paper/text/technology.aux Tue Jan 25 14:53:34 2022 +0900 @@ -5,7 +5,7 @@ \@writefile{toc}{\contentsline {section}{\numberline {2.1}prometheus}{2}\protected@file@percent } \@writefile{toc}{\contentsline {section}{\numberline {2.2}PromQL}{2}\protected@file@percent } \@writefile{toc}{\contentsline {section}{\numberline {2.3}exporter}{2}\protected@file@percent } -\@writefile{lof}{\contentsline {figure}{\numberline {2.1}{\ignorespaces 図目次用の短いキャプション}}{3}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {2.1}{\ignorespaces prometheus}}{3}\protected@file@percent } \newlabel{fig:name}{{2.1}{3}} \@writefile{toc}{\contentsline {section}{\numberline {2.4}alertmanager}{3}\protected@file@percent } \@writefile{toc}{\contentsline {section}{\numberline {2.5}loki}{3}\protected@file@percent } @@ -36,4 +36,6 @@ \setcounter{figure}{1} \setcounter{table}{0} \setcounter{parentequation}{0} +\setcounter{lstnumber}{1} +\setcounter{lstlisting}{0} } diff -r b6dde3a2e38e -r c48aa8767fe6 paper/text/technology.tex --- a/paper/text/technology.tex Sun Jan 16 19:28:18 2022 +0900 +++ b/paper/text/technology.tex Tue Jan 25 14:53:34 2022 +0900 @@ -3,12 +3,13 @@ オープンソースのメトリクスベースのモニタリングシステムである.対象サービスから監視サーバーに対し情報を取得するpull型を採用しており,取得したデータは時系列データベースに保存される.特徴としてそれぞれのデータに付与されているラベルごとに情報をまとめることが出来る.また、promQLという独自のクエリ言語を扱う事でアラート管理コンポーネントであるalertmanagerにクエリを発行することができる. \section{PromQL} -prometheusの時系列データを扱うことに特化したクエリ言語である.グラフやprometheusの式ブラウザ +prometheusの時系列データを扱うことに特化したクエリ言語である. +グラフやprometheusの式ブラウザを表示するのに使用したり,HTTPAPIを介して外部システムで利用することが出来る. \begin{figure}[htbp] \begin{center} - \includegraphics[width=120mm]{./figs/prometheus_expr.png} - \caption[図目次用の短いキャプション]{prometheusのグラフ.} + \includegraphics[width=120mm]{./figs/prometheus-expr.png} + \caption[prometheus]{prometheusの式ブラウザ.} \label{fig:name} \end{center} \end{figure} diff -r b6dde3a2e38e -r c48aa8767fe6 paper/thesis.dvi Binary file paper/thesis.dvi has changed diff -r b6dde3a2e38e -r c48aa8767fe6 paper/thesis.pdf Binary file paper/thesis.pdf has changed diff -r b6dde3a2e38e -r c48aa8767fe6 paper/thesis.tex --- a/paper/thesis.tex Sun Jan 16 19:28:18 2022 +0900 +++ b/paper/thesis.tex Tue Jan 25 14:53:34 2022 +0900 @@ -1,7 +1,11 @@ \documentclass[title,12pt]{jsreport} \usepackage{ie-thesis} +\usepackage{listings} +\usepackage{url} +\usepackage{comment} -\jtitle{障害対応のための学科システムへの監視システム導入} + +\jtitle{障害対応のための監視システムの検証} \title{test} \affiliation{琉球大学工学部工学科知能情報コース} @@ -13,6 +17,29 @@ \Jabstract{\input{./text/Jabstract.tex}} \Eabstract{\input{./text/Eabstract.tex}} +\lstset{ + frame=single, + keepspaces=true, + stringstyle={\ttfamily}, + commentstyle={\ttfamily}, + identifierstyle={\ttfamily}, + keywordstyle={\ttfamily}, + basicstyle={\ttfamily}, + breaklines=true, + xleftmargin=0zw, + xrightmargin=0zw, + framerule=.2pt, + columns=[l]{fullflexible}, + numbers=left, + stepnumber=1, + numberstyle={\scriptsize}, + numbersep=1em, + language={}, + tabsize=4, + lineskip=-0.5zw, + escapechar={@, $}, +} + \begin{document} \maketitle %Don't remove.