Zoneminder 1.30.4 API not working on FreeBSD

Forum for questions and support relating to the 1.30.x releases only.
rockedge
Posts: 835
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: Zoneminder 1.30.4 API not working on FreeBSD

Post by rockedge » Tue Apr 24, 2018 3:03 pm

Looking at my Zoneminder installation it looks like the path above "/var/log/zm" is mostly correct, but I do not have a /zm/ directory inside of my "/var/log" directory.
try to create the missing directory so it looks like /var/log/zm.......might need to adjust the permissions and or ownership for the /zm/ directory.

n8klayko
Posts: 22
Joined: Tue Apr 17, 2018 7:54 pm

Re: Zoneminder 1.30.4 API not working on FreeBSD

Post by n8klayko » Tue Apr 24, 2018 9:04 pm

I created the "zm" directory under my "/var/log/" directory and CakePHP is no longer giving an error. However, I am still not getting anything when I go to "http://serverIP/api/host/getVersion.json". Again, it is important to note that the jail install does not require the "zm" added to the end of my server address in order to access it... for example, I only need to type "http://serverIP/" rather than "http://serverIP/zm/" to access my server. I believe this is part of the issue. Here is what I see when trying to check the api "getVersion.json"

Capture.PNG
Capture.PNG (4.36 KiB) Viewed 504 times

The "/zm/" part appears to be the problem. The jail version of Zoneminder must have taken this out everywhere except within the API, since everything else is working. I attempted creating a zm folder in the same directory as my api folder and creating a symlink to the api folder within the newly created zm folder. This did not work and gave me a "Forbidden" message when testing the "getVersion.json". However, if I copy my api folder in its entirety to the newly created zm folder, then my api works. This is not a true fix, but rather just a work around to identify that the "/zm/" part needs removed somewhere... I just don't know where. Is CakePHP creating/handling the "/host/getVersion.json" or is the coming from apache or something else?

Any thoughts on where I can change this so that the API is accessible correctly?

n8klayko
Posts: 22
Joined: Tue Apr 17, 2018 7:54 pm

Re: Zoneminder 1.30.4 API not working on FreeBSD

Post by n8klayko » Tue Apr 24, 2018 9:05 pm

Also, thanks again for all your help! :D

BadNaas
Posts: 1
Joined: Mon Apr 23, 2018 7:33 pm

Re: Zoneminder 1.30.4 API not working on FreeBSD

Post by BadNaas » Tue Apr 24, 2018 10:56 pm

Following with great interest! Ran into the same problems you're seeing, but not knowledgeable enough to fix it myself without explicit directions. Keep up the good work!

rockedge
Posts: 835
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: Zoneminder 1.30.4 API not working on FreeBSD

Post by rockedge » Wed Apr 25, 2018 3:23 am

this is a again a URL re-write problem. look in the .htaccess files or your http.conf that the proper url is formed.
http://your-zm-server/zm/api/host/getVersion.json should be http://your-zm-server/api/host/getVersion.json since reaching
the web console must be the url http://your-zm-server/index.php

n8klayko
Posts: 22
Joined: Tue Apr 17, 2018 7:54 pm

Re: Zoneminder 1.30.4 API not working on FreeBSD

Post by n8klayko » Wed Apr 25, 2018 2:24 pm

rockedge wrote:
Wed Apr 25, 2018 3:23 am
this is a again a URL re-write problem. look in the .htaccess files or your http.conf that the proper url is formed.
http://your-zm-server/zm/api/host/getVersion.json should be http://your-zm-server/api/host/getVersion.json since reaching
the web console must be the url http://your-zm-server/index.php
Okay... so I have good news and not as good news. The good news is that I found the .htaccess file that was still misconfigured in "api/app/webroot" and changed the rewrite root line from /zm/api to /api. This has made it so that the API appears to be working when I check it by navigating to "http://serverIP/api/host/getVersion.json".

The not so good news is that testing the API through zmNinja does not appear to work. I realize that this may be out of scope to discuss zmNinja on this forum, but it is still related to the API not working correctly within Zoneminder when installed in a FreeNAS jail.

When I configure and log into my zmNinja app for Android, the app logs into my Zoneminder installation and acts as if the API is working correctly. I get a message "Loading Monitors..." on the screen that stays for 10 seconds or so, even though it should only be there for a second or two at most. Then if I click on anything other than the settings or system status, the app completely freezes and becomes unresponsive. To me this seems like it is still a symptom of something not working correctly with the API.

Any thoughts...?

rockedge
Posts: 835
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: Zoneminder 1.30.4 API not working on FreeBSD

Post by rockedge » Wed Apr 25, 2018 3:57 pm

ahh I saw this before as well! the API appeared to work when I polled it directly but zmNija did not work.... I must check back and see what I did to fix it...I don't recall exactly how or what it was but this happened to me last week maybe I have it in some notes.

