Last active
March 19, 2019 09:01
-
-
Save soudai/24be22106cedfec2b70590013f3b864d to your computer and use it in GitHub Desktop.
最もシンプルなPHPでのpluginの作成例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$time = time(); | |
$value = rand(5, 50); | |
$value1 = rand(5, 50); | |
$value2 = rand(5, 50); | |
$value3 = rand(5, 50); | |
$metric_name = 'random.count'; | |
echo "{$metric_name}\t{$value}\t{$time}\n"; | |
echo "{$metric_name}_1\t{$value1}\t{$time}\n"; | |
echo "{$metric_name}_2\t{$value2}\t{$time}\n"; | |
echo "{$metric_name}_3\t{$value3}\t{$time}\n"; | |
/* | |
$ vim /etc/mackerel-agent/mackerel-agent.conf | |
# 末尾に追記 | |
[plugin.metrics.soudai-agent-test-random] | |
command = "/usr/bin/php /usr/local/etc/hatena/monitoring_test.php" | |
# mackerel-agentを再起動するとカスタムメトリックに追加される | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment