API monitor status
API monitor status
I'm trying to find a way to see a channel is running using the api. I can see if the zoneminder service itself is up, but I specifically want to monitor individual channels so they can be restarted when they fail.
I went thought the api examples and couldn't find anything.
I went thought the api examples and couldn't find anything.
Re: API monitor status
what do you mean by channels? Do you mean monitors? If so, use
This returns a status text parameter that I added a few months ago that reports the running status in text
Code: Select all
<apiBase>+"/monitors/daemonStatus/id:"+<monId>+"/daemon:zmc.json"
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
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
Re: API monitor status
That is exactly what I needed, thanks!
-
- Posts: 271
- Joined: Tue Feb 11, 2014 2:04 pm
Re: API monitor status
Asker.... Could you give me an example URL to use with curl to get status from let's say monitorID 5? I'm fiddling with a few things but my head just isn't getting wrapped around this one so far.asker wrote:what do you mean by channels? Do you mean monitors? If so, useThis returns a status text parameter that I added a few months ago that reports the running status in textCode: Select all
<apiBase>+"/monitors/daemonStatus/id:"+<monId>+"/daemon:zmc.json"
Re: API monitor status
Code: Select all
curl http://<domain>/zm/api/monitors/daemonStatus/id:5/daemon:zmc.json
Code: Select all
{
"status": true,
"statustext": "'zmc -m 5' running since 16\/03\/11 08:45:22, pid = 19021"
}
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
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
Re: API monitor status - does not work
I fully tested this today. It does not work.
I took a monitor with an IP camera, checked the status "status: true". Good so far.
Then I killed the stream. I physically disconnected the camera.
I waited a full 20 minutes. The api continued to say "status: true".
I reconnected the camera. Monitor still dead. Monitor will not recover. API continues to say nothing is wrong.
I took a monitor with an IP camera, checked the status "status: true". Good so far.
Then I killed the stream. I physically disconnected the camera.
I waited a full 20 minutes. The api continued to say "status: true".
I reconnected the camera. Monitor still dead. Monitor will not recover. API continues to say nothing is wrong.
Re: API monitor status
That's why there is a status text - which I referred to in my post - that will change. status shows true.
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
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
Re: API monitor status
I just explained it does not change. I have it on my screen right now.
Re: API monitor status
You explained status remains true. I am referring to statustext not status.
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
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
Re: API monitor status
Statustext did not change at all.
Re: API monitor status
In that case you have tested hastily, not fully.
Remember that this API is reporting the status of the monitor of ZM - not your camera. Monitor of ZM == zmc process
Pay attention to the PIDs
There is no way today to know if the actual camera is down, directly via APIs. You can only know if zmc is healthy.
Running:
kill -9 11765
Note the PID changed above - means zmc was restarted
Change monitor 5 to None in ZM
Changing monitor 5 to "disabled" does not kill zmc - it still runs, so API will report it is running
Pulling out camera 6:
Note no PID above
Doing it again in a few seconds
Doing it again in a few seconds:
This reflects the fact that zmc keeps restarting trying to talk to the camera and keeps failing.
Remember that this API is reporting the status of the monitor of ZM - not your camera. Monitor of ZM == zmc process
Pay attention to the PIDs
There is no way today to know if the actual camera is down, directly via APIs. You can only know if zmc is healthy.
Running:
Code: Select all
{
"status": true,
"statustext": "'zmc -m 5' running since 16\/03\/17 08:50:21, pid = 11765"
}
Code: Select all
{
"status": true,
"statustext": "'zmc -m 5' running since 16\/03\/17 14:14:30, pid = 14100"
}
Change monitor 5 to None in ZM
Code: Select all
{
"status": false,
"statustext": "'zmc -m 5' not running"
}
Changing monitor 5 to "disabled" does not kill zmc - it still runs, so API will report it is running
Pulling out camera 6:
Code: Select all
{
"status": true,
"statustext": "'zmc -m 6' running since 16\/03\/17 14:24:31, pid ="
}
Doing it again in a few seconds
Code: Select all
{
"status": true,
"statustext": "'zmc -m 6' running since 16\/03\/17 14:28:37, pid = 14648"
}
Code: Select all
{
"status": true,
"statustext": "'zmc -m 6' running since 16\/03\/17 14:28:37, pid = 14678"
}
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
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
Re: API monitor status
Clearly we are talking about different requirements.
I need to know when the monitor fails. I have a Nagios server that monitors my systems.
All wifi remote monitors fail - permanently - daily. This happens to me and many other people who reported on this forum. It would be nice if there was an api function that would show the fact that a monitor was down, rather then just have no events and a grey screen for 20 hours or so until someone accidentally discovers the problem.
The PID never changed when my camera dropped connection. This is a "real world" test, unlike using kill -9 on the zmc which is not something I am trying to protect against.
I can monitor the camera itself including the rtsp stream from Nagios - but this doesn't help because the camera is not the problem. The camera comes right back up. The problem is that zoneminder never recovers and displays a blank screen until the monitor is manually restarted.
I need to know when the monitor fails. I have a Nagios server that monitors my systems.
All wifi remote monitors fail - permanently - daily. This happens to me and many other people who reported on this forum. It would be nice if there was an api function that would show the fact that a monitor was down, rather then just have no events and a grey screen for 20 hours or so until someone accidentally discovers the problem.
The PID never changed when my camera dropped connection. This is a "real world" test, unlike using kill -9 on the zmc which is not something I am trying to protect against.
I can monitor the camera itself including the rtsp stream from Nagios - but this doesn't help because the camera is not the problem. The camera comes right back up. The problem is that zoneminder never recovers and displays a blank screen until the monitor is manually restarted.
Re: API monitor status
The APIs cannot be used to detect a blank screen situation, if it does not result in zmc restart.
If ZMC restarts you will see a PID change. If not, you won't know via APIs.
Yes, it would be useful to know, but there isn't a mechanism today.
If ZMC restarts you will see a PID change. If not, you won't know via APIs.
Yes, it would be useful to know, but there isn't a mechanism today.
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
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
Re: API monitor status
OK thanks.
Even more useful would be to have ffmpeg and libvlc automatically recover from soft faults.
Even more useful would be to have ffmpeg and libvlc automatically recover from soft faults.
Re: API monitor status
There is definitely work to be done in zmc to report a down camera. It will be trickling in over the next few releases.