Add basic check-supervisor-process script
				
					
				
			for use with Shinken monitoring
This commit is contained in:
		
							parent
							
								
									d2f04b315a
								
							
						
					
					
						commit
						1962b62f11
					
				
					 2 changed files with 58 additions and 0 deletions
				
			
		
							
								
								
									
										57
									
								
								rattail_fabric/deploy/check-supervisor-process
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										57
									
								
								rattail_fabric/deploy/check-supervisor-process
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,57 @@ | |||
| #!/bin/sh | ||||
| ################################################################################ | ||||
| # | ||||
| #  Rattail -- Retail Software Framework | ||||
| #  Copyright © 2010-2018 Lance Edgar | ||||
| # | ||||
| #  This file is part of Rattail. | ||||
| # | ||||
| #  Rattail is free software: you can redistribute it and/or modify it under the | ||||
| #  terms of the GNU General Public License as published by the Free Software | ||||
| #  Foundation, either version 3 of the License, or (at your option) any later | ||||
| #  version. | ||||
| # | ||||
| #  Rattail is distributed in the hope that it will be useful, but WITHOUT ANY | ||||
| #  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||||
| #  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more | ||||
| #  details. | ||||
| # | ||||
| #  You should have received a copy of the GNU General Public License along with | ||||
| #  Rattail.  If not, see <http://www.gnu.org/licenses/>. | ||||
| # | ||||
| ################################################################################ | ||||
| # | ||||
| # This is a simple script which will output a single line of info, and exit | ||||
| # with a return code which indicates status of a given supervisor process.  It | ||||
| # was designed for use with Shinken monitoring.  Invoke like so: | ||||
| # | ||||
| #    check-supervisor-process NAME | ||||
| # | ||||
| # Where NAME refers to the process, e.g. 'rattail:datasync'.  Exit code may be: | ||||
| # | ||||
| #  * 0 = process is confirmed running | ||||
| #  * 2 = process is confirmed *not* running | ||||
| #  * 3 = unknown state | ||||
| # | ||||
| ################################################################################ | ||||
| 
 | ||||
| NAME="$1" | ||||
| if [ "$NAME" = "" ]; then | ||||
|     echo "Usage: check-supervisor-process NAME" | ||||
|     exit 3 | ||||
| fi | ||||
| 
 | ||||
| STATUS=$(sudo supervisorctl status $NAME | awk -F ' +' '{print $2}') | ||||
| 
 | ||||
| if [ $STATUS = "RUNNING" ]; then | ||||
|     echo "supervisor reports RUNNING status" | ||||
|     exit 0 | ||||
| fi | ||||
| 
 | ||||
| if [ "$STATUS" = "" ]; then | ||||
|     echo "unable to perform status check!" | ||||
|     exit 3 | ||||
| fi | ||||
| 
 | ||||
| echo "supervisor reports $STATUS status" | ||||
| exit 2 | ||||
|  | @ -51,6 +51,7 @@ def bootstrap_rattail(home='/var/lib/rattail', uid=None, shell='/bin/bash'): | |||
|     mkdir('/srv/rattail/init') | ||||
|     deploy('daemon', '/srv/rattail/init/daemon') | ||||
|     deploy('check-rattail-daemon', '/usr/local/bin/check-rattail-daemon') | ||||
|     deploy('check-supervisor-process', '/usr/local/bin/check-supervisor-process', mode='0755') | ||||
|     deploy('luigid', '/srv/rattail/init/luigid') | ||||
|     deploy('soffice', '/srv/rattail/init/soffice') | ||||
|     # TODO: deprecate / remove these | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar