{"id":501,"date":"2019-02-22T03:12:16","date_gmt":"2019-02-22T03:12:16","guid":{"rendered":"https:\/\/monyog.jp\/?p=501"},"modified":"2019-03-07T02:22:36","modified_gmt":"2019-03-07T02:22:36","slug":"monyog-api%e3%81%ae%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/smart-style.main.jp\/monyogjp\/static\/document\/501\/index.html","title":{"rendered":"SQL Diagnostic Manager API\u306e\u4f7f\u7528"},"content":{"rendered":"
\u30d9\u30fc\u30b9\u306eURL\u3067\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092SQL Diagnostic Manager\u306b\u6e21\u3059\u3053\u3068\u306b\u3088\u308a\u3001API\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002<\/p>\n
\u4f8b\u3048\u3070\u3001SQL Diagnostic Manager\u304cIP 192.168.1.1\u306e\u30b7\u30b9\u30c6\u30e0\u3067\u7a3c\u50cd\u3057\u3066\u3044\u308b\u5834\u5408\u3001\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306f\u6b21\u306eURL\u306b\u6e21\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\uff1ahttp:\/\/192.168.1.1:5555\/<\/p>\n
HTTP\u30e1\u30bd\u30c3\u30c9\u306eGET\u3068POST\u306e\u3044\u305a\u308c\u304b\u3092\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n
\u6e21\u3059\u5fc5\u8981\u304c\u3042\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\uff1a<\/p>\n
<\/p>\n
API\u3092\u7528\u3044\u3066SQL Diagnostic Manager\u3067\u30b5\u30fc\u30d0\u30fc\u3092\u7ba1\u7406\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092\u6e21\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\uff1a<\/p>\n
\u4f8b\u3048\u3070\u3001\u30b5\u30fc\u30d0\u30fc\u3092\u8ffd\u52a0\u3059\u308b\u305f\u3081\u306b\u306f\uff1a<\/p>\n
\r\n$ curl "192.168.1.1:5555\/?_object=MONyogAPI&_action=addserver&_user=admin\r\n &_server=Production&_mysqlhost=127.0.0.1&_mysqluser=admin\r\n &_mysqlport=3306&_mysqlpassword=adminpassword"\r\n<\/pre>\n\u30b5\u30fc\u30d0\u30fc\u767b\u9332\u7528\u306e\u8ffd\u52a0\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092\u3053\u3053\u306b\u4e00\u89a7\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n
\u4f8b\u3048\u3070\u3001Production001\u3068\u3044\u3046\u540d\u524d\u306e\u30b5\u30fc\u30d0\u30fc\u3092SQL Diagnostic Manager\u306b\u767b\u9332\u3057\u305f\u3068\u3057\u307e\u3059\u3002HTTP GET\u30e1\u30bd\u30c3\u30c9\u306b\u3088\u308b\u3053\u306e\u30b5\u30fc\u30d0\u30fc\u306e\u30c7\u30fc\u30bf\u53ce\u96c6\u3092\u505c\u6b62\u3059\u308b\u5834\u5408\u306eURL\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\uff1a<\/p>\n
$ curl \u201chttp:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=DataCollection\r\n &_value=disable&_password=mypassword&_server=Production001\u201d\r\n<\/pre>\ncurl\u3067\u4f7f\u7528\u3067\u304d\u308b\u5404\u7a2eURL\u3092\u4ee5\u4e0b\u306b\u307e\u3068\u3081\u307e\u3059\uff1a<\/p>\n
<server<\/strong> name>\u306e\u30c7\u30fc\u30bf\u53ce\u96c6\u3092\u958b\u59cb\u3059\u308b<\/h3>\n
\r\n$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=DataCollection\r\n &_value=enable&_user=admin&_password=Password&_server=Production001"\r\n<\/pre>\n<multiples<\/strong> servers>\u306e\u30c7\u30fc\u30bf\u53ce\u96c6\u3092\u958b\u59cb\u3059\u308b<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=DataCollection\r\n &_value=enable&_user=admin&_password=Password&_server=Production001,Test"\r\n<\/pre>\n<server<\/strong> name>\uff08\u30d7\u30ed\u30c0\u30af\u30b7\u30e7\u30f3\u306e\u30b9\u30ec\u30fc\u30d6\uff09\u306e\u30c7\u30fc\u30bf\u53ce\u96c6\u3092\u7d42\u4e86\u3059\u308b<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=DataCollection\r\n &_value=disable&_user=admin&_password=Password&_server=Slave+Of+Production"\r\n<\/pre>\n<tag>\u306e\u30c7\u30fc\u30bf\u53ce\u96c6\u3092\u958b\u59cb\u3059\u308b<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=DataCollection\r\n &_value=enable&_user=admin&_password=Password&_tag=Production"\r\n<\/pre>\n<tag>\u306e\u30c7\u30fc\u30bf\u53ce\u96c6\u3092\u7d42\u4e86\u3059\u308b<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=DataCollection\r\n &_value=disable&_user=admin&_password=Password&_tag=Production"\r\n<\/pre>\n\u3059\u3079\u3066\u306e\u30b5\u30fc\u30d0\u30fc\u306e\u30c7\u30fc\u30bf\u53ce\u96c6\u3092\u30b0\u30ed\u30fc\u30d0\u30eb\u306b\u505c\u6b62\u3059\u308b\uff08\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\uff09<\/h3>\n
$ curl \u201chttp:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=datacollection&_value=disable&_user=admin&_password="<\/pre>\n\u3059\u3079\u3066\u306e\u30b5\u30fc\u30d0\u30fc\u306e\u30c7\u30fc\u30bf\u53ce\u96c6\u3092\u30b0\u30ed\u30fc\u30d0\u30eb\u306b\u958b\u59cb\u3059\u308b\uff08\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\uff09<\/h3>\n
$ curl \u201chttp:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=datacollection&_value=enable&_user=admin&_password="<\/pre>\n<server<\/strong> name>\u306e\u30a2\u30e9\u30fc\u30c8\u3092\u6709\u52b9\u306b\u3059\u308b<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=Alerts\r\n &_value=enable&_user=admin&_password=Password&_server=Production001"\r\n<\/pre>\n<server<\/strong> name>\u306e\u30a2\u30e9\u30fc\u30c8\u3092\u7121\u52b9\u306b\u3059\u308b<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=Alerts\r\n &_value=disable&_user=admin&_password=Password&_server=Production001"\r\n<\/pre>\n<tag>\u306e\u30a2\u30e9\u30fc\u30c8\u3092\u6709\u52b9\u306b\u3059\u308b<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=Alerts\r\n &_value=enable&_user=admin&_password=Password&_tag=Production"\r\n<\/pre>\n<tag>\u306e\u30a2\u30e9\u30fc\u30c8\u3092\u7121\u52b9\u306b\u3059\u308b<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=Alerts\r\n &_value=disable&_user=admin&_password=Password&_tag=Production"\r\n<\/pre>\n\u3059\u3079\u3066\u306e\u30b5\u30fc\u30d0\u30fc\u306e\u30a2\u30e9\u30fc\u30c8\u3092\u30b0\u30ed\u30fc\u30d0\u30eb\u306b\u7121\u52b9\u3059\u308b\uff08\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\uff09<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=Alerts&_value=disable&_user=admin&_password="<\/pre>\n\u3059\u3079\u3066\u306e\u30b5\u30fc\u30d0\u30fc\u306e\u30a2\u30e9\u30fc\u30c8\u3092\u30b0\u30ed\u30fc\u30d0\u30eb\u306b\u6709\u52b9\u3059\u308b\uff08\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\uff09<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=Alerts&_value=enable&_user=admin&_password="<\/pre>\n<server<\/strong> name>\u306e\u30b9\u30cb\u30c3\u30d5\u30a1\u30fc\u3092\u6709\u52b9\u306b\u3059\u308b<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=sniffer\r\n &_value=enable&_server=Production001"\r\n<\/pre>\n<server<\/strong> name>\u306e\u30b9\u30cb\u30c3\u30d5\u30a1\u30fc\u3092\u7121\u52b9\u306b\u3059\u308b<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=sniffer\r\n &_value=disable&_server=Production001"\r\n<\/pre>\n\u30b5\u30fc\u30d0\u30fc\u3092\u8ffd\u52a0\u3059\u308b<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=addserver\r\n &_mysqluser=msandbox&_mysqlhost=127.0.0.1&_mysqlport=3306&_tags=Production\r\n &_server=Test&_mysqlpassword=msandbox&_connectontype=direct\r\n &_user=admin&_password=Password"\r\n<\/pre>\nSSH\u30c8\u30f3\u30cd\u30eb\u4ed8\u304d\u30b5\u30fc\u30d0\u30fc\u3092\u8ffd\u52a0\u3059\u308b<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=addserver\r\n &_mysqluser=msandbox&_mysqlhost=127.0.0.1&_mysqlport=3306\r\n &_tags=Production&_server=Test&_mysqlpassword=msandbox\r\n &_connectiontype=ssh&_sshhost=192.168.1.86&_sshuser=username\r\n &_sshpassword=sshpassword&_sshport=22&_user=admin&_password=Password"\r\n<\/pre>\n\u30b5\u30fc\u30d0\u30fc\u3092\u7de8\u96c6\u3059\u308b<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=editserver\r\n &_mysqluser=msandbox&_mysqlhost=127.0.0.1&_mysqlport=3306\r\n &_tags=Production&_server=Test&_mysqlpassword=msandbox\r\n &_connectontype=direct&_user=admin&_password=Password"\r\n<\/pre>\n\u30b5\u30fc\u30d0\u30fc\u3092\u524a\u9664\u3059\u308b<\/h3>\n
$ curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=removeserver&_server=Test"<\/pre>\n<tag>\u306e\u4e0b\u306e\u3059\u3079\u3066\u306e\u30b5\u30fc\u30d0\u30fc\u3092\u524a\u9664\u3059\u308b<\/h3>\n
curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=removeserver&_tag=Production\u201d<\/pre>\n\u8907\u6570\u306e\u30b5\u30fc\u30d0\u30fc\u3092\u524a\u9664\u3059\u308b<\/h3>\n
curl "http:\/\/192.168.1.1:5555\/?_object=MONyogAPI&_action=removeserver&_server=Server1,Server2\u201d<\/pre>\n\u30b3\u30fc\u30c9\u3092\u8fd4\u3059<\/h3>\n
SQL Diagnostic Manager\u3068\u306e\u63a5\u7d9a\u306b\u6210\u529f\u3059\u308b\u3068\u3001SQL Diagnostic Manager\u306f\u30c6\u30ad\u30b9\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8fd4\u3057\u307e\u3059\u3002\u30e1\u30c3\u30bb\u30fc\u30b8\u306fJSON\u5f62\u5f0f\u3067\u3059\uff1a<\/p>\n
{\u201cSTATUS\u201d: \u201cSUCCESS\/FAILURE\u201d, \u201cRESPONSE\u201d : \u201c<Response text>\u201d}<\/pre>\n\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u3053\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u69cb\u6587\u89e3\u6790\u3057\u3066\u3001\u64cd\u4f5c\u304c\u6210\u529f\u3057\u305f\u304b\u3069\u3046\u304b\u3092\u5224\u5b9a\u3057\u307e\u3059\u3002<\/p>\n
\u6ce8\u610f<\/h4>\n
\u30d0\u30fc\u30b8\u30e7\u30f35.21\u4ee5\u964d\u3001_object=ConnectionMgr\u306b\u5bfe\u3059\u308bAPI\u30b3\u30fc\u30eb\u3092\u975e\u63a8\u5968\u306b\u3057\u307e\u3057\u305f\u3002\u4ee3\u308f\u308a\u306b\u3001_object=MONyogAPI\u3092\u4f7f\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n
\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3<\/h2>\n
Monyog API\u306f\u3001\u67d4\u8edf\u6027\u306b\u5bcc\u307f\u3001Perl\u3001VBScript\u306a\u3069\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u8a00\u8a9e\u3068\u3044\u3063\u305f\u4ed6\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002\u4ee5\u4e0b\u306b\u793a\u3057\u305f\u306e\u306f\u3001\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u304b\u3089\u5fc5\u8981\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092\u627f\u8a8d\u3057\u3001\u6307\u5b9a\u3055\u308c\u305f\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3059\u308b\u6c4e\u7528\u6027\u306e\u9ad8\u3044Perl\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u3059\u3002<\/p>\n
#! \/usr\/bin\/perl\r\nuse LWP 5.64;\r\n# USAGE: MONyog.pl <hostname>:<port> <user> <password> <connection_name\/ID> <action> <value>\r\n# $ARGV[0] = hostname:port of server running Monyog\r\n# $ARGV[1] = Monyog user\r\n# $ARGV[2] = Monyog password\r\n# $ARGV[3] = connection name\r\n# $ARGV[4] = action\r\n# $ARGV[5] = value\r\nmy $numArgs = $#ARGV + 1;\r\nif($numArgs < 5) {\r\n die 'USAGE: MONyog.pl <hostname>:<port> <user> <password> <connection_name\/ID> <action>';\r\n}\r\n\r\nmy $browser = LWP::UserAgent->new;\r\n\r\n# The request URL\r\nmy $url = URI->new('http:\/\/' . $ARGV[0] . '\/');\r\n\r\n# The form data pairs:\r\n$url->query_form(\r\n '_object' => 'MONyogAPI',\r\n '_action' => $ARGV[4],\r\n '_user' => $ARGV[1]\r\n '_password' => $ARGV[2],\r\n '_server' => $ARGV[3],\r\n '_value' => $ARGV[5]\r\n);\r\n\r\n# The response object\r\n$response = $browser->post($url);\r\n\r\nif (!$response->is_success) {# Error connecting to MONyog\r\n die $response->status_line . "\\n";\r\n} else { \r\n\r\n # Successfully connected to MONyog; print MONyog's response\r\n print $response->content . "\\n";\r\n\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"\u30d9\u30fc\u30b9\u306eURL\u3067\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3092SQL Diagnostic Mana… <\/p>\n