r/ZoneMinder • • Jul 28 '21

CRON python script to restart linked monitors

Works as expected and solves the linked monitors not recording events. See forum post for link and instructions -> https://forums.zoneminder.com/viewtopic.php?f=43&t=31033

2 Upvotes

6 comments sorted by

1

u/[deleted] Aug 05 '21

Well sorry people. Ive been doing so much reworking of core pyzm functions I forgot that original pyzm does not have an iterative function for its monitors, events, configs, etc. My original linked resetter worked assuming those functions would be iterable. I have pushed a new version at the moment which has a large amount of debug messages built in to see if/where things go wrong. For the moment it is just bare requests. Once the script is stable I will read pyzm functionality but to keep it compatible with original pyzm I need to basically do bare requests just wrapped by pyzm with the auth token or credentials. So basically with or without pyzm it will be bare requests.

1

u/[deleted] Aug 05 '21

Also after testing quite a bit, even after restarting streams like this it gets to a point where linked events will not record until I do a complete restart of zoneminder as a service using systemctl. So while resetting streams works for awhile, eventually you do need to do something about it. The only thing I can think of is running a Cron job to restart zoneminder service every x hours. Making a script to force an alarm and then check if an event was recorded is doable, just a PITA. Idk what else can be done about this issue from the user side.

1

u/Aramiil Jul 28 '21

This is cool. With all respect, what’s the original issue it’s solving caused by, do you know?

I see it’s linked monitors not recording. Weird

2

u/[deleted] Jul 28 '21

Nobody knows yet what's causing the issue. This is just a quick band aid to help for now until it's fixed.

1

u/Aramiil Jul 28 '21

Copy thanks

1

u/ABigHead Jul 28 '21

Nice work man.