schumi2004 9 Posted December 14, 2016 Share Posted December 14, 2016 (edited) Hi all, I need some help in monitoring EmbyServer using Monit. Pretty straight forward procedure to start stop synology packages in monit would be like this: start-stop-status start and start-stop-status stop but this doesn;t seem to work for the start-stop-status script packaged with EmbyServer for Synology. When i looked at the script I expected to see something different then it is now. http://pastebin.com/XXhUexzV This is my current monit script but it doesn't work: #check Emby is running check process Emby with pidfile /var/packages/EmbyServer/target/var/embysvr.pid start program = "/var/packages/EmbyServer/scripts/start-stop-status start" with timeout 180 seconds stop program = "/var/packages/EmbyServer/scripts/start-stop-status stop" if failed host localhost port 8096 with timeout 180 seconds then restart if 3 restarts within 5 cycles then timeout #if memory > 110 MB then restart #done Edited December 14, 2016 by schumi2004 Link to comment Share on other sites More sharing options...
schumi2004 9 Posted December 15, 2016 Author Share Posted December 15, 2016 Okay got it working to start EmbyServer from CLI using synopkg /usr/syno/bin/synopkg (start/stop/restart) EmbyServer Now i need to find out if this works in monit script. Link to comment Share on other sites More sharing options...
solabc16 379 Posted December 15, 2016 Share Posted December 15, 2016 Hello @@schumi2004 What's the end goal and/or reason for what you are attempting? That would help me understand better what we need to do. You mention monitoring, but are actually trying to stop/start the package. Are you implementing the 'status' method as well? Best - James Link to comment Share on other sites More sharing options...
schumi2004 9 Posted December 15, 2016 Author Share Posted December 15, 2016 Sometimes emby crashes, sometimes for a known reason or not. Monit monitors (on port and PID file) this and other services for that and launches the app again but in order to do that it needs something to do that. All other packages I run I launch using start-stop-status start but this doesn't seem to work for emby. But the method I posted seems to work as well. Link to comment Share on other sites More sharing options...
solabc16 379 Posted December 15, 2016 Share Posted December 15, 2016 Hello @schumi2004 The start-stop-status script has a method status, that would be the correct way to check if Emby Server is running. The docs are here (https://developer.synology.com/download/developer-guide.pdf), take a look towards the bottom of page 62. I suspect it's not working because you're not setting the environment variables. This script is typically called from Package Center which will set the environment variables the script expects to be set. Make sure you are setting SYNOPKG_PKGNAME to EmbyServer before calling the script and you should find it works as expected. Best - James Link to comment Share on other sites More sharing options...
Solution solabc16 379 Posted December 15, 2016 Solution Share Posted December 15, 2016 ...of course, your solution here (https://emby.media/community/index.php?/topic/42535-monit-monitoring/?p=396518) is good as well. Using the platform utilties will make sure it continues to work correctly across updates. There's no immediate problem calling the scripts directly, but it's not their expected usage. - James Link to comment Share on other sites More sharing options...
schumi2004 9 Posted December 16, 2016 Author Share Posted December 16, 2016 solabc16Thanks for your reply. In some cases it's handy to launch directly from start-stop-status script to find errors. EmbyServer is probably the first community package with such a "advanced" (and probably following the development guide correctly) start-stop-status script i have seen. But it's working for me now and i learned more about how things work. Link to comment Share on other sites More sharing options...
solabc16 379 Posted December 21, 2016 Share Posted December 21, 2016 Thanks for the update @@schumi2004, glad to hear you've got it working the way you want it. - James Link to comment Share on other sites More sharing options...
Recommended Posts