SageTV Community  

Go Back   SageTV Community > SageTV Products > SageTV Linux > SageTV for unRAID/Docker
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV for unRAID/Docker Discussion related to SageTV for unRAID/Docker. Questions, issues, problems, suggestions, etc. relating to SageTV for unRAID/Docker should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-01-2017, 08:30 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
Ideas for getting notified when Sage dies

I have had the odd issue with SageTV dying while the SageTV docker is still alive - for example see this thread.

So I want to be notified when SageTV goes down. I have written a python script that attempts to hit the SageTV web server. When the response code is not 200 or there is a timeout or other issue I then have an email sent to me. This is set to run every 5 minutes in a cron job under the root unRAID account.

Is this the best way to do this or is there a better way to do this?

One issue with this script is that it won't work if the unRAID server itself goes down.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #2  
Old 03-02-2017, 06:43 AM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Quote:
Originally Posted by wayner View Post
One issue with this script is that it won't work if the unRAID server itself goes down.
It would if it was run on something besides the unRAID server. That's really the only way to do a watchdog script like this, is to have it completely seperate from the potential failure points.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
  #3  
Old 03-02-2017, 02:30 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
That's a good point. I might run it on both the server and another computer as this would allow me to get more information. For example it would be helpful to know the following info:

Is the unRAID server up?
Is the SageTV docker process alive?
Is the SageTV process alive?

When it comes to the docker process and, arguably the SageTV process, you would need to run them from the unRAID server or run a remote SSH command.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #4  
Old 03-02-2017, 05:38 PM
KarylFStein KarylFStein is offline
Sage Fanatic
 
Join Date: Apr 2006
Location: Westland, Michigan, USA
Posts: 999
Quote:
Originally Posted by wayner View Post
That's a good point. I might run it on both the server and another computer as this would allow me to get more information. For example it would be helpful to know the following info:

Is the unRAID server up?
Is the SageTV docker process alive?
Is the SageTV process alive?

When it comes to the docker process and, arguably the SageTV process, you would need to run them from the unRAID server or run a remote SSH command.
Probably more than you're wanting to do, but I've used Nagios for a long, long time, (since before it was called Nagios--forget the original name). I haven't had time to see how much integration there may be with unRAID, though.
__________________
Home Network: https://karylstein.com/technology.html
Reply With Quote
  #5  
Old 03-03-2017, 06:03 AM
KeithAbbott KeithAbbott is offline
Sage Icon
 
Join Date: Oct 2009
Location: Southeastern Michigan
Posts: 1,375
Before I undertake the work to make the switch to an unRAID/SageTV docker system, do I need to be worried about the stability of this setup? Is it really unstable enough that it requires monitoring from a separate computer? Your post has me questioning whether unRaid/SageTV is a good direction to head in.
__________________
Server: MSI Z270 SLI Plus ATX Motherboard, Intel i7-7700T CPU, 32GB Memory, Unraid 6.11.5, sagetvopen-sagetv-server-opendct-java11 Docker (version 2.0.7)
Tuners: 2 x SiliconDust HDHomeRun Prime Cable TV Tuners, SiliconDust HDHomeRun CONNECT 4K OTA Tuner
Clients: Multiple HD300 Extenders, Multiple Fire TV Stick 4K Max w/MiniClient
Miscellaneous: Multiple Sony RM-VLZ620 Universal Remote Controls
Reply With Quote
  #6  
Old 03-03-2017, 06:09 AM
stuckless's Avatar
stuckless stuckless is offline
SageTVaholic
 
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Quote:
Originally Posted by KeithAbbott View Post
Before I undertake the work to make the switch to an unRAID/SageTV docker system, do I need to be worried about the stability of this setup? Is it really unstable enough that it requires monitoring from a separate computer? Your post has me questioning whether unRaid/SageTV is a good direction to head in.
In my setup on linux in 7-8 years... I can count on one hand the number of times my server has locked up and needed a manual reboot... and you can bet that every one of those times I was away on business

The uptime on the server isn't in the years, but I usually get 2-3 months of uptime and then I need to reboot to because I've taken some updates, etc.

Overall I can't say the stability is bad, but i don't run Windows, so I also can't compare the setup with Windows.
Reply With Quote
  #7  
Old 03-03-2017, 06:26 AM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
My SageTV V7 Win7 system is very unstable and I have a similar notification system set up for that. But the reason for that instability is the insufficiency of 1GB of JVM heap size.

My unRAID system has been up for a month and I have had two crashes. It looks like the latest one was related to the YouTube plugin.

