{"action":"created","issue":{"url":"https://api.github.com/repos/ZoneMinder/zoneminder/issues/2229","repository_url":"https://api.github.com/repos/ZoneMinder/zoneminder","labels_url":"https://api.github.com/repos/ZoneMinder/zoneminder/issues/2229/labels{/name}","comments_url":"https://api.github.com/repos/ZoneMinder/zoneminder/issues/2229/comments","events_url":"https://api.github.com/repos/ZoneMinder/zoneminder/issues/2229/events","html_url":"https://github.com/ZoneMinder/zoneminder/issues/2229","id":366076835,"node_id":"MDU6SXNzdWUzNjYwNzY4MzU=","number":2229,"title":"Api method getDiskPercent throw corrupted json","user":{"login":"zhuykovkb","id":8007038,"node_id":"MDQ6VXNlcjgwMDcwMzg=","avatar_url":"https://avatars0.githubusercontent.com/u/8007038?v=4","gravatar_id":"","url":"https://api.github.com/users/zhuykovkb","html_url":"https://github.com/zhuykovkb","followers_url":"https://api.github.com/users/zhuykovkb/followers","following_url":"https://api.github.com/users/zhuykovkb/following{/other_user}","gists_url":"https://api.github.com/users/zhuykovkb/gists{/gist_id}","starred_url":"https://api.github.com/users/zhuykovkb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhuykovkb/subscriptions","organizations_url":"https://api.github.com/users/zhuykovkb/orgs","repos_url":"https://api.github.com/users/zhuykovkb/repos","events_url":"https://api.github.com/users/zhuykovkb/events{/privacy}","received_events_url":"https://api.github.com/users/zhuykovkb/received_events","type":"User","site_admin":false},"labels":[{"id":966103257,"node_id":"MDU6TGFiZWw5NjYxMDMyNTc=","url":"https://api.github.com/repos/ZoneMinder/zoneminder/labels/Under%20Review","name":"Under Review","color":"006b75","default":false},{"id":35646311,"node_id":"MDU6TGFiZWwzNTY0NjMxMQ==","url":"https://api.github.com/repos/ZoneMinder/zoneminder/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-10-02T20:57:42Z","updated_at":"2018-10-03T14:52:25Z","closed_at":null,"author_association":"NONE","body":"I use the latest build:\r\n```\r\nroot@3175d0de62c1:/ZoneMinder# zmaudit.pl -v\r\n1.32.1\r\nroot@3175d0de62c1:/ZoneMinder# git rev-parse HEAD\r\nd2c2fbbfb979a567d348e24c7bd43a6002d1f745\r\nroot@3175d0de62c1:/ZoneMinder# \r\n```\r\n\r\nRunnig in Docker, but it's no matter.\r\n```\r\nroot@3175d0de62c1:/ZoneMinder# lsb_release -a\r\nNo LSB modules are available.\r\nDistributor ID: Ubuntu\r\nDescription:    Ubuntu 16.04.5 LTS\r\nRelease:        16.04\r\nCodename:       xenial\r\nroot@3175d0de62c1:/ZoneMinder# \r\n```\r\n\r\nI try to use Api (https://zoneminder.readthedocs.io/en/stable/api.html#host-apis). That methods works properly:\r\n```\r\nzhuykovkb@home:~$ curl -XGET  https://zm.beget.ru/api/host/daemonCheck.json\r\n{\r\n    \"result\": 1\r\n}zhuykovkb@home:~$ \r\nzhuykovkb@home:~$ curl -XGET  https://zm.beget.ru/api/host/getLoad.json\r\n{\r\n    \"load\": [\r\n        5.03,\r\n        4.83,\r\n        4.72\r\n    ]\r\n}zhuykovkb@home:~$ \r\nzhuykovkb@home:~$ \r\n```\r\nBut when i try to use this, i have:\r\n```\r\nzhuykovkb@home:~$ curl -XGET  https://zm.beget.ru/api/host/getDiskPercent.json\r\n<pre class=\"cake-error\"><a href=\"javascript:void(0);\" onclick=\"document.getElementById('cakeErr5bb3db33b33fe-trace').style.display = (document.getElementById('cakeErr5bb3db33b33fe-trace').style.display == 'none' ? '' : 'none');\"><b>Notice</b> (8)</a>: Undefined index: ZM_DIR_EVENTS [<b>APP/Controller/HostController.php</b>, line <b>114</b>]<div id=\"cakeErr5bb3db33b33fe-trace\" class=\"cake-stack-trace\" style=\"display: none;\"><a href=\"javascript:void(0);\" onclick=\"document.getElementById('cakeErr5bb3db33b33fe-code').style.display = (document.getElementById('cakeErr5bb3db33b33fe-code').style.display == 'none' ? '' : 'none')\">Code</a> <a href=\"javascript:void(0);\" onclick=\"document.getElementById('cakeErr5bb3db33b33fe-context').style.display = (document.getElementById('cakeErr5bb3db33b33fe-context').style.display == 'none' ? '' : 'none')\">Context</a><pre id=\"cakeErr5bb3db33b33fe-code\" class=\"cake-code-dump\" style=\"display: none;\"><code><span style=\"color: #000000\"><span style=\"color: #0000BB\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #DD0000\">'fields'&nbsp;</span><span style=\"color: #007700\">=&gt;&nbsp;array(</span><span style=\"color: #DD0000\">'Name'</span><span style=\"color: #007700\">,&nbsp;</span><span style=\"color: #DD0000\">'Value'</span><span style=\"color: #007700\">)</span></span></code>\r\n<code><span style=\"color: #000000\"><span style=\"color: #0000BB\">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=\"color: #007700\">));</span></span></code>\r\n<span class=\"code-highlight\"><code><span style=\"color: #000000\"><span style=\"color: #0000BB\">&nbsp;&nbsp;&nbsp;&nbsp;$zm_dir_events&nbsp;</span><span style=\"color: #007700\">=&nbsp;</span><span style=\"color: #0000BB\">$zm_dir_events</span><span style=\"color: #007700\">[</span><span style=\"color: #DD0000\">'ZM_DIR_EVENTS'&nbsp;</span><span style=\"color: #007700\">];</span></span></code></span></pre><pre id=\"cakeErr5bb3db33b33fe-context\" class=\"cake-context\" style=\"display: none;\">$mid = null\r\n$zm_dir_events = array()</pre><pre class=\"stack-trace\">HostController::getDiskPercent() - APP/Controller/HostController.php, line 114\r\nReflectionMethod::invokeArgs() - [internal], line ??\r\nController::invokeAction() - CORE/Cake/Controller/Controller.php, line 491\r\nAppController::invokeAction() - APP/Plugin/Crud/Lib/CrudControllerTrait.php, line 31\r\nDispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 193\r\nDispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 167\r\n[main] - APP/webroot/index.php, line 107</pre></div></pre>{\r\n    \"usage\": {\r\n        \"726-1 cam1\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"726-3 door\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"727 table\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"726 storage room\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"727 kicker\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"727 coffeemaker\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"726 trainee1\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"726 trainee2\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"725 cam1\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"725 cam2\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"724 cam1\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"724 cam2\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"717 cam1\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"726-1 cam2 new\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"726-3 nights new\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"727 door new\": {\r\n            \"space\": \"0\",\r\n            \"color\": \"red\"\r\n        },\r\n        \"Total\": {\r\n            \"space\": \"48.230037689209\",\r\n            \"color\": \"#F7464A\"\r\n        }\r\n    }\r\n}zhuykovkb@home:~$ \r\n\r\n```\r\n\r\nIf i should paste another information, tell me, please."},"comment":{"url":"https://api.github.com/repos/ZoneMinder/zoneminder/issues/comments/426667120","html_url":"https://github.com/ZoneMinder/zoneminder/issues/2229#issuecomment-426667120","issue_url":"https://api.github.com/repos/ZoneMinder/zoneminder/issues/2229","id":426667120,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNjY2NzEyMA==","user":{"login":"connortechnology","id":925519,"node_id":"MDQ6VXNlcjkyNTUxOQ==","avatar_url":"https://avatars0.githubusercontent.com/u/925519?v=4","gravatar_id":"","url":"https://api.github.com/users/connortechnology","html_url":"https://github.com/connortechnology","followers_url":"https://api.github.com/users/connortechnology/followers","following_url":"https://api.github.com/users/connortechnology/following{/other_user}","gists_url":"https://api.github.com/users/connortechnology/gists{/gist_id}","starred_url":"https://api.github.com/users/connortechnology/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/connortechnology/subscriptions","organizations_url":"https://api.github.com/users/connortechnology/orgs","repos_url":"https://api.github.com/users/connortechnology/repos","events_url":"https://api.github.com/users/connortechnology/events{/privacy}","received_events_url":"https://api.github.com/users/connortechnology/received_events","type":"User","site_admin":false},"created_at":"2018-10-03T14:52:25Z","updated_at":"2018-10-03T14:52:25Z","author_association":"MEMBER","body":"Looking into this, the function is really bad.  I can't really fix it without changing it drastically.  Are you prepared for it's output to be vastly different than it was before? I'm kinda hoping that you are the only person in the world using this function.\r\n\r\nFirst off, this function returns disk usage, not percentage.  \r\nSecond if you specify a monitor it returns it in human format (112K) instead of in megabytes (.112)\r\nFurther, we now support multiple storage areas, so really this function needs to return a complete list of every storage area and how much of each storage area monitors are taking up.\r\n\r\nI am wondering if the data you want can be gotten through the other models, and we could maybe delete this function."}}
{"actor":{"display_login":"connortechnology"}}