nagios
Nagiosを使って、サーバーやネットワークの状態を監視し、異常があれば通知設定を行い、独自の監視項目も追加して、システム全体の安定稼働を支援するSkill。
📜 元の英語説明(参考)
Configure Nagios for infrastructure monitoring, service checks, host monitoring, and alert notifications. Use when a user needs to set up Nagios Core, write check commands, configure host and service definitions, manage notification contacts, or create custom monitoring plugins.
🇯🇵 日本人クリエイター向け解説
Nagiosを使って、サーバーやネットワークの状態を監視し、異常があれば通知設定を行い、独自の監視項目も追加して、システム全体の安定稼働を支援するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o nagios.zip https://jpskill.com/download/15154.zip && unzip -o nagios.zip && rm nagios.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15154.zip -OutFile "$d\nagios.zip"; Expand-Archive "$d\nagios.zip" -DestinationPath $d -Force; ri "$d\nagios.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
nagios.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
nagiosフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Nagios
概要
ホスト定義、チェックコマンド、通知先、およびカスタムプラグインを使用して、インフラストラクチャとサービスの監視のために Nagios Core をセットアップします。構成、一般的なチェック設定、およびプラグイン開発について説明します。
手順
タスク A: Nagios のインストールと構成
# Ubuntu に Nagios Core をインストールします
sudo apt-get update
sudo apt-get install -y nagios4 nagios-plugins nagios-nrpe-plugin
sudo systemctl enable nagios4
sudo systemctl start nagios4
# Web UI の管理者パスワードを設定します
sudo htpasswd -c /etc/nagios4/htpasswd.users nagiosadmin
# /etc/nagios4/nagios.cfg — 主要な構成ディレクティブ
cfg_dir=/etc/nagios4/conf.d
cfg_dir=/etc/nagios4/servers
log_file=/var/log/nagios4/nagios.log
command_file=/var/nagios4/rw/nagios.cmd
check_result_path=/var/nagios4/spool/checkresults
status_update_interval=10
check_external_commands=1
enable_notifications=1
execute_service_checks=1
タスク B: ホストとサービスの定義
# /etc/nagios4/servers/web-servers.cfg — Web サーバーのホスト定義
define host {
use linux-server
host_name web-01
alias Web Server 01
address 192.168.1.10
max_check_attempts 5
check_period 24x7
notification_interval 30
notification_period 24x7
contacts platform-team
hostgroups web-servers
}
define host {
use linux-server
host_name web-02
alias Web Server 02
address 192.168.1.11
max_check_attempts 5
check_period 24x7
notification_interval 30
notification_period 24x7
contacts platform-team
hostgroups web-servers
}
define hostgroup {
hostgroup_name web-servers
alias Web Servers
members web-01,web-02
}
# /etc/nagios4/servers/web-services.cfg — サービスチェックの定義
define service {
use generic-service
hostgroup_name web-servers
service_description HTTP
check_command check_http!-p 80 -e "200,301"
max_check_attempts 3
check_interval 2
retry_interval 1
notification_interval 15
contacts platform-team
}
define service {
use generic-service
hostgroup_name web-servers
service_description HTTPS Certificate
check_command check_http!-S -p 443 -C 30
check_interval 360
notification_interval 60
contacts platform-team
}
define service {
use generic-service
hostgroup_name web-servers
service_description Disk Usage
check_command check_nrpe!check_disk
max_check_attempts 3
check_interval 10
contacts platform-team
}
define service {
use generic-service
hostgroup_name web-servers
service_description CPU Load
check_command check_nrpe!check_load
check_interval 5
contacts platform-team
}
define service {
use generic-service
hostgroup_name web-servers
service_description Memory Usage
check_command check_nrpe!check_mem
check_interval 5
contacts platform-team
}
タスク C: コマンドと NRPE の構成
# /etc/nagios4/conf.d/commands.cfg — カスタムチェックコマンド
define command {
command_name check_nrpe
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -t 30
}
define command {
command_name check_http_content
command_line /usr/lib/nagios/plugins/check_http -H $HOSTADDRESS$ -p $ARG1$ -u $ARG2$ -s "$ARG3$"
}
define command {
command_name check_postgres
command_line /usr/lib/nagios/plugins/check_pgsql -H $HOSTADDRESS$ -d $ARG1$ -l $ARG2$
}
# /etc/nagios/nrpe.cfg — リモートホスト上の NRPE 構成
server_address=0.0.0.0
allowed_hosts=192.168.1.5
dont_blame_nrpe=0
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
command[check_load]=/usr/lib/nagios/plugins/check_load -w 5,4,3 -c 10,8,6
command[check_mem]=/usr/lib/nagios/plugins/check_mem.pl -w 80 -c 90 -f
command[check_procs]=/usr/lib/nagios/plugins/check_procs -w 250 -c 400
command[check_swap]=/usr/lib/nagios/plugins/check_swap -w 20% -c 10%
タスク D: 通知先
# /etc/nagios4/conf.d/contacts.cfg — 連絡先と通知の定義
define contact {
contact_name marta
alias Marta (Platform Lead)
email marta@example.com
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
}
define contactgroup {
contactgroup_name platform-team
alias Platform Engineering Team
members marta,tom,nina
}
define command {
command_name notify-service-by-slack
command_line /usr/local/bin/nagios-slack-notify.sh "$NOTIFICATIONTYPE$" "$SERVICEDESC$" "$HOSTALIAS$" "$SERVICESTATE$" "$SERVICEOUTPUT$"
}
タスク E: カスタムプラグイン
#!/bin/bash
# /usr/lib/nagios/plugins/check_api_health — カスタム API ヘルスチェックプラグイン
# 使用法: check_api_health -u <url> -w <warn_ms> -c <crit_ms>
URL=""
WARN=1000
CRIT=3000
while getopts "u:w:c:" opt; do
case $opt in
u) URL="$OPTARG" ;;
w) WARN="$OPTARG" ;;
c) CRIT="$OPTARG" ;;
esac
done
START=$(date +%s%N)
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 "$URL")
END=$(date +%s%N)
DURATION= 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Nagios
Overview
Set up Nagios Core for infrastructure and service monitoring with host definitions, check commands, notification contacts, and custom plugins. Covers configuration, common check setups, and plugin development.
Instructions
Task A: Install and Configure Nagios
# Install Nagios Core on Ubuntu
sudo apt-get update
sudo apt-get install -y nagios4 nagios-plugins nagios-nrpe-plugin
sudo systemctl enable nagios4
sudo systemctl start nagios4
# Set admin password for web UI
sudo htpasswd -c /etc/nagios4/htpasswd.users nagiosadmin
# /etc/nagios4/nagios.cfg — Key configuration directives
cfg_dir=/etc/nagios4/conf.d
cfg_dir=/etc/nagios4/servers
log_file=/var/log/nagios4/nagios.log
command_file=/var/nagios4/rw/nagios.cmd
check_result_path=/var/nagios4/spool/checkresults
status_update_interval=10
check_external_commands=1
enable_notifications=1
execute_service_checks=1
Task B: Define Hosts and Services
# /etc/nagios4/servers/web-servers.cfg — Web server host definitions
define host {
use linux-server
host_name web-01
alias Web Server 01
address 192.168.1.10
max_check_attempts 5
check_period 24x7
notification_interval 30
notification_period 24x7
contacts platform-team
hostgroups web-servers
}
define host {
use linux-server
host_name web-02
alias Web Server 02
address 192.168.1.11
max_check_attempts 5
check_period 24x7
notification_interval 30
notification_period 24x7
contacts platform-team
hostgroups web-servers
}
define hostgroup {
hostgroup_name web-servers
alias Web Servers
members web-01,web-02
}
# /etc/nagios4/servers/web-services.cfg — Service check definitions
define service {
use generic-service
hostgroup_name web-servers
service_description HTTP
check_command check_http!-p 80 -e "200,301"
max_check_attempts 3
check_interval 2
retry_interval 1
notification_interval 15
contacts platform-team
}
define service {
use generic-service
hostgroup_name web-servers
service_description HTTPS Certificate
check_command check_http!-S -p 443 -C 30
check_interval 360
notification_interval 60
contacts platform-team
}
define service {
use generic-service
hostgroup_name web-servers
service_description Disk Usage
check_command check_nrpe!check_disk
max_check_attempts 3
check_interval 10
contacts platform-team
}
define service {
use generic-service
hostgroup_name web-servers
service_description CPU Load
check_command check_nrpe!check_load
check_interval 5
contacts platform-team
}
define service {
use generic-service
hostgroup_name web-servers
service_description Memory Usage
check_command check_nrpe!check_mem
check_interval 5
contacts platform-team
}
Task C: Configure Commands and NRPE
# /etc/nagios4/conf.d/commands.cfg — Custom check commands
define command {
command_name check_nrpe
command_line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -t 30
}
define command {
command_name check_http_content
command_line /usr/lib/nagios/plugins/check_http -H $HOSTADDRESS$ -p $ARG1$ -u $ARG2$ -s "$ARG3$"
}
define command {
command_name check_postgres
command_line /usr/lib/nagios/plugins/check_pgsql -H $HOSTADDRESS$ -d $ARG1$ -l $ARG2$
}
# /etc/nagios/nrpe.cfg — NRPE configuration on remote hosts
server_address=0.0.0.0
allowed_hosts=192.168.1.5
dont_blame_nrpe=0
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
command[check_load]=/usr/lib/nagios/plugins/check_load -w 5,4,3 -c 10,8,6
command[check_mem]=/usr/lib/nagios/plugins/check_mem.pl -w 80 -c 90 -f
command[check_procs]=/usr/lib/nagios/plugins/check_procs -w 250 -c 400
command[check_swap]=/usr/lib/nagios/plugins/check_swap -w 20% -c 10%
Task D: Notification Contacts
# /etc/nagios4/conf.d/contacts.cfg — Contact and notification definitions
define contact {
contact_name marta
alias Marta (Platform Lead)
email marta@example.com
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
}
define contactgroup {
contactgroup_name platform-team
alias Platform Engineering Team
members marta,tom,nina
}
define command {
command_name notify-service-by-slack
command_line /usr/local/bin/nagios-slack-notify.sh "$NOTIFICATIONTYPE$" "$SERVICEDESC$" "$HOSTALIAS$" "$SERVICESTATE$" "$SERVICEOUTPUT$"
}
Task E: Custom Plugin
#!/bin/bash
# /usr/lib/nagios/plugins/check_api_health — Custom API health check plugin
# Usage: check_api_health -u <url> -w <warn_ms> -c <crit_ms>
URL=""
WARN=1000
CRIT=3000
while getopts "u:w:c:" opt; do
case $opt in
u) URL="$OPTARG" ;;
w) WARN="$OPTARG" ;;
c) CRIT="$OPTARG" ;;
esac
done
START=$(date +%s%N)
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 "$URL")
END=$(date +%s%N)
DURATION=$(( (END - START) / 1000000 ))
if [ "$RESPONSE" != "200" ]; then
echo "CRITICAL - HTTP $RESPONSE from $URL | response_time=${DURATION}ms"
exit 2
elif [ "$DURATION" -gt "$CRIT" ]; then
echo "CRITICAL - Response time ${DURATION}ms > ${CRIT}ms | response_time=${DURATION}ms"
exit 2
elif [ "$DURATION" -gt "$WARN" ]; then
echo "WARNING - Response time ${DURATION}ms > ${WARN}ms | response_time=${DURATION}ms"
exit 1
else
echo "OK - Response time ${DURATION}ms | response_time=${DURATION}ms"
exit 0
fi
# Verify configuration before reloading
sudo nagios4 -v /etc/nagios4/nagios.cfg
sudo systemctl reload nagios4
Best Practices
- Always run
nagios -vto verify config before reloading to prevent outages - Use NRPE for remote checks that need local access (disk, CPU, memory)
- Set
max_check_attempts> 1 to avoid alerting on transient failures - Use hostgroups and servicegroups to apply checks to multiple hosts at once
- Output performance data (
| metric=value) from plugins for graphing integration - Use
check_intervalandretry_intervalto balance monitoring granularity with load