I just want to be pro-active and stay on top of any potential issues.
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #8  
Old 03-03-2017, 07:35 AM
EnterNoEscape's Avatar
EnterNoEscape EnterNoEscape is offline
SageTVaholic
 
Join Date: Jun 2010
Location: Harrisburg, PA
Posts: 2,657
I have not had any noteworthy issues running the SageTV Docker container on unRAID. I also purely use network-based encoders with it through OpenDCT which might make a difference. I can't speak for long uptimes due to the reboots needed for OS updates, but I have not had the container suddenly stop on me.
__________________
SageTV v9 Server: ASRock Z97 Extreme4, Intel i7-4790K @ 4.4Ghz, 32GB RAM, 6x 3TB 7200rpm HD, 2x 5TB 7200rpm HD, 2x 6TB 7200rpm HD, 4x 256GB SSD, 4x 500GB SSD, unRAID Pro 6.7.2 (Dual Parity + SSD Cache).
Capture: 1x Ceton InfiniTV 4 (ClearQAM), 2x Ceton InfiniTV 6, 1x BM1000-HDMI, 1x BM3500-HDMI.

Clients: 1x HD300 (Living Room), 1x HD200 (Master Bedroom).
Software: OpenDCT :: WMC Live TV Tuner :: Schedules Direct EPG
Reply With Quote
  #9  
Old 03-03-2017, 07:44 AM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
I have not had the docker stop on me either but twice I have had the SageTV java process die within the docker. So the docker is still active but it isn't doing very much. The logs will show something like:

