Skip to content

Instantly share code, notes, and snippets.

@soudai
Last active March 19, 2019 09:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soudai/24be22106cedfec2b70590013f3b864d to your computer and use it in GitHub Desktop.
Save soudai/24be22106cedfec2b70590013f3b864d to your computer and use it in GitHub Desktop.
最もシンプルな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