{"id":140,"date":"2011-07-21T22:26:53","date_gmt":"2011-07-21T13:26:53","guid":{"rendered":"http:\/\/seedslight.com\/wp\/?p=140"},"modified":"2011-07-31T18:00:34","modified_gmt":"2011-07-31T09:00:34","slug":"zabbix%e3%81%a7%e6%9d%b1%e4%ba%ac%e9%9b%bb%e5%8a%9b%e3%81%ae%e9%81%8e%e5%8e%bb%e5%88%86%e3%81%ae%e5%80%a4%e3%82%92%e5%85%a5%e3%82%8c%e3%82%8b%e6%ba%96%e5%82%99","status":"publish","type":"post","link":"https:\/\/seedslight.com\/wp\/archives\/140","title":{"rendered":"zabbix\u3067\u6771\u4eac\u96fb\u529b\u306e\u904e\u53bb\u5206\u306e\u5024\u3092\u5165\u308c\u308b\u6e96\u5099"},"content":{"rendered":"<p><a href=\"https:\/\/seedslight.com\/wp\/archives\/135\">\u3053\u308c\u306e\u7d9a\u304d\u3067\u3059\u3002<\/a> <\/p>\n<p><a href=\"https:\/\/seedslight.com\/wp\/archives\/129\">\u3053\u308c<\/a>\u3067\u904e\u53bb\u306e\u5206\u3092\u5165\u308c\u308b\u3088\u3046\u306a\u30d0\u30c3\u30c1\u3092\u4f5c\u308b\u304b\u306a\u3068 \u66f8\u3044\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u3044\u3056\u59cb\u3081\u3066\u307f\u308b\u3068\u4e8b\u524d\u8abf\u67fb\u304c\u5fc5\u8981\u3060\u3063\u305f\u308a\u3057\u305f\u306e\u3067\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.tepco.co.jp\/forecast\/html\/images\/juyo-2011.csv\">http:\/\/www.tepco.co.jp\/forecast\/html\/images\/juyo-2011.csv<\/a><br \/>\n\u3053\u3053\u304b\u30892011\u5e74\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong>\u3053\u306e\u4f5c\u696d\u3092\u884c\u3046\u306b\u3042\u305f\u3063\u3066\u3001\u5fc3\u69cb\u3048\u3068\u3057\u3066\u306f<\/p>\n<blockquote><p>\n\u30fb\u904b\u7528\u4e2d\u306ezabbix\u304c\u4e0d\u5b89\u5b9a\u306b\u306a\u308b\u899a\u609f\u3092\u3059\u308b\u3002<br \/>\n\u30fb\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u53d6\u3063\u305f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u306a\u3051\u308c\u3070\u3001\u904e\u53bb\u30c7\u30fc\u30bf\u306f\u3059\u3079\u3066\u7834\u68c4\u3059\u308b\u899a\u609f\u3002<br \/>\n\u30fb\u4f5c\u696d\u3092\u884c\u3063\u305f\u76f4\u5f8c\u306f\u554f\u984c\u304c\u306a\u304b\u3063\u305f\u3068\u3057\u3066\u3082\u3001\u7279\u6b8a\u306a\u30c7\u30fc\u30bf\u3084\u72b6\u6cc1\u304c\u767a\u751f\u3057\u305f\u6642\u306b\u3001\u30c7\u30fc\u30bf\u7834\u640d\u3057\u3066\u3057\u307e\u3046\u3053\u3068\u3092\u53d7\u3051\u5165\u308c\u308b\u899a\u609f\u3002\n<\/p><\/blockquote>\n<p>\u3053\u308c\u3089\u306e\u3053\u3068\u304c\u8a31\u5bb9\u3067\u304d\u308b\u74b0\u5883\u306e\u6301\u3061\u4e3b\u304b\u3001\u3069\u3046\u306b\u3082\u305b\u3063\u3071\u3064\u307e\u3063\u3066\u3044\u3066\u3001\u4e0a\u8a18\u306e\u30ea\u30b9\u30af\u306b\u6bd4\u3079\u305f\u3089\u76f8\u5f53\u306b\u81f4\u547d\u7684\u306a\u72b6\u6cc1\u307e\u3067\u8ffd\u3044\u8fbc\u307e\u308c\u3066\u3044\u308b\u4eba\u3058\u3083\u306a\u3044\u9650\u308a\u3001\u3084\u3089\u306a\u3044\u307b\u3046\u304c\u826f\u3044\u4f5c\u696d\u3060\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u3002\u203b\u6280\u8853\u529b\u5411\u4e0a\u306e\u305f\u3081\u306b\u3084\u308c\u308b\u306a\u3089\u5e78\u305b\u304b\u3082\u3067\u3059\u304c\u3002<\/p>\n<p><!--more--><br \/>\n\u25a0\u30c7\u30fc\u30bf\u306e\u633f\u5165\u5148\u3067\u3042\u308btrends\u30c6\u30fc\u30d6\u30eb\u3092\u8abf\u67fb<br \/>\n\u307e\u305a\u306f\u30c6\u30fc\u30d6\u30eb\u3092\u898b\u3064\u3051\u307e\u3057\u305f\u3002trends \u30c6\u30fc\u30d6\u30eb\u3068trends_unit \u3067\u3059\u3002\u4f7f\u3044\u5206\u3051\u306f\u3069\u3046\u306a\u306e\u304b\uff1f\u4f55\u3092\u5165\u308c\u308b\u3079\u304d\u304b\u3092\u8abf\u3079\u307e\u3057\u305f\u3002<\/p>\n<pre lang=\"plsql\" line=\"0\">\r\n public | trends                    | table    | zabbix\r\n public | trends_uint               | table    | zabbix\r\n<\/pre>\n<p>\u25a0\u30c6\u30fc\u30d6\u30eb\u69cb\u9020<\/p>\n<pre lang=\"plsql\" line=\"0\">\r\n zabbix=# \\d trends\r\n                 Table \"public.trends\"\r\n  Column   |     Type      |         Modifiers          \r\n-----------+---------------+----------------------------\r\n itemid    | bigint        | not null default 0::bigint\r\n clock     | integer       | not null default 0\r\n num       | integer       | not null default 0\r\n value_min | numeric(16,4) | not null default 0.0000\r\n value_avg | numeric(16,4) | not null default 0.0000\r\n value_max | numeric(16,4) | not null default 0.0000\r\nIndexes:\r\n    \"trends_pkey\" PRIMARY KEY, btree (itemid, clock)\r\n\r\nzabbix=# \\d trends_uint\r\n               Table \"public.trends_uint\"\r\n  Column   |     Type      |          Modifiers          \r\n-----------+---------------+-----------------------------\r\n itemid    | bigint        | not null default 0::bigint\r\n clock     | integer       | not null default 0\r\n num       | integer       | not null default 0\r\n value_min | numeric(20,0) | not null default 0::numeric\r\n value_avg | numeric(20,0) | not null default 0::numeric\r\n value_max | numeric(20,0) | not null default 0::numeric\r\nIndexes:\r\n    \"trends_uint_pkey\" PRIMARY KEY, btree (itemid, clock)\r\n<\/pre>\n<p>\nitemid \u306f\u30a2\u30a4\u30c6\u30e0\u3068\u7d10\u3065\u304f\u3068\u3053\u308d\u3067\u3057\u3087\u3046\u3057\u3001clock\u306f1\u6642\u9593\u3054\u3068\u306e\u6642\u9593\u304c\u5165\u3063\u3066\u3044\u308b\u306f\u305a\u3067\u3059\u3002<br \/>\nvalue_*\u306f\u305d\u308c\u305e\u308c\u3001\u5024\u304c\u5165\u3063\u3066\u3044\u308b\u3068\u3053\u308d\u306f\u30b0\u30e9\u30d5\u306a\u3069\u3067\u898b\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u4e0d\u601d\u8b70\u306a\u306e\u306f\u3001num \u3067\u3059\u3002\u3053\u308c\u306f\u4f55\u8005?\u4f55\u306b\u4f7f\u3046\u306e?\u3063\u3066\u3044\u3046\u3053\u3068\u304c\u5206\u304b\u3089\u306a\u3044\u3068\u30d0\u30c3\u30c1\u3067\u5165\u308c\u308b\u306a\u3093\u3066\u3067\u304d\u306a\u3044\u3068\u601d\u3044\u307e\u3057\u305f\u306e\u3067\u8abf\u3079\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u305a\u306f\u3001\u524d\u56de\u3067\u4f5c\u3063\u305f\u96fb\u529b\u4f7f\u7528\u91cf\u3068\u4f7f\u7528\u7387\u306e\u30a2\u30a4\u30c6\u30e0\u304b\u3089\u3001\u3069\u3093\u306a\u5024\u304c\u5165\u3063\u3066\u3044\u308b\u304b\u3092\u8abf\u3079\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u25a0\u73fe\u5728\u306e\u30c7\u30fc\u30bf\u304b\u3089\u5bfe\u8c61\u306eitemid \u3092\u898b\u3064\u3051\u308b\u3002<\/p>\n<p>itmes \u30c6\u30fc\u30d6\u30eb\u306e\u69cb\u9020\u3067\u3059\u3002\u50d5\u306fkey_\u306b\u306f\u56fa\u5b9a\u6587\u8a00\u304c\u5165\u308b\u3068\u601d\u3063\u305f\u306e\u3067like \u3067\u63a2\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<pre lang=\"plsql\" line=\"0\">\r\nzabbix=# \\d items\r\n                                   Table \"public.items\"\r\n        Column         |          Type          |                Modifiers                \r\n-----------------------+------------------------+-----------------------------------------\r\n itemid                | bigint                 | not null default 0::bigint\r\n type                  | integer                | not null default 0\r\n snmp_community        | character varying(64)  | not null default ''::character varying\r\n snmp_oid              | character varying(255) | not null default ''::character varying\r\n snmp_port             | integer                | not null default 161\r\n hostid                | bigint                 | not null default 0::bigint\r\n description           | character varying(255) | not null default ''::character varying\r\n key_                  | character varying(255) | not null default ''::character varying\r\n delay                 | integer                | not null default 0\r\n history               | integer                | not null default 90\r\n trends                | integer                | not null default 365\r\n lastvalue             | character varying(255) | \r\n lastclock             | integer                | \r\n prevvalue             | character varying(255) | \r\n status                | integer                | not null default 0\r\n value_type            | integer                | not null default 0\r\n trapper_hosts         | character varying(255) | not null default ''::character varying\r\n units                 | character varying(10)  | not null default ''::character varying\r\n multiplier            | integer                | not null default 0\r\n delta                 | integer                | not null default 0\r\n prevorgvalue          | character varying(255) | \r\n snmpv3_securityname   | character varying(64)  | not null default ''::character varying\r\n snmpv3_securitylevel  | integer                | not null default 0\r\n snmpv3_authpassphrase | character varying(64)  | not null default ''::character varying\r\n snmpv3_privpassphrase | character varying(64)  | not null default ''::character varying\r\n formula               | character varying(255) | not null default '1'::character varying\r\n error                 | character varying(128) | not null default ''::character varying\r\n lastlogsize           | integer                | not null default 0\r\n logtimefmt            | character varying(64)  | not null default ''::character varying\r\n templateid            | bigint                 | not null default 0::bigint\r\n valuemapid            | bigint                 | not null default 0::bigint\r\n delay_flex            | character varying(255) | not null default ''::character varying\r\n params                | text                   | not null default ''::text\r\n ipmi_sensor           | character varying(128) | not null default ''::character varying\r\n data_type             | integer                | not null default 0\r\n authtype              | integer                | not null default 0\r\n username              | character varying(64)  | not null default ''::character varying\r\n password              | character varying(64)  | not null default ''::character varying\r\n publickey             | character varying(64)  | not null default ''::character varying\r\n privatekey            | character varying(64)  | not null default ''::character varying\r\n mtime                 | integer                | not null default 0\r\nIndexes:\r\n    \"items_pkey\" PRIMARY KEY, btree (itemid)\r\n    \"items_1\" UNIQUE, btree (hostid, key_)\r\n    \"items_3\" btree (status)\r\n    \"items_4\" btree (templateid)\r\n<\/pre>\n<p>WHERE key_ like &#8216;%denki%&#8217;\u3000\u306b\u3066\u3001\u30a2\u30a4\u30c6\u30e0\u3092\u63a2\u3057\u307e\u3057\u305f\u3002SQL\u53e9\u304b\u305a\u306b\u3001Pgadmin\u306a\u3069\u4f7f\u3063\u3066\u8abf\u3079\u305f\u307b\u3046\u304c\u65e9\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001CUI\u3067\u3067\u304d\u308b\u3068\u3053\u308d\u307e\u3067\u3084\u308b\u306e\u304c\u7656\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre lang=\"plsql\" line=\"0\">\r\nzabbix=#  SELECT itemid,type,key_,trends,units,data_type FROM items WHERE key_ like '%denki%';\r\n itemid | type |         key_         | trends | units | data_type \r\n--------+------+----------------------+--------+-------+-----------\r\n  22497 |    0 | denki.value[min,20]  |    365 | w     |         0\r\n  22498 |    0 | denki.value[rate,20] |    365 | %     |         0\r\n(2 rows)\r\n<\/pre>\n<p>\u3042\u3063\u3055\u308a\u3068\u898b\u3064\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u300122497(\u4f7f\u7528\u91cf)\u304c\u5165\u3063\u3066\u3044\u308b\u30c6\u30fc\u30d6\u30eb\u3068\u300122498\uff08\u4f7f\u7528\u7387)\u304c\u5165\u3063\u3066\u3044\u308b\u30c6\u30fc\u30d6\u30eb\u306f\u9055\u3044\u307e\u3057\u305f\u3002<\/p>\n<pre lang=\"plsql\" line=\"0\">\r\nzabbix=# SELECT * FROM trends WHERE itemid IN (22497,22498) LIMIT 5;\r\n itemid |   clock    | num | value_min | value_avg | value_max \r\n--------+------------+-----+-----------+-----------+-----------\r\n  22498 | 1309870800 |  10 |   71.1900 |   72.2360 |   73.6000\r\n  22498 | 1309867200 |   1 |   71.8500 |   71.8500 |   71.8500\r\n  22498 | 1309874400 |  10 |   65.9000 |   68.3120 |   70.8200\r\n  22498 | 1309878000 |   1 |   64.4200 |   64.4200 |   64.4200\r\n  22498 | 1309881600 |  10 |   56.0000 |   57.2920 |   58.6800\r\n(5 rows)\r\n<\/pre>\n<p>\u203b\u96fb\u6c17\u4f7f\u7528\u91cf\u304c\u306a\u3044<\/p>\n<pre lang=\"plsql\" line=\"0\">\r\nzabbix=# SELECT * FROM trends WHERE itemid = 22497 LIMIT 5;\r\n itemid | clock | num | value_min | value_avg | value_max \r\n--------+-------+-----+-----------+-----------+-----------\r\n(0 rows)\r\n<\/pre>\n<p>\u25a0trends_uint\u306b\u3042\u3063\u305f\u3002<\/p>\n<pre lang=\"plsql\" line=\"0\">\r\nzabbix=# SELECT * FROM trends_uint WHERE itemid = 22497 LIMIT 5;\r\n itemid |   clock    | num | value_min | value_avg | value_max \r\n--------+------------+-----+-----------+-----------+-----------\r\n  22497 | 1309705200 |   2 |      3124 |      3138 |      3153\r\n  22497 | 1309708800 |   9 |      2759 |      2842 |      2926\r\n  22497 | 1309712400 |  11 |      2652 |      2701 |      2765\r\n  22497 | 1309716000 |  11 |      2610 |      2628 |      2661\r\n  22497 | 1309719600 |  11 |      2598 |      2610 |      2631\r\n(5 rows)\r\n\r\n\u203b\u9014\u4e2d\u304b\u3089\u500d\u6570\u3067\u8abf\u6574\u3057\u305f\u306e\u3067\u3053\u3093\u306a\u5f62\r\n  22497 | 1309816800 |  11 |        2896 |        3033 |        3163\r\n  22497 | 1309820400 |  11 |        3171 |  6377275424 | 35300000000\r\n  22497 | 1309824000 |  11 | 35640000000 | 37525454543 | 38930000000\r\n  22497 | 1309827600 |  11 | 39300000000 | 40225454543 | 41030000000\r\n  22497 | 1309831200 |  11 | 41080000000 | 41630909090 | 42060000000\r\n<\/pre>\n<p>\u25a0num\u3063\u3066\u306a\u3093\u3060\u308d\u3046\uff1f<br \/>\n\u3053\u3053\u3067\u7591\u554f\u306b\u308f\u3044\u305f\u306e\u304cnum \u3068\u3044\u3046\u30ab\u30e9\u30e0\u306e\u5b58\u5728\u3002\u4e0b\u8a18\u306e\u3088\u3046\u306b\u8981\u7d20\u3092\u3068\u3063\u3066\u307f\u308b\u3068\u898b\u4e8b\u306b\u30d0\u30e9\u30d0\u30e9\u3002<\/p>\n<pre lang=\"plsql\" line=\"0\">\r\nzabbix=# SELECT DISTINCT(num) FROM trends_uint WHERE itemid = 22497 ;\r\n num \r\n-----\r\n   6\r\n  14\r\n  13\r\n  12\r\n   8\r\n   1\r\n   9\r\n   2\r\n   7\r\n  10\r\n  11\r\n(11 rows)\r\n<\/pre>\n<p>\u3069\u3046\u3082\u300111\u304c\u4e00\u756a\u6570\u3068\u3057\u3066\u591a\u3044\u307f\u305f\u3044\u306a\u3093\u3060\u3051\u308c\u3069\u3001\u3069\u3046\u3044\u3046\u3053\u3068\u306a\u306e\u304b\u8abf\u3079\u3066\u307f\u305f\u3002<\/p>\n<pre lang=\"plsql\" line=\"0\">\r\nzabbix=# SELECT * FROM trends_uint WHERE itemid = 22497 ORDER BY num LIMIT 1000;\r\n itemid |   clock    | num |  value_min  |  value_avg  |  value_max  \r\n--------+------------+-----+-------------+-------------+-------------\r\n  22497 | 1309964400 |   1 | 32430000000 | 32430000000 | 32430000000\r\n  22497 | 1311001200 |   1 | 34480000000 | 34480000000 | 34480000000\r\n  22497 | 1310914800 |   1 | 34060000000 | 34060000000 | 34060000000\r\n  22497 | 1310482800 |   1 | 34380000000 | 34380000000 | 34380000000\r\n  22497 | 1310396400 |   1 | 35040000000 | 35040000000 | 35040000000\r\n  22497 | 1310050800 |   1 | 32070000000 | 32070000000 | 32070000000\r\n  22497 | 1310223600 |   1 | 33750000000 | 33750000000 | 33750000000\r\n  22497 | 1309878000 |   1 | 32920000000 | 32920000000 | 32920000000\r\n  22497 | 1310828400 |   1 | 34100000000 | 34100000000 | 34100000000\r\n  22497 | 1310742000 |   1 | 35110000000 | 35110000000 | 35110000000\r\n  22497 | 1310137200 |   1 | 34010000000 | 34010000000 | 34010000000\r\n  22497 | 1311087600 |   1 | 32810000000 | 32810000000 | 32810000000\r\n  22497 | 1310655600 |   1 | 33910000000 | 33910000000 | 33910000000\r\n  22497 | 1311174000 |   1 | 29820000000 | 29820000000 | 29820000000\r\n  22497 | 1310569200 |   1 | 33990000000 | 33990000000 | 33990000000\r\n  22497 | 1309957200 |   2 | 35770000000 | 35940000000 | 36110000000\r\n  22497 | 1309705200 |   2 |        3124 |        3138 |        3153\r\n  22497 | 1310310000 |   2 | 32530000000 | 32530000000 | 32530000000\r\n  22497 | 1309791600 |   6 |        3365 |        3431 |        3509\r\n  22497 | 1310839200 |   7 | 27350000000 | 27595714284 | 27790000000\r\n  22497 | 1309932000 |   7 | 41850000000 | 42101428570 | 42450000000\r\n  22497 | 1310832000 |   8 | 29840000000 | 30376249998 | 31070000000\r\n  22497 | 1309881600 |   8 | 28560000000 | 29143749998 | 29930000000\r\n  22497 | 1310313600 |   8 | 28400000000 | 28967499999 | 29700000000\r\n  22497 | 1310486400 |   9 | 29870000000 | 30479999999 | 31380000000\r\n  22497 | 1311091200 |   9 | 28990000000 | 29528888888 | 30210000000\r\n  22497 | 1311004800 |   9 | 30090000000 | 30679999999 | 31410000000\r\n  22497 | 1310918400 |   9 | 29640000000 | 30312222220 | 31110000000\r\n  22497 | 1310659200 |   9 | 29110000000 | 29816666664 | 30650000000\r\n  22497 | 1310140800 |   9 | 29440000000 | 30132222221 | 30970000000\r\n  22497 | 1311177600 |   9 | 26230000000 | 26672222220 | 27180000000\r\n  22497 | 1310572800 |   9 | 29450000000 | 30109999999 | 30740000000\r\n  22497 | 1310745600 |   9 | 30890000000 | 31497777776 | 32360000000\r\n  22497 | 1310227200 |   9 | 29270000000 | 29926666664 | 30620000000\r\n  22497 | 1309708800 |   9 |        2759 |        2842 |        2926\r\n  22497 | 1309867200 |   9 | 36720000000 | 37706666665 | 38800000000\r\n  22497 | 1310400000 |   9 | 30060000000 | 30735555553 | 31630000000\r\n  22497 | 1310054400 |   9 | 28040000000 | 28655555554 | 29480000000\r\n  22497 | 1309896000 |  10 | 26080000000 | 26327999998 | 26560000000\r\n  22497 | 1309921200 |  10 | 40230000000 | 40942999998 | 42040000000\r\n  22497 | 1309928400 |  10 | 42430000000 | 42492999999 | 42580000000\r\n  22497 | 1309924800 |  10 | 40530000000 | 41782999998 | 42450000000\r\n  22497 | 1309910400 |  10 | 36680000000 | 38296999997 | 39570000000\r\n  22497 | 1309917600 |  10 | 41180000000 | 41622999999 | 42000000000\r\n  22497 | 1309914000 |  10 | 39790000000 | 40484999999 | 41060000000\r\n  22497 | 1309906800 |  10 | 32420000000 | 34408999998 | 36450000000\r\n  22497 | 1309870800 |  10 | 36380000000 | 36914999998 | 37610000000\r\n  22497 | 1309874400 |  10 | 33680000000 | 34942999998 | 36190000000\r\n  22497 | 1309885200 |  10 | 27350000000 | 27858999997 | 28590000000\r\n  22497 | 1309888800 |  10 | 26680000000 | 26885999999 | 27110000000\r\n  22497 | 1309892400 |  10 | 26320000000 | 26544999997 | 26680000000\r\n  22497 | 1310180400 |  11 | 40940000000 | 41366363633 | 41800000000\r\n  22497 | 1310184000 |  11 | 41110000000 | 41846363634 | 42270000000\r\n  22497 | 1310187600 |  11 | 42300000000 | 42451818180 | 42670000000\r\n  22497 | 1310191200 |  11 | 42110000000 | 42299090908 | 42560000000\r\n  22497 | 1310194800 |  11 | 41710000000 | 41991818180 | 42210000000\r\n  22497 | 1310198400 |  11 | 40270000000 | 40909999998 | 41820000000\r\n  22497 | 1310202000 |  11 | 39630000000 | 39877272725 | 40180000000\r\n  22497 | 1310205600 |  11 | 39770000000 | 40109090906 | 40450000000\r\n  22497 | 1310209200 |  11 | 38650000000 | 39257272726 | 39960000000\r\n  22497 | 1310212800 |  11 | 36770000000 | 37688181815 | 38590000000\r\n  22497 | 1310216400 |  11 | 36120000000 | 36916363634 | 37840000000\r\n  22497 | 1310220000 |  11 | 34350000000 | 35370909089 | 36560000000\r\n  22497 | 1310230800 |  11 | 27820000000 | 28470909089 | 29180000000\r\n  22497 | 1310234400 |  11 | 27050000000 | 27359999997 | 27850000000\r\n  22497 | 1310238000 |  11 | 26420000000 | 26810909088 | 27110000000\r\n  22497 | 1309903200 |  11 | 29490000000 | 30714545453 | 32140000000\r\n  22497 | 1310414400 |  12 | 27170000000 | 27545833331 | 28050000000\r\n  22497 | 1310306400 |  12 | 33490000000 | 34488333332 | 35700000000\r\n  22497 | 1311141600 |  12 | 40330000000 | 40657499997 | 41020000000\r\n  22497 | 1310932800 |  12 | 27360000000 | 27613333330 | 27950000000\r\n  22497 | 1310727600 |  12 | 41290000000 | 42091666664 | 42810000000\r\n  22497 | 1311199200 |  12 | 26430000000 | 27009999998 | 27460000000\r\n  22497 | 1310475600 |  12 | 37710000000 | 38419999997 | 39190000000\r\n  22497 | 1309899600 |  13 | 26660000000 | 27809999997 | 29480000000\r\n  22497 | 1310515200 |  13 | 38640000000 | 40651538458 | 42020000000\r\n  22497 | 1310101200 |  13 | 41300000000 | 41459230766 | 41650000000\r\n  22497 | 1309996800 |  14 | 34030000000 | 35414285711 | 36800000000\r\n<\/pre>\n<p>1\u306e\u6642\u306b\u306fvalue_min,value_avg,value_max \u304c\u540c\u3058\u6570\u5b57\u3002<br \/>\n2\u306b\u3082value\u304c\u540c\u3058\u3082\u306e\u306f\u3042\u308b\u3057\u30016\uff0c7\uff0c8\uff0c9\uff0c10\u306f\u6cd5\u5247\u3059\u3089\u30d1\u30c3\u3068\u898b\u3066\u308f\u304b\u3089\u306a\u3044\u3002<br \/>\n11\u306f\u4e00\u756a\u591a\u304f\u3001\u5272\u611b\u300212,13,14\u3082\u3042\u308b\u3051\u308c\u3069\u3084\u3063\u3071\u308a\u4e0d\u660e\u3002<\/p>\n<p>\u25a0trends \u304c\u5165\u3063\u3066\u3044\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u63a2\u3059\u3002<br \/>\nzabbix-1.8.4\u306e\u30bd\u30fc\u30b9\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u306e\u3067\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u3066\u3001<br \/>\n# fgrep -R &#8216;trends&#8217; .\/*<br \/>\n\u3053\u3093\u306a\u611f\u3058\u3067\u63a2\u3057\u305f\u3002<\/p>\n<pre lang=\"text\" line=\"0\">\r\n.\/create\/data\/data.sql:insert into help_items values (5,'zabbix[trends]','Number of values stored in table TRENDS.');\r\n.\/create\/data\/data.sql:insert into help_items values (5,'zabbix[trends_uint]','Number of values stored in table TRENDS_UINT.');\r\n\r\n.\/frontends\/php\/api\/classes\/class.citem.php:                            'trends',\r\n.\/frontends\/php\/api\/classes\/class.citem.php:                            'trends_uint',\r\n\r\n.\/src\/libs\/zbxdbcache\/dbcache.c:        value_type = trends[0].value_type;\r\n.\/src\/libs\/zbxdbcache\/dbcache.c:        case ITEM_VALUE_TYPE_FLOAT: table_name = \"trends\"; break;\r\n.\/src\/libs\/zbxdbcache\/dbcache.c:        case ITEM_VALUE_TYPE_UINT64: table_name = \"trends_uint\"; break;\r\n.\/src\/libs\/zbxdbcache\/dbcache.c:                zbx_error(\"Unsupported value type for trends\");\r\n.\/src\/libs\/zbxdbcache\/dbcache.c:        for (i = 0; i < *trends_num; i++)\r\n.\/src\/libs\/zbxdbcache\/dbcache.c:                trend = &#038;trends[i];\r\n.\/src\/libs\/zbxdbcache\/dbcache.c:                        trends_to = i + 1;\r\n.\/src\/libs\/zbxdbcache\/dbcache.c:                        for (i = 0; i < trends_to; i++)\r\n.\/src\/libs\/zbxdbcache\/dbcache.c:                                trend = &#038;trends[i];\r\n.\/src\/libs\/zbxdbcache\/dbcache.c:                        if (i == trends_to)\r\n.\/src\/libs\/zbxdbcache\/dbcache.c:                        \/* if 'trends' is not a primary trends buffer *\/\r\n\r\n\u25a0\u4e00\u756a\u6709\u529b\r\n.\/src\/libs\/zbxdbhigh\/db.c:      result = DBselect(\"select num,value_min,value_avg,value_max from trends where itemid=\" ZBX_FS_UI64 \" and clock=%d\",\r\n\r\n.\/src\/libs\/zbxdbhigh\/db.c:              DBexecute(\"update trends set num=%d, value_min=\" ZBX_FS_DBL \", value_avg=\" ZBX_FS_DBL \", value_max=\" ZBX_FS_DBL \" where itemid=\" ZBX_FS_UI64 \" and clock=%d\",\r\n.\/src\/libs\/zbxdbhigh\/db.c:              DBexecute(\"insert into trends (clock,itemid,num,value_min,value_avg,value_max) values (%d,\" ZBX_FS_UI64 \",%d,\" ZBX_FS_DBL \",\" ZBX_FS_DBL \",\" ZBX_FS_DBL \")\",\r\n.\/src\/libs\/zbxdbhigh\/db.c:      result = DBselect(\"select num,value_min,value_avg,value_max from trends_uint where itemid=\" ZBX_FS_UI64 \" and clock=%d\",\r\n.\/src\/libs\/zbxdbhigh\/db.c:              DBexecute(\"update trends_uint set num=%d,value_min=\" ZBX_FS_UI64 \",value_avg=\" ZBX_FS_UI64 \",value_max=\" ZBX_FS_UI64 \" where itemid=\" ZBX_FS_UI64 \" and clock=%d\",\r\n.\/src\/libs\/zbxdbhigh\/db.c:              DBexecute(\"insert into trends_uint (clock,itemid,num,value_min,value_avg,value_max) values (%d,\" ZBX_FS_UI64 \",%d,\" ZBX_FS_UI64 \",\" ZBX_FS_UI64 \",\" ZBX_FS_UI64 \")\",\r\n<\/pre>\n<pre lang=\"C\" line=\"0\">\r\n\u25a0\u6838\u5fc3\u3002\r\nint     DBadd_trend(zbx_uint64_t itemid, double value, int clock)\r\n{\r\n        DB_RESULT       result;\r\n        DB_ROW          row;\r\n        int     hour;\r\n        int     num;\r\n        double  value_min, value_avg, value_max;\r\n\r\n        zabbix_log(LOG_LEVEL_DEBUG,\"In add_trend()\");\r\n\r\n        hour=clock-clock%3600;\r\n\r\n        result = DBselect(\"select num,value_min,value_avg,value_max from trends where itemid=\" ZBX_FS_UI64 \" and clock=%d\",\r\n                itemid,\r\n                hour);\r\n\r\n        row=DBfetch(result);\r\n\r\n        if(row)\r\n        {\r\n                num=atoi(row[0]);\r\n                value_min=atof(row[1]);\r\n                value_avg=atof(row[2]);\r\n                value_max=atof(row[3]);\r\n                if(value<value_min)     value_min=value;\r\n                if(value>value_max)     value_max=value;\r\n                value_avg=(num*value_avg+value)\/(num+1);\r\n                num++;\r\n                DBexecute(\"update trends set num=%d, value_min=\" ZBX_FS_DBL \", value_avg=\" ZBX_FS_DBL \", value_max=\" ZBX_FS_DBL \" where itemid=\" ZBX_FS_UI64 \" and clock=%d\",\r\n                        num,\r\n                        value_min,\r\n                        value_avg,\r\n                        value_max,\r\n                        itemid,\r\n                        hour);\r\n        }\r\n        else\r\n        {\r\n                DBexecute(\"insert into trends (clock,itemid,num,value_min,value_avg,value_max) values (%d,\" ZBX_FS_UI64 \",%d,\" ZBX_FS_DBL \",\" ZBX_FS_DBL \",\" ZBX_FS_DBL \")\",\r\n                        hour,\r\n                        itemid,\r\n                        1,\r\n                        value,\r\n                        value,\r\n                        value);\r\n        }\r\n\r\n        DBfree_result(result);\r\n\r\n        return SUCCEED;\r\n<\/pre>\n<p>\u3053\u306e\u90e8\u5206\u3092\u898b\u308b\u3068\u3001\u4eca\u307e\u3067\u306e\u30c7\u30fc\u30bf\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3001num \u3092\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3057\u3066\u3044\u308b\u3002\u3064\u307e\u308a\u3001\u4f55\u56de\u3082\u3053\u306e\u30c7\u30fc\u30bf\u306fUPDATE\u3055\u308c\u308b\u3068\u3044\u3046\u3053\u3068\u3002<br \/>\n\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3055\u308c\u305f\u56de\u6570\u3092\u8868\u3057\u3066\u3044\u308b\u306e\u306a\u3089\u3001\u7d0d\u5f97\u3002\u3053\u306e\u30a2\u30a4\u30c6\u30e0\u306f5\u5206\u304a\u304d\u306b\u53d6\u5f97\u3057\u3066\u3044\u308b\u306e\u3067\u300111\u56de\u306f55\u5206\u3068\u306a\u308b\u3002\u304d\u3063\u3061\u308a12\u56de\u3068\u3044\u3046\u306e\u3082\u3042\u308b\u3060\u308d\u3046\u3057\u3001\u305d\u308c\u4ee5\u4e0a\u3068\u3044\u3046\u306e\u306f\u3001\u3061\u3087\u3063\u3068\u983b\u5ea6\u591a\u304f\u3068\u3063\u3066\u3057\u307e\u3063\u305f\u304b\u3089\u3060\u308d\u3046\u3002<\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u30c6\u30fc\u30d6\u30eb\u306e\u69cb\u9020\u304c\u5206\u304b\u3063\u305f\u306e\u3067\u3001\u5b89\u5fc3\u3057\u3066insert\u6642\u306bnum = 1 \u3067\u5165\u308c\u3089\u308c\u307e\u3059\u3002<br \/>\n\u4eca\u5f8c\u3082\u5165\u308c\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u305d\u306e\u6642\u306f\u3001\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u8a08\u7b97\u3059\u308b\u306e\u304c\u9762\u5012\u304f\u3055\u3044\u306e\u3067\u3001\u30b9\u30c8\u30a2\u30c9\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u3092\u4f7f\u3063\u3066\u3001clock\u3068itemid\u3001value\u3092\u6e21\u3057\u3066\u30c1\u30a7\u30c3\u30af\u3068\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\u3001\u5e73\u5747\u5024\u8a08\u7b97\u3092\u3059\u308b\u3088\u3046\u306b\u3068\u304b\u601d\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>7\/31 \u8ffd\u8a18<br \/>\n<a href=\"https:\/\/seedslight.com\/wp\/archives\/144\">\u7d9a\u304d\u3067\u3059\u3002<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u308c\u306e\u7d9a\u304d\u3067\u3059\u3002 \u3053\u308c\u3067\u904e\u53bb\u306e\u5206\u3092\u5165\u308c\u308b\u3088\u3046\u306a\u30d0\u30c3\u30c1\u3092\u4f5c\u308b\u304b\u306a\u3068 \u66f8\u3044\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u3044\u3056\u59cb\u3081\u3066\u307f\u308b\u3068\u4e8b\u524d\u8abf\u67fb\u304c\u5fc5\u8981\u3060\u3063\u305f\u308a\u3057\u305f\u306e\u3067\u307e\u3068\u3081\u307e\u3059\u3002 http:\/\/www.tepco.co.jp\/forecast\/html\/i [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,32],"tags":[94,51],"class_list":["post-140","post","type-post","status-publish","format-standard","hentry","category-unixserver","category-zabbix","tag-zabbix","tag-51"],"_links":{"self":[{"href":"https:\/\/seedslight.com\/wp\/wp-json\/wp\/v2\/posts\/140","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seedslight.com\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seedslight.com\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seedslight.com\/wp\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/seedslight.com\/wp\/wp-json\/wp\/v2\/comments?post=140"}],"version-history":[{"count":0,"href":"https:\/\/seedslight.com\/wp\/wp-json\/wp\/v2\/posts\/140\/revisions"}],"wp:attachment":[{"href":"https:\/\/seedslight.com\/wp\/wp-json\/wp\/v2\/media?parent=140"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seedslight.com\/wp\/wp-json\/wp\/v2\/categories?post=140"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seedslight.com\/wp\/wp-json\/wp\/v2\/tags?post=140"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}