FreeNAS Plugin 1.32.3 API Cake Issue

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
n8klayko
Posts: 33
Joined: Tue Apr 17, 2018 7:54 pm

FreeNAS Plugin 1.32.3 API Cake Issue

Post by n8klayko »

Hello, I am having an issue with my APIs not working correctly in the ZM FreeNAS plugin on 11.2 U5. Zoneminder has been running well in the web interface, but I cannot get the APIs working correctly. I've been trying all sorts of things to get ZMNinja working for live views, but it looks like I have an issue with CAKE. Using the instructions from ZMNinja and the app developer, I navigated to "http://server/zm/api/monitors.json", but get an error:

Code: Select all

<pre class="cake-error"><a href="javascript:void(0);" onclick="document.getElementById('cakeErr5d4c5a5b56414-trace').style.display = (document.getElementById('cakeErr5d4c5a5b56414-trace').style.display == 'none' ? '' : 'none');"><b>Warning</b> (2)</a>: Use of undefined constant utf8 - assumed &#039;utf8&#039; (this will throw an Error in a future version of PHP) [<b>CORE/Cake/Model/ConnectionManager.php</b>, line <b>69</b>]<div id="cakeErr5d4c5a5b56414-trace" class="cake-stack-trace" style="display: none;"><a href="javascript:void(0);" onclick="document.getElementById('cakeErr5d4c5a5b56414-code').style.display = (document.getElementById('cakeErr5d4c5a5b56414-code').style.display == 'none' ? '' : 'none')">Code</a> <a href="javascript:void(0);" onclick="document.getElementById('cakeErr5d4c5a5b56414-context').style.display = (document.getElementById('cakeErr5d4c5a5b56414-context').style.display == 'none' ? '' : 'none')">Context</a><pre id="cakeErr5d4c5a5b56414-code" class="cake-code-dump" style="display: none;"><code><span style="color: #000000"><span style="color: #0000BB">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">include_once&nbsp;</span><span style="color: #0000BB">CONFIG&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #DD0000">'database.php'</span><span style="color: #007700">;</span></span></code>
<code><span style="color: #000000"><span style="color: #0000BB">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">class_exists</span><span style="color: #007700">(</span><span style="color: #DD0000">'DATABASE_CONFIG'</span><span style="color: #007700">))&nbsp;{</span></span></code>
<span class="code-highlight"><code><span style="color: #000000"><span style="color: #0000BB">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">static::</span><span style="color: #0000BB">$config&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">DATABASE_CONFIG</span><span style="color: #007700">();</span></span></code></span></pre><pre class="stack-trace">ConnectionManager::_init() - CORE/Cake/Model/ConnectionManager.php, line 69
ConnectionManager::getDataSource() - CORE/Cake/Model/ConnectionManager.php, line 83
Model::setDataSource() - CORE/Cake/Model/Model.php, line 3646
Model::setSource() - CORE/Cake/Model/Model.php, line 1162
Model::getDataSource() - CORE/Cake/Model/Model.php, line 3673
Model::schema() - CORE/Cake/Model/Model.php, line 1394
EnumBehavior::setup() - APP/Plugin/CakePHP-Enum-Behavior/Model/Behavior/EnumBehavior.php, line 34
BehaviorCollection::load() - CORE/Cake/Model/BehaviorCollection.php, line 145
BehaviorCollection::init() - CORE/Cake/Model/BehaviorCollection.php, line 66
Model::__construct() - CORE/Cake/Model/Model.php, line 781
ReflectionClass::newInstance() - [internal], line ??
ClassRegistry::init() - CORE/Cake/Utility/ClassRegistry.php, line 169
Controller::loadModel() - CORE/Cake/Controller/Controller.php, line 741
Controller::__isset() - CORE/Cake/Controller/Controller.php, line 368
Controller::__get() - CORE/Cake/Controller/Controller.php, line 406
CrudComponent::_setModelProperties() - APP/Plugin/Crud/Controller/Component/CrudComponent.php, line 812
CrudComponent::getSubject() - APP/Plugin/Crud/Controller/Component/CrudComponent.php, line 614
CrudComponent::_loadListener() - APP/Plugin/Crud/Controller/Component/CrudComponent.php, line 751</pre></div></pre>{
    "monitors": [
        ............monitor information.................
The folks from ZMNinjatold me that this is an API issue, but I have no idea where to start to troubleshoot this. This does appear to be the issue causing the APIs to break. I could really use some assistance or direction with helping to troubleshoot my APIs and CAKE.


Respectfully,
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: FreeNAS Plugin 1.32.3 API Cake Issue

Post by asker »

Try this:
Assuming ZM is installed in

Code: Select all

/usr/share/zoneminder
Open up

Code: Select all

/usr/share/zoneminder/www/api/app/Config/core.php
(if ZM is installed elsewhere change path accordingly)

You will see somewhere, in that file (maybe around line 34, may change based on version), the following line:

Code: Select all

Configure::write('debug',<some value>)
If that "<some value>" is greater than 0, make it 0, and save. Then try the API again.
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
Post Reply