File tree 1 file changed +9
-6
lines changed
1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 1
- #!/usr/local/ bin/python
1
+ #!/usr/bin/python
2
2
"""Thios is Jenkins HTTP check remote modue."""
3
3
import sys
4
4
import os
10
10
11
11
12
12
# Parse config file
13
- with open ("config.yaml" , 'r' ) as stream :
13
+ with open ("/app/cfg/ config.yaml" , 'r' ) as stream :
14
14
try :
15
15
config = yaml .load (stream )
16
16
except yaml .YAMLError as exc :
17
17
print (exc )
18
18
sys .exit (1 )
19
+ except IOError as e :
20
+ print (("Config file not found: {0}" ).format (e ))
21
+ sys .exit (1 )
19
22
20
23
cfg_metrics = config ['metrics' ]
21
24
@@ -63,7 +66,7 @@ def host_ping():
63
66
api .Metric .send (
64
67
metric = 'jenkins.healthcheck.ping' ,
65
68
host = config ['host' ],
66
- points = 1 ,
69
+ points = 0 ,
67
70
tags = ping_tag ,
68
71
type = 'gauge'
69
72
)
@@ -83,10 +86,10 @@ def report_healthcheck():
83
86
sys .exit (1 )
84
87
# populate mentrics tags
85
88
for check in healthcheck .keys ():
86
- if healthcheck [check ]['healthy' ] == 'true' :
87
- check_value = 1
88
- else :
89
+ if healthcheck [check ]['healthy' ] is True :
89
90
check_value = 0
91
+ else :
92
+ check_value = 1
90
93
api .Metric .send (
91
94
metric = ("jenkins.healthcheck.{0}" ).format (check ),
92
95
host = config ['host' ],
You can’t perform that action at this time.
0 commit comments