Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
最もシンプルなPHPでのpluginの作成例
<?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
You can’t perform that action at this time.