SlideShare a Scribd company logo
KOWAZA
for Mackerel
id:karupanerura
Mackerel Meetup #7 LT
KOWAZA means small trick
in Japanese
about me
• id:karupanerura (twitter/github)
• Perl/Go/Swift/Kotlin/Java/JS/etc..
• Senior Engineer at Mobile Factoy, Inc.
• Join to Infrastructure Team since 2016/02
• Director at Japan Perl Association (JPA)
mackerel with me
• Mackerel contributer
• mackerel-agent-plugins (gearman)
• mackerel-check—plugins (masterha, ssh)
• Mackerel UG Organizer ← NEW
monitor processes
check-procs -p mysqld
Wait…
(In my environment)
MySQL is stopped
to backup at 5am-6am.
🤔
true && echo “true” || echo “false”
😙
[ 5 -le “$hour” -and “$hour” -le 6 ]
&& echo “OK check-procs: In shutdown”
|| check-procs -p mysqld
😎
monitor logs
grep foo /path/to/log
| grep bar
| grep -v baz
| wc -l
check-log plugin
check-log
-f /path/to/log
-p foo
-p bar
-E baz
-c 1
Wait…
check-log
-f /path/to/log
-p foo
-p bar ←Cannot do it :(
-E baz
-c 1
🤔
check-log
-f <(grep foo /path/to/log)
-p bar
-E baz
-c 1
😙
grep foo /path/to/log
| check-log
-f /dev/stdin
-p bar
-E baz
-c 1
😎
monitor mouts
Should mount a HDD
as readable & writable
(If mount with errors=remout-ro)
When the HDD is breaking,
re-mount the HDD readonly
monitor with Mackerel
# XXX: exit code 2 is CRITICAL
touch /tmp/write-test.watch
|| exit 2
But, hackish…
no kind message outputs…
🤔
check-log -f /proc/mounts
-p ' ro(,|$)’
--no-state
😙
Let’s hack Mackerel !!
😎

More Related Content

KOWAZA for mackerel