Check zmNinja that the /cgi-bin/ path is correct and just double check the settings.... it was something simple and zmNinja started working and really well. Your right on the edge of getting this working.

n8klayko
Posts: 22
Joined: Tue Apr 17, 2018 7:54 pm

Re: Zoneminder 1.30.4 API not working on FreeBSD

Post by n8klayko » Wed Apr 25, 2018 4:28 pm

The path to my cgi-bin in zmNinja is "http://serverIP/cgi-bin". This is correct in terms of folder structure. The other thing to note is that my zmNinja app with freeze an not go past the initial authentication screen unless manually cancel authentication.

I do have zmNinja debugging enabled and have tried to look at the logs, but don't see anything that jumps out at me as a definite indicator of the root issue.

rockedge
Posts: 835
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: Zoneminder 1.30.4 API not working on FreeBSD

Post by rockedge » Wed Apr 25, 2018 4:32 pm

I recall one of my API problems had something to do with the authorization....what are your settings at the moment as far as authorization goes? Turn off all authorization and see if zmNinja will connect with no passwords

n8klayko
Posts: 22
Joined: Tue Apr 17, 2018 7:54 pm

Re: Zoneminder 1.30.4 API not working on FreeBSD

Post by n8klayko » Thu Apr 26, 2018 12:35 pm

I removed all authentication, but this did not help. zmNinja freezes during logon (because the default page is the monitors page). If I cancel logon, then press save, the app will log on and act as if everything is working (both with and without authentication). The issue is that the app completely locks up and has to be force quit and restarted as soon as I press on events, timeline, montage, monitors, etc.

I think this may have something to do with cgi-bin, but I am not sure. I am going to do a search through both the "api" and "cgi-bin" directories to see if there is anything still looking for the path "/zm/" proceeding anything. My cgi-bin path in Zoneminder options looks correct.

rockedge
Posts: 835
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: Zoneminder 1.30.4 API not working on FreeBSD

Post by rockedge » Fri Apr 27, 2018 2:01 pm

what happens if you try the url http://your-zm-server/cgi-bin or http://your-zm-server/zm/cgi-bin?
can you reach the /cgi-bin/ ? If you get not found errors a configuration path is incorrect someplace.

n8klayko
Posts: 22
Joined: Tue Apr 17, 2018 7:54 pm

Re: Zoneminder 1.30.4 API not working on FreeBSD

Post by n8klayko » Fri Apr 27, 2018 3:03 pm

When testing "http://your-zm-server/zm/cgi-bin", I get a not found error, but this makes sense since this doesn't match my directory structure.

However, when I tested "http://your-zm-server/cgi-bin", I get a "Forbidden", "You don't have permission to access /cgi-bin/ on this server." message.

I am authenticated with Zoneminder in the same browser. Does this sound right or should this be showing something else?

rockedge
Posts: 835
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: Zoneminder 1.30.4 API not working on FreeBSD

Post by rockedge » Fri Apr 27, 2018 4:07 pm

In your Apache site-enabled configuration or the Apache conf-enabled zoneminder.conf check that the correct actual paths and Alias for /cgi-bin/ are correct. This is a piece from the stock /etc/apache2/conf-avialable/zoneminder.conf which I do not use since I am running Hiawatha instead of Apache at the moment.

Code: Select all

# Remember to enable cgi mod (i.e. "a2enmod cgi").
ScriptAlias /zm/cgi-bin "/usr/lib/zoneminder/cgi-bin"
<Directory "/usr/lib/zoneminder/cgi-bin">
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    AllowOverride All
    Require all granted
</Directory>
ensure that these paths match your structure.

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

Re: Zoneminder 1.30.4 API not working on FreeBSD

Post by asker » Sun Apr 29, 2018 9:58 pm

So your APIs work finally on the browser but not on zmNinja? If so (that is, all APIs work on the browser) I can try and help. I've been doing a lot of cleanup

1. I'd like you to test a new version of the desktop port of zmNinja (easier to test)
2. Let me know your desktop OS
3. When you run his new version, press Ctrl+Alt+D - it opens a debug window, so you can tell me what you see
4. Shoot me an email so I can give you the download link (pliablepixels @gmail)
--
My collection of ZoneMinder learnings:
https://wiki.zoneminder.com/Various_ZM_thoughts

rockedge
Posts: 835
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: Zoneminder 1.30.4 API not working on FreeBSD

Post by rockedge » Mon Apr 30, 2018 12:20 am

my OS is Puppy Linux Bionic 18.05 (Ubuntu) I am running currently zmNinja v1.2.515D
which is working well. I could test if necessary on ZM 1.30.4 through to ZM 1.31.43

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests