claude-plugin-wordpress-manager 1.9.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +7 -3
- package/CHANGELOG.md +30 -0
- package/agents/wp-cicd-engineer.md +194 -0
- package/agents/wp-monitoring-agent.md +184 -0
- package/agents/wp-performance-optimizer.md +1 -0
- package/agents/wp-security-auditor.md +1 -0
- package/agents/wp-site-manager.md +2 -0
- package/docs/plans/2026-02-28-cicd-v2.0.0.md +375 -0
- package/package.json +9 -3
- package/skills/wordpress-router/references/decision-tree.md +7 -3
- package/skills/wp-audit/SKILL.md +1 -0
- package/skills/wp-cicd/SKILL.md +119 -0
- package/skills/wp-cicd/references/bitbucket-pipelines-wordpress.md +142 -0
- package/skills/wp-cicd/references/deploy-strategies.md +164 -0
- package/skills/wp-cicd/references/github-actions-wordpress.md +183 -0
- package/skills/wp-cicd/references/gitlab-ci-wordpress.md +189 -0
- package/skills/wp-cicd/references/quality-gates.md +215 -0
- package/skills/wp-cicd/references/secrets-management.md +175 -0
- package/skills/wp-cicd/references/wp-env-ci.md +135 -0
- package/skills/wp-cicd/scripts/cicd_inspect.mjs +183 -0
- package/skills/wp-deploy/SKILL.md +4 -0
- package/skills/wp-e2e-testing/SKILL.md +4 -0
- package/skills/wp-monitoring/SKILL.md +121 -0
- package/skills/wp-monitoring/references/alerting-strategies.md +205 -0
- package/skills/wp-monitoring/references/content-integrity.md +188 -0
- package/skills/wp-monitoring/references/performance-baseline.md +169 -0
- package/skills/wp-monitoring/references/reporting-templates.md +207 -0
- package/skills/wp-monitoring/references/security-scanning.md +168 -0
- package/skills/wp-monitoring/references/uptime-checks.md +140 -0
- package/skills/wp-monitoring/scripts/monitoring_inspect.mjs +259 -0
- package/skills/wp-phpstan/SKILL.md +4 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Reporting Templates
|
|
2
|
+
|
|
3
|
+
## Daily Health Summary
|
|
4
|
+
|
|
5
|
+
```markdown
|
|
6
|
+
## Daily Health Report — [site-name]
|
|
7
|
+
**Date:** [YYYY-MM-DD] | **Status:** [✅ Healthy / ⚠️ Degraded / ❌ Down]
|
|
8
|
+
|
|
9
|
+
### Uptime
|
|
10
|
+
- HTTP status: [200 OK / error code]
|
|
11
|
+
- Response time: [X.Xs] (threshold: < 3s)
|
|
12
|
+
- SSL expires in: [X days]
|
|
13
|
+
- WP-Cron last run: [timestamp]
|
|
14
|
+
|
|
15
|
+
### Quick Metrics
|
|
16
|
+
| Metric | Value | Status |
|
|
17
|
+
|--------|-------|--------|
|
|
18
|
+
| Active plugins | X | [✅ / ⚠️ outdated] |
|
|
19
|
+
| Pending updates | X | [✅ / ⚠️] |
|
|
20
|
+
| Spam comments (24h) | X | [✅ / ⚠️] |
|
|
21
|
+
| Pending moderation | X | [✅ / ⚠️] |
|
|
22
|
+
|
|
23
|
+
### Alerts (last 24h)
|
|
24
|
+
- [Alert summary or "No alerts"]
|
|
25
|
+
|
|
26
|
+
### Action Required
|
|
27
|
+
- [ ] [Any urgent items]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Weekly Performance Report
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
## Weekly Performance Report — [site-name]
|
|
34
|
+
**Period:** [start-date] to [end-date]
|
|
35
|
+
|
|
36
|
+
### Core Web Vitals
|
|
37
|
+
| Metric | Mon | Tue | Wed | Thu | Fri | Sat | Sun | Avg | Target | Status |
|
|
38
|
+
|--------|-----|-----|-----|-----|-----|-----|-----|-----|--------|--------|
|
|
39
|
+
| LCP (s) | — | — | — | — | — | — | — | — | ≤ 2.5 | ✅/⚠️/❌ |
|
|
40
|
+
| INP (ms) | — | — | — | — | — | — | — | — | ≤ 200 | ✅/⚠️/❌ |
|
|
41
|
+
| CLS | — | — | — | — | — | — | — | — | ≤ 0.1 | ✅/⚠️/❌ |
|
|
42
|
+
| TTFB (ms) | — | — | — | — | — | — | — | — | ≤ 800 | ✅/⚠️/❌ |
|
|
43
|
+
|
|
44
|
+
### Uptime Summary
|
|
45
|
+
- Availability: [XX.X%]
|
|
46
|
+
- Total downtime: [Xm Xs]
|
|
47
|
+
- Incidents: [count]
|
|
48
|
+
- Average response time: [Xms]
|
|
49
|
+
|
|
50
|
+
### Plugin Health
|
|
51
|
+
| Status | Count |
|
|
52
|
+
|--------|-------|
|
|
53
|
+
| Up to date | X |
|
|
54
|
+
| Update available | X |
|
|
55
|
+
| Security update | X |
|
|
56
|
+
|
|
57
|
+
### Content Activity
|
|
58
|
+
- Posts published: X
|
|
59
|
+
- Posts modified: X
|
|
60
|
+
- Comments received: X
|
|
61
|
+
- Spam blocked: X
|
|
62
|
+
|
|
63
|
+
### Trend vs Last Week
|
|
64
|
+
| Metric | Last Week | This Week | Delta |
|
|
65
|
+
|--------|-----------|-----------|-------|
|
|
66
|
+
| Avg LCP | X.Xs | X.Xs | [+/-X%] |
|
|
67
|
+
| Avg TTFB | Xms | Xms | [+/-X%] |
|
|
68
|
+
| Lighthouse score | XX | XX | [+/-X] |
|
|
69
|
+
| Plugin count | X | X | [+/-X] |
|
|
70
|
+
|
|
71
|
+
### Recommendations
|
|
72
|
+
1. [Priority action based on trends]
|
|
73
|
+
2. [Secondary action]
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Monthly Security Report
|
|
77
|
+
|
|
78
|
+
```markdown
|
|
79
|
+
## Monthly Security Report — [site-name]
|
|
80
|
+
**Period:** [month YYYY]
|
|
81
|
+
|
|
82
|
+
### Security Posture Summary
|
|
83
|
+
| Area | Status | Details |
|
|
84
|
+
|------|--------|---------|
|
|
85
|
+
| WordPress Core | [✅ current / ⚠️ update available] | v[X.X.X] |
|
|
86
|
+
| PHP Version | [✅ current / ⚠️ outdated] | v[X.X] |
|
|
87
|
+
| Plugins | [✅ / ⚠️ X outdated] | X active, X inactive |
|
|
88
|
+
| SSL Certificate | [✅ valid / ⚠️ expiring] | Expires [date] |
|
|
89
|
+
| File Integrity | [✅ clean / ❌ modified] | [details] |
|
|
90
|
+
| User Accounts | [✅ / ⚠️ review needed] | X admins, X total |
|
|
91
|
+
|
|
92
|
+
### Vulnerability Summary
|
|
93
|
+
| Severity | Count | Resolved | Outstanding |
|
|
94
|
+
|----------|-------|----------|-------------|
|
|
95
|
+
| Critical | X | X | X |
|
|
96
|
+
| High | X | X | X |
|
|
97
|
+
| Medium | X | X | X |
|
|
98
|
+
| Low | X | X | X |
|
|
99
|
+
|
|
100
|
+
### Security Events
|
|
101
|
+
| Date | Event | Severity | Status |
|
|
102
|
+
|------|-------|----------|--------|
|
|
103
|
+
| [date] | [event] | [P0-P3] | [resolved/open] |
|
|
104
|
+
|
|
105
|
+
### Plugin Security Audit
|
|
106
|
+
| Plugin | Version | Latest | CVEs | Status |
|
|
107
|
+
|--------|---------|--------|------|--------|
|
|
108
|
+
| [name] | [ver] | [latest] | [count] | [✅/⚠️/❌] |
|
|
109
|
+
|
|
110
|
+
### User Account Audit
|
|
111
|
+
| Username | Role | Last Login | Status |
|
|
112
|
+
|----------|------|-----------|--------|
|
|
113
|
+
| [user] | [role] | [date] | [✅ active / ⚠️ dormant] |
|
|
114
|
+
|
|
115
|
+
### File Integrity Check
|
|
116
|
+
- Core files verified: [✅ / ❌ X modified]
|
|
117
|
+
- Uploads directory: [✅ clean / ❌ suspicious files]
|
|
118
|
+
- Modified files: [list if any]
|
|
119
|
+
|
|
120
|
+
### Recommendations (Priority Order)
|
|
121
|
+
1. [Most urgent security action]
|
|
122
|
+
2. [Second priority]
|
|
123
|
+
3. [Third priority]
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Quarterly Trend Analysis
|
|
127
|
+
|
|
128
|
+
```markdown
|
|
129
|
+
## Quarterly Trend Analysis — [site-name]
|
|
130
|
+
**Period:** Q[X] [YYYY] ([start-month] to [end-month])
|
|
131
|
+
|
|
132
|
+
### Performance Trend
|
|
133
|
+
| Metric | Month 1 | Month 2 | Month 3 | Trend |
|
|
134
|
+
|--------|---------|---------|---------|-------|
|
|
135
|
+
| Avg LCP | X.Xs | X.Xs | X.Xs | [📈/📉/➡️] |
|
|
136
|
+
| Avg TTFB | Xms | Xms | Xms | [📈/📉/➡️] |
|
|
137
|
+
| Lighthouse Score | XX | XX | XX | [📈/📉/➡️] |
|
|
138
|
+
| Uptime % | XX.X% | XX.X% | XX.X% | [📈/📉/➡️] |
|
|
139
|
+
|
|
140
|
+
### Security Trend
|
|
141
|
+
| Metric | Month 1 | Month 2 | Month 3 | Trend |
|
|
142
|
+
|--------|---------|---------|---------|-------|
|
|
143
|
+
| Vulnerabilities found | X | X | X | [📈/📉/➡️] |
|
|
144
|
+
| Mean time to patch | Xd | Xd | Xd | [📈/📉/➡️] |
|
|
145
|
+
| Security incidents | X | X | X | [📈/📉/➡️] |
|
|
146
|
+
|
|
147
|
+
### Content Growth
|
|
148
|
+
| Metric | Month 1 | Month 2 | Month 3 | Total |
|
|
149
|
+
|--------|---------|---------|---------|-------|
|
|
150
|
+
| Posts published | X | X | X | X |
|
|
151
|
+
| Pages added | X | X | X | X |
|
|
152
|
+
| Media uploaded | X | X | X | X |
|
|
153
|
+
| Comments | X | X | X | X |
|
|
154
|
+
|
|
155
|
+
### Infrastructure Changes
|
|
156
|
+
- [Plugin additions/removals]
|
|
157
|
+
- [Theme changes]
|
|
158
|
+
- [Hosting changes]
|
|
159
|
+
- [PHP/WordPress version upgrades]
|
|
160
|
+
|
|
161
|
+
### Key Insights
|
|
162
|
+
1. [Performance observation with data]
|
|
163
|
+
2. [Security observation with trend]
|
|
164
|
+
3. [Content observation]
|
|
165
|
+
|
|
166
|
+
### Recommendations for Next Quarter
|
|
167
|
+
1. [Strategic recommendation]
|
|
168
|
+
2. [Tactical recommendation]
|
|
169
|
+
3. [Maintenance recommendation]
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Executive Dashboard Format
|
|
173
|
+
|
|
174
|
+
For non-technical stakeholders:
|
|
175
|
+
|
|
176
|
+
```markdown
|
|
177
|
+
## WordPress Site Health — [site-name]
|
|
178
|
+
**Report Date:** [YYYY-MM-DD]
|
|
179
|
+
|
|
180
|
+
### Overall Status: [🟢 Healthy / 🟡 Needs Attention / 🔴 Critical]
|
|
181
|
+
|
|
182
|
+
### Key Numbers
|
|
183
|
+
| | This Period | Previous | Change |
|
|
184
|
+
|---|-----------|----------|--------|
|
|
185
|
+
| 🔒 Security Score | X/10 | X/10 | [+/-X] |
|
|
186
|
+
| ⚡ Speed Score | X/100 | X/100 | [+/-X] |
|
|
187
|
+
| 📈 Uptime | XX.X% | XX.X% | [+/-X%] |
|
|
188
|
+
| 📝 Content Published | X items | X items | [+/-X] |
|
|
189
|
+
|
|
190
|
+
### Attention Required
|
|
191
|
+
- [0-3 bullet points of urgent items in plain language]
|
|
192
|
+
|
|
193
|
+
### Recent Improvements
|
|
194
|
+
- [1-3 bullet points of completed improvements]
|
|
195
|
+
|
|
196
|
+
### Next Steps
|
|
197
|
+
- [1-3 bullet points of planned work]
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Report Delivery Schedule
|
|
201
|
+
|
|
202
|
+
| Report | Frequency | Audience | Channel |
|
|
203
|
+
|--------|-----------|----------|---------|
|
|
204
|
+
| Daily Health | Every morning | DevOps / Site admin | Email / Slack |
|
|
205
|
+
| Weekly Performance | Monday morning | Development team | Email |
|
|
206
|
+
| Monthly Security | 1st of month | Security team + Management | Email + document |
|
|
207
|
+
| Quarterly Trend | End of quarter | Executive / Stakeholders | PDF / presentation |
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Security Scanning
|
|
2
|
+
|
|
3
|
+
## Plugin Vulnerability Checks
|
|
4
|
+
|
|
5
|
+
### WP-CLI Plugin Audit
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# List all plugins with versions
|
|
9
|
+
wp plugin list --fields=name,version,status,update_version --format=table
|
|
10
|
+
|
|
11
|
+
# Check for available updates (potential security fixes)
|
|
12
|
+
wp plugin list --update=available --format=table
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### CVE Database Lookup
|
|
16
|
+
|
|
17
|
+
For each active plugin, check against known vulnerabilities:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Using WPScan API (requires API token)
|
|
21
|
+
curl -s "https://wpscan.com/api/v3/plugins/PLUGIN_SLUG" \
|
|
22
|
+
-H "Authorization: Token token=YOUR_API_TOKEN" | jq '.vulnerabilities'
|
|
23
|
+
|
|
24
|
+
# Using Wordfence vulnerability feed
|
|
25
|
+
curl -s "https://www.wordfence.com/api/intelligence/v2/vulnerabilities/production" | \
|
|
26
|
+
jq --arg plugin "PLUGIN_SLUG" '.[] | select(.software[].slug == $plugin)'
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Automated Plugin Security Check Script
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
#!/bin/bash
|
|
33
|
+
# plugin-security-check.sh — Check plugins against known CVEs
|
|
34
|
+
|
|
35
|
+
SITE_URL="$1"
|
|
36
|
+
ALERT_EMAIL="admin@example.com"
|
|
37
|
+
|
|
38
|
+
# Get list of active plugins via WP-CLI
|
|
39
|
+
PLUGINS=$(wp plugin list --status=active --fields=name,version --format=json --url="$SITE_URL")
|
|
40
|
+
|
|
41
|
+
OUTDATED=$(echo "$PLUGINS" | jq -r '.[] | select(.update_version != null) | "\(.name) \(.version) -> \(.update_version)"')
|
|
42
|
+
|
|
43
|
+
if [ -n "$OUTDATED" ]; then
|
|
44
|
+
echo "Outdated plugins on $SITE_URL:" > /tmp/security-alert.txt
|
|
45
|
+
echo "$OUTDATED" >> /tmp/security-alert.txt
|
|
46
|
+
mail -s "Security: Outdated Plugins on $SITE_URL" "$ALERT_EMAIL" < /tmp/security-alert.txt
|
|
47
|
+
fi
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## File Integrity Monitoring
|
|
51
|
+
|
|
52
|
+
### WordPress Core Verification
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Verify core files against checksums
|
|
56
|
+
wp core verify-checksums
|
|
57
|
+
|
|
58
|
+
# Check for modified core files
|
|
59
|
+
wp core verify-checksums 2>&1 | grep -v "Success"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Custom File Hash Baseline
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
#!/bin/bash
|
|
66
|
+
# file-integrity-baseline.sh — Create/compare file hash baseline
|
|
67
|
+
|
|
68
|
+
WP_ROOT="$1"
|
|
69
|
+
BASELINE_FILE="$WP_ROOT/.file-integrity-baseline.sha256"
|
|
70
|
+
|
|
71
|
+
if [ "$2" == "--create" ]; then
|
|
72
|
+
# Create baseline
|
|
73
|
+
find "$WP_ROOT" -type f \
|
|
74
|
+
\( -name "*.php" -o -name "*.js" -o -name ".htaccess" \) \
|
|
75
|
+
-not -path "*/wp-content/uploads/*" \
|
|
76
|
+
-not -path "*/wp-content/cache/*" \
|
|
77
|
+
-exec sha256sum {} \; | sort > "$BASELINE_FILE"
|
|
78
|
+
echo "Baseline created: $(wc -l < "$BASELINE_FILE") files"
|
|
79
|
+
else
|
|
80
|
+
# Compare against baseline
|
|
81
|
+
CURRENT=$(mktemp)
|
|
82
|
+
find "$WP_ROOT" -type f \
|
|
83
|
+
\( -name "*.php" -o -name "*.js" -o -name ".htaccess" \) \
|
|
84
|
+
-not -path "*/wp-content/uploads/*" \
|
|
85
|
+
-not -path "*/wp-content/cache/*" \
|
|
86
|
+
-exec sha256sum {} \; | sort > "$CURRENT"
|
|
87
|
+
|
|
88
|
+
DIFF=$(diff "$BASELINE_FILE" "$CURRENT")
|
|
89
|
+
if [ -n "$DIFF" ]; then
|
|
90
|
+
echo "FILE INTEGRITY ALERT:"
|
|
91
|
+
echo "$DIFF"
|
|
92
|
+
else
|
|
93
|
+
echo "All files match baseline"
|
|
94
|
+
fi
|
|
95
|
+
rm "$CURRENT"
|
|
96
|
+
fi
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## User Account Anomaly Detection
|
|
100
|
+
|
|
101
|
+
Monitor for suspicious user activity via WP REST Bridge:
|
|
102
|
+
|
|
103
|
+
1. **New admin accounts** — `list_users` with `roles: "administrator"`, compare count with baseline
|
|
104
|
+
2. **Unknown accounts** — Compare user list with known/approved users
|
|
105
|
+
3. **Role escalation** — Track user roles over time, alert on changes
|
|
106
|
+
|
|
107
|
+
### Check Script
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Count administrators
|
|
111
|
+
wp user list --role=administrator --format=count
|
|
112
|
+
|
|
113
|
+
# List all admins with last login (if tracked)
|
|
114
|
+
wp user list --role=administrator --fields=ID,user_login,user_email,user_registered --format=table
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Malware Scanning
|
|
118
|
+
|
|
119
|
+
### WP-CLI Based Scan
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Search for common malware patterns in PHP files
|
|
123
|
+
grep -rn "eval(base64_decode\|eval(gzinflate\|eval(str_rot13\|preg_replace.*e'" \
|
|
124
|
+
--include="*.php" /path/to/wordpress/
|
|
125
|
+
|
|
126
|
+
# Check for suspicious files in uploads
|
|
127
|
+
find /path/to/wordpress/wp-content/uploads -name "*.php" -type f
|
|
128
|
+
|
|
129
|
+
# Check for hidden files
|
|
130
|
+
find /path/to/wordpress -name ".*" -type f -not -name ".htaccess" -not -name ".maintenance"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Core File Comparison
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Download fresh WordPress and compare
|
|
137
|
+
wp core download --path=/tmp/fresh-wp --version=$(wp core version) --skip-content
|
|
138
|
+
diff -rq /path/to/wordpress/wp-includes /tmp/fresh-wp/wp-includes | grep "differ"
|
|
139
|
+
diff -rq /path/to/wordpress/wp-admin /tmp/fresh-wp/wp-admin | grep "differ"
|
|
140
|
+
rm -rf /tmp/fresh-wp
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## WordPress Core Version Tracking
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Current version
|
|
147
|
+
wp core version
|
|
148
|
+
|
|
149
|
+
# Check for updates
|
|
150
|
+
wp core check-update --format=json
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Alert thresholds:
|
|
154
|
+
- **Info**: Minor update available (e.g., 6.4.1 → 6.4.2)
|
|
155
|
+
- **Warning**: Major update available (e.g., 6.4 → 6.5)
|
|
156
|
+
- **Critical**: Security release available (check release notes)
|
|
157
|
+
|
|
158
|
+
## Scanning Schedule
|
|
159
|
+
|
|
160
|
+
| Scan Type | Frequency | Method |
|
|
161
|
+
|-----------|-----------|--------|
|
|
162
|
+
| Plugin update check | Daily | WP-CLI / WP REST Bridge |
|
|
163
|
+
| Core verify checksums | Weekly | WP-CLI |
|
|
164
|
+
| File integrity check | Daily | Hash comparison script |
|
|
165
|
+
| Admin user audit | Weekly | WP REST Bridge list_users |
|
|
166
|
+
| Malware scan | Weekly | grep patterns + file check |
|
|
167
|
+
| Core version check | Daily | WP-CLI |
|
|
168
|
+
| Full vulnerability scan | Monthly | WPScan API or Wordfence |
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Uptime Checks
|
|
2
|
+
|
|
3
|
+
## HTTP Health Probe
|
|
4
|
+
|
|
5
|
+
### Basic HTTP Check
|
|
6
|
+
|
|
7
|
+
Verify the site responds with HTTP 200:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Simple uptime check
|
|
11
|
+
curl -s -o /dev/null -w "%{http_code} %{time_total}s" https://example.com
|
|
12
|
+
|
|
13
|
+
# With timeout and follow redirects
|
|
14
|
+
curl -sL -o /dev/null -w "%{http_code} %{time_total}s %{time_connect}s" \
|
|
15
|
+
--connect-timeout 10 --max-time 30 https://example.com
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Expected: HTTP 200, response time < 3s.
|
|
19
|
+
|
|
20
|
+
### WordPress REST API Health
|
|
21
|
+
|
|
22
|
+
Check the REST API is responsive:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# REST API discovery
|
|
26
|
+
curl -s https://example.com/wp-json/ | jq '.name, .url'
|
|
27
|
+
|
|
28
|
+
# Specific endpoint check
|
|
29
|
+
curl -s -o /dev/null -w "%{http_code}" https://example.com/wp-json/wp/v2/posts?per_page=1
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Custom Health Endpoint
|
|
33
|
+
|
|
34
|
+
Create a lightweight health check mu-plugin:
|
|
35
|
+
|
|
36
|
+
```php
|
|
37
|
+
<?php
|
|
38
|
+
/**
|
|
39
|
+
* Plugin Name: Health Check Endpoint
|
|
40
|
+
* Description: Lightweight health endpoint for monitoring.
|
|
41
|
+
*/
|
|
42
|
+
add_action('rest_api_init', function () {
|
|
43
|
+
register_rest_route('monitoring/v1', '/health', [
|
|
44
|
+
'methods' => 'GET',
|
|
45
|
+
'callback' => function () {
|
|
46
|
+
global $wpdb;
|
|
47
|
+
$db_ok = (bool) $wpdb->get_var('SELECT 1');
|
|
48
|
+
return [
|
|
49
|
+
'status' => $db_ok ? 'ok' : 'degraded',
|
|
50
|
+
'timestamp' => gmdate('c'),
|
|
51
|
+
'wp_version' => get_bloginfo('version'),
|
|
52
|
+
'php_version' => PHP_VERSION,
|
|
53
|
+
'db_ok' => $db_ok,
|
|
54
|
+
];
|
|
55
|
+
},
|
|
56
|
+
'permission_callback' => '__return_true',
|
|
57
|
+
]);
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Endpoint: `GET /wp-json/monitoring/v1/health`
|
|
62
|
+
|
|
63
|
+
## SSL Certificate Monitoring
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Check SSL expiry date
|
|
67
|
+
echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null \
|
|
68
|
+
| openssl x509 -noout -enddate
|
|
69
|
+
|
|
70
|
+
# Days until expiry
|
|
71
|
+
EXPIRY=$(echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null \
|
|
72
|
+
| openssl x509 -noout -enddate | cut -d= -f2)
|
|
73
|
+
DAYS=$(( ($(date -d "$EXPIRY" +%s) - $(date +%s)) / 86400 ))
|
|
74
|
+
echo "SSL expires in $DAYS days"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Alert thresholds:
|
|
78
|
+
- **Warning**: < 30 days until expiry
|
|
79
|
+
- **Critical**: < 7 days until expiry
|
|
80
|
+
|
|
81
|
+
## Cron-Based Scheduling
|
|
82
|
+
|
|
83
|
+
### System Cron (Recommended for Production)
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Disable WP-Cron (add to wp-config.php)
|
|
87
|
+
define('DISABLE_WP_CRON', true);
|
|
88
|
+
|
|
89
|
+
# System cron every 5 minutes
|
|
90
|
+
*/5 * * * * curl -s https://example.com/wp-cron.php > /dev/null 2>&1
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Monitoring Cron Script
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
#!/bin/bash
|
|
97
|
+
# monitor-site.sh — Run from cron every 5 minutes
|
|
98
|
+
|
|
99
|
+
SITE_URL="https://example.com"
|
|
100
|
+
ALERT_EMAIL="admin@example.com"
|
|
101
|
+
LOG_FILE="/var/log/wp-monitor.log"
|
|
102
|
+
|
|
103
|
+
HTTP_CODE=$(curl -sL -o /dev/null -w "%{http_code}" --connect-timeout 10 --max-time 30 "$SITE_URL")
|
|
104
|
+
RESPONSE_TIME=$(curl -sL -o /dev/null -w "%{time_total}" --connect-timeout 10 --max-time 30 "$SITE_URL")
|
|
105
|
+
|
|
106
|
+
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
107
|
+
|
|
108
|
+
echo "$TIMESTAMP status=$HTTP_CODE time=${RESPONSE_TIME}s" >> "$LOG_FILE"
|
|
109
|
+
|
|
110
|
+
if [ "$HTTP_CODE" != "200" ]; then
|
|
111
|
+
echo "ALERT: $SITE_URL returned HTTP $HTTP_CODE at $TIMESTAMP" | \
|
|
112
|
+
mail -s "Site Down: $SITE_URL" "$ALERT_EMAIL"
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
# Slow response alert (> 5 seconds)
|
|
116
|
+
if (( $(echo "$RESPONSE_TIME > 5.0" | bc -l) )); then
|
|
117
|
+
echo "SLOW: $SITE_URL took ${RESPONSE_TIME}s at $TIMESTAMP" | \
|
|
118
|
+
mail -s "Slow Response: $SITE_URL" "$ALERT_EMAIL"
|
|
119
|
+
fi
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## WP REST Bridge Integration
|
|
123
|
+
|
|
124
|
+
Use WP REST Bridge MCP tools for uptime checks:
|
|
125
|
+
|
|
126
|
+
1. `discover_content_types` — verifies API connectivity
|
|
127
|
+
2. `list_content` with `per_page: 1` — confirms database is responding
|
|
128
|
+
3. `list_plugins` — confirms plugin system is functional
|
|
129
|
+
|
|
130
|
+
If any MCP call fails or times out, the site may be down or degraded.
|
|
131
|
+
|
|
132
|
+
## Response Time Thresholds
|
|
133
|
+
|
|
134
|
+
| Metric | Good | Warning | Critical |
|
|
135
|
+
|--------|------|---------|----------|
|
|
136
|
+
| HTTP response | < 1s | 1–3s | > 3s |
|
|
137
|
+
| TTFB | < 600ms | 600ms–1.5s | > 1.5s |
|
|
138
|
+
| REST API | < 2s | 2–5s | > 5s |
|
|
139
|
+
| SSL days remaining | > 30 | 7–30 | < 7 |
|
|
140
|
+
| WP-Cron last run | < 15min | 15min–1h | > 1h |
|