Quote:
./startsagecore: line 48: 100 Aborted java -Djava.awt.headless=$HEADLESS $JAVAMEM -XX:+UseAdaptiveSizePolicy -XX:MaxGCPauseMillis=25 -XX:GCTimeRatio=24 $(if [[ $EUID -eq 0 ]]; then echo '-XX:ThreadPriorityPolicy=1'; fi) $JAVAOPTS -cp Sage.jar:JARs/lucene-core-3.6.0.jar:/:$(echo JARs/*.jar | sed 's/ */:/g') sage.Sage 0 0 x "sagetv Sage.properties" 0>&-
I have seen this happen twice now in the roughly five weeks since I have been running SageTV on unRAID. The most recent issue was described here: [ReProcessHook@895f038] 9000 times per second!: (I guess a mod moved it to a different forum). Tmiranda is pretty sure that this was a Youtube plugin issue.

Would there be any way of having the SageTV server process automatically restart itself if it dies?
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #10  
Old 03-03-2017, 12:52 PM
KarylFStein KarylFStein is offline
Sage Fanatic
 
Join Date: Apr 2006
Location: Westland, Michigan, USA
Posts: 999
Quote:
Originally Posted by wayner View Post
I have not had the docker stop on me either but twice I have had the SageTV java process die within the docker. So the docker is still active but it isn't doing very much. The logs will show something like:



I have seen this happen twice now in the roughly five weeks since I have been running SageTV on unRAID. The most recent issue was described here: [ReProcessHook@895f038] 9000 times per second!: (I guess a mod moved it to a different forum). Tmiranda is pretty sure that this was a Youtube plugin issue.

Would there be any way of having the SageTV server process automatically restart itself if it dies?
From the output you gave it looks like SageTV is being started within a script and is not being exec'd, so yes, it should be possible to catch that type of failure and restart the service.
__________________
Home Network: https://karylstein.com/technology.html
Reply With Quote
  #11  
Old 03-03-2017, 01:01 PM
KarylFStein KarylFStein is offline
Sage Fanatic
 
Join Date: Apr 2006
Location: Westland, Michigan, USA
Posts: 999
Quote:
Originally Posted by KarylFStein View Post
From the output you gave it looks like SageTV is being started within a script and is not being exec'd, so yes, it should be possible to catch that type of failure and restart the service.
I looked at the script in Git and it looks to already have a restart ability. If the file restart or restartsvc exists, it will restart, (but also remove the file). I am not sure if something else is supposed to create that file e.g. some timer so the service will restart if say it's been running OK for at least an hour, but if rapid-fire crashing it won't keep trying. If not it would be fairly simple to add logic like that and perhaps even trigger an alert of some sort if it can't resolve things.
__________________
Home Network: https://karylstein.com/technology.html
Reply With Quote
  #12  
Old 03-03-2017, 01:05 PM
EnterNoEscape's Avatar
EnterNoEscape EnterNoEscape is offline
SageTVaholic
 
Join Date: Jun 2010
Location: Harrisburg, PA
Posts: 2,657
I believe it's supposed to do that already. If it's not as in your case, it must have frozen in a manner that didn't cause the JVM to actually stop. In that case, then it's likely some code spinning out of control in such a manner that the JVM appears to have crashed because it is no longer responding.
__________________
SageTV v9 Server: ASRock Z97 Extreme4, Intel i7-4790K @ 4.4Ghz, 32GB RAM, 6x 3TB 7200rpm HD, 2x 5TB 7200rpm HD, 2x 6TB 7200rpm HD, 4x 256GB SSD, 4x 500GB SSD, unRAID Pro 6.7.2 (Dual Parity + SSD Cache).
Capture: 1x Ceton InfiniTV 4 (ClearQAM), 2x Ceton InfiniTV 6, 1x BM1000-HDMI, 1x BM3500-HDMI.

Clients: 1x HD300 (Living Room), 1x HD200 (Master Bedroom).
Software: OpenDCT :: WMC Live TV Tuner :: Schedules Direct EPG
Reply With Quote
  #13  
Old 03-03-2017, 01:05 PM
wayner wayner is offline
SageTVaholic
 
Join Date: Jan 2008
Location: Toronto, ON
Posts: 7,491
Should we mention this to stuckless and see if he can implement it?
__________________
New Server - Sage9 on unRAID 2xHD-PVR, HDHR for OTA
Old Server - Sage7 on Win7Pro-i660CPU with 4.6TB, HD-PVR, HDHR OTA, HVR-1850 OTA
Clients - 2xHD-300, 8xHD-200 Extenders, Client+2xPlaceshifter and a WHS which acts as a backup Sage server
Reply With Quote
  #14  
Old 03-03-2017, 02:57 PM
KarylFStein KarylFStein is offline
Sage Fanatic
 
Join Date: Apr 2006
Location: Westland, Michigan, USA
Posts: 999
Quote:
Originally Posted by KarylFStein View Post
I looked at the script in Git and it looks to already have a restart ability. If the file restart or restartsvc exists, it will restart, (but also remove the file). I am not sure if something else is supposed to create that file e.g. some timer so the service will restart if say it's been running OK for at least an hour, but if rapid-fire crashing it won't keep trying. If not it would be fairly simple to add logic like that and perhaps even trigger an alert of some sort if it can't resolve things.
FYI, as far as I can tell it looks like the restart file is created during a planned restart of the server, (e.g. after updating a plugin that asks if you want to restart the server).
__________________
Home Network: https://karylstein.com/technology.html
Reply With Quote
  #15  
Old 03-03-2017, 07:14 PM
Fuzzy's Avatar
Fuzzy Fuzzy is offline
SageTVaholic
 
Join Date: Sep 2005
Location: Jurupa Valley, CA
Posts: 9,957
Quote:
Originally Posted by KarylFStein View Post
FYI, as far as I can tell it looks like the restart file is created during a planned restart of the server, (e.g. after updating a plugin that asks if you want to restart the server).
That is correct. It essentially writes the restart file, and shuts down the JVM, returning control to the script, which then sees the restart file, and relaunches the jvm.

The issue with it blanket restarting when the jvm exits, is we'd never be able to cleanly shut down the server. Currently, when you tell the docker container to close, it sends a kill signal to all process, including sage. This triggers sage to do a clean shutdown (stopping recordings, stopping services, final writes on the databse files, etc), and then it closes the JVM. If what is suggested here is implemented and it autorestarts when closing, it may simply relaunch as soon as it exits, and eventually, after a timeout, the force kill will stop it uncleanly.

A change could certainly be made to the sage core that will write a 'running' file, that gets deleted before sage intentionally closes down, and if that file is present, the script will restart assuming it failed. This might provide a location to detect a 'sage died' action and send off a notification of some sort perhaps as well. Feel free to write up an issue for this capability on github.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer)

unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers.
Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA.
Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S
Other Clients: Mi Box in Master Bedroom, HD-200 in kids room
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows 10 => Sage Sluggish - Ideas/thoughts to try? malbec SageTV Software 10 06-05-2016 01:59 PM
HD100 dies a second time? SageGk SageTV Media Extender 4 08-29-2010 12:29 AM
Wireless link dies when used with Sage dex1 SageTV Software 0 01-02-2006 08:52 PM
Sage Hangs then recovers. ideas? backsix SageTV Software 2 08-11-2005 09:26 AM


All times are GMT -6. The time now is 05:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.