Merge lp:~thomir-deactivatedaccount/charms/trusty/tanuki-result-enum-api/trunk-revert-changes into lp:~tanuki/charms/trusty/tanuki-result-enum-api/trunk

Proposed by Thomi Richards
Status: Merged
Approved by: Samuele Pedroni
Approved revision: 24
Merged at revision: 24
Proposed branch: lp:~thomir-deactivatedaccount/charms/trusty/tanuki-result-enum-api/trunk-revert-changes
Merge into: lp:~tanuki/charms/trusty/tanuki-result-enum-api/trunk
Diff against target: 204 lines (+4/-176)
2 files modified
files/check_upstart_status.pl (+0/-157)
hooks/actions.py (+4/-19)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/charms/trusty/tanuki-result-enum-api/trunk-revert-changes
Reviewer Review Type Date Requested Status
Samuele Pedroni Approve
Review via email: mp+273491@code.launchpad.net

Commit message

Revert revnos 22..20.

Description of the change

Revert revnos 22..20.

To post a comment you must log in.
Revision history for this message
Samuele Pedroni (pedronis) wrote :

approving

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'files/check_upstart_status.pl'
2--- files/check_upstart_status.pl 2015-09-28 01:17:48 +0000
3+++ files/check_upstart_status.pl 1970-01-01 00:00:00 +0000
4@@ -1,157 +0,0 @@
5-#! /usr/bin/perl -w
6-#
7-# check_upstart_status.pl
8-# by Jeremy Goldstein
9-#
10-# This nagios check checks the status of upstart jobs
11-#
12-# Copyright (c) 2012 Jeremy Goldstein
13-#
14-# This program is free software; you can redistribute it and/or modify
15-# it under the terms of the GNU General Public License as published by
16-# the Free Software Foundation; either version 2 of the License, or
17-# (at your option) any later version.
18-#
19-# This program is distributed in the hope that it will be useful,
20-# but WITHOUT ANY WARRANTY; without even the implied warranty of
21-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22-# GNU General Public License for more details.
23-#
24-# You should have received a copy of the GNU General Public License
25-# along with this program; if not, write to the Free Software
26-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27-#
28-#
29-# 0 = ok
30-# 1 = warn
31-# 2 = crit
32-# 3 = unknown
33-
34-#configurable options:
35-my $debug = 0;
36-
37-# No changes below, unless you want to change exit codes
38-use lib "/usr/lib/nagios/plugins";
39-use Getopt::Std;
40-use strict;
41-use warnings;
42-use utils qw( %ERRORS);
43-
44-%ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3);
45-my $exit_value = $ERRORS{'UNKNOWN'} ;
46-
47-my %options=();
48-
49-getopts("j:", \%options);
50-
51-if (scalar(keys(%options))<1 )
52-{
53- show_usage();
54-}
55-
56-my $jobName = $options{'j'};
57-my $exit_value_human="";
58-my $retval;
59-my $goal;
60-my $state;
61-
62-#Run command and get result
63-my $cmd = "status $jobName";
64-$retval = `$cmd`;
65-
66-#Get return code
67-my $retnum = $?>>8;
68-
69-#Check return code to see if job was found
70-if ($retnum > 0)
71-{
72- $exit_value = $ERRORS{'UNKNOWN'};
73- $retval = 'Error - Job name may not have been found';
74-}
75-else
76-{
77- #Remove trailing \n and replace with trailing comma as quick hack
78- $retval =~ s/\n/,/;
79-
80- if ($retval =~ m/$jobName (.*)\/.*/)
81- {
82- $goal = $1;
83- }
84-
85- if ($retval =~ m/.*\/(.*),/)
86- {
87- $state = $1;
88- }
89-
90- if ($debug)
91- {
92- print "Command run: $cmd\n";
93- print "Result: $retval\n";
94- }
95-
96- if ($goal eq "stop")
97- {
98- $exit_value = $ERRORS{'CRITICAL'};
99- }
100- elsif ($state eq "pre-stop")
101- {
102- $exit_value = $ERRORS{'WARNING'};
103- }
104- elsif ($state eq "stopping")
105- {
106- $exit_value = $ERRORS{'WARNING'};
107- }
108- elsif ($state eq "killed")
109- {
110- $exit_value = $ERRORS{'WARNING'};
111- }
112- elsif ($state eq "post-stop")
113- {
114- $exit_value = $ERRORS{'WARNING'};
115- }
116- else
117- {
118- $exit_value = $ERRORS{'OK'};
119- }
120-}
121-
122-if ($exit_value == 0)
123-{
124- $exit_value_human = "OK";
125-}
126-elsif ($exit_value == 1)
127-{
128- $exit_value_human = "WARNING";
129-}
130-elsif ($exit_value == 2)
131-{
132- $exit_value_human = "CRITICAL";
133-}
134-elsif ($exit_value == 3)
135-{
136- $exit_value_human = "UNKNOWN";
137-}
138-
139-#Remove trailing comma hack
140-$retval =~ s/,$//;
141-
142-print $retval . ". STATUS: $exit_value_human\n";
143-exit $exit_value;
144-
145-sub show_usage
146-{
147- print "\n\n";
148- print "check_upstart_status.pl\n";
149- print "by Jeremy Goldstein\n";
150- print "\n";
151- print "This nagios check checks the status of upstart jobs\n";
152- print "and alerts when the job is not running.\n";
153- print "\n";
154- print "usage:\n";
155- print "./check_upstart_status.pl -j jobName\n";
156- print "\n";
157- print "-j jobName\t\t The name of the upstart job you want to check\n";
158- print "\n\n";
159-
160- exit $exit_value;
161-}
162
163=== modified file 'hooks/actions.py'
164--- hooks/actions.py 2015-09-28 22:39:48 +0000
165+++ hooks/actions.py 2015-10-06 00:44:59 +0000
166@@ -2,8 +2,6 @@
167 import configparser
168 import os
169 import os.path
170-import shutil
171-import stat
172 import subprocess
173
174 from charmhelpers import fetch
175@@ -201,25 +199,12 @@
176
177 def nrpe_external_master_relation(service_name):
178 ''' Configure the nrpe-external-master relation '''
179- filename = 'check_upstart_status.pl'
180- src = os.path.join(
181- os.path.dirname(__file__),
182- '..',
183- 'files',
184- filename
185- )
186- dst = os.path.join('/usr/lib/nagios/plugins', filename)
187- dst_dir = os.path.dirname(dst)
188- if not os.path.exists(dst_dir):
189- os.makedirs(dst_dir)
190- shutil.copy(src, dst)
191- os.chmod(dst, 0o755)
192 nrpe_compat = nrpe.NRPE()
193
194 nrpe_compat.add_check(
195- shortname="check_job_running",
196- description="Check that the upstart Job is running",
197- check_cmd="{} -j 'result-enum-api'".format(dst),
198- )
199+ shortname="check_app_http",
200+ description="App or app mongodb connection check",
201+ check_cmd="/usr/lib/nagios/plugins/check_http -I 127.0.0.1 -p 8000 -e ' 200 OK' -u '/nagios/mongodb'",
202+ )
203
204 nrpe_compat.write()

Subscribers

People subscribed via source and target branches

to all changes: