annotate dash.py @ 20:1a13a4ecf931

can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
author sean
date Wed, 12 Aug 2015 13:45:58 +0200
parents be6a1aaec717
children f730dd0bcf85
rev   line source
4
3e66e2f92770 added LICENSE and license headers in the sourcecode. Added readme
sean
parents: 3
diff changeset
1 """
3e66e2f92770 added LICENSE and license headers in the sourcecode. Added readme
sean
parents: 3
diff changeset
2 This software is part of "Bottledash"
3e66e2f92770 added LICENSE and license headers in the sourcecode. Added readme
sean
parents: 3
diff changeset
3 author: sean engelhardt > sean.engelhardt@intevation.de
3e66e2f92770 added LICENSE and license headers in the sourcecode. Added readme
sean
parents: 3
diff changeset
4 license: GNU >= V2. See LICENSE for details
3e66e2f92770 added LICENSE and license headers in the sourcecode. Added readme
sean
parents: 3
diff changeset
5 """
3e66e2f92770 added LICENSE and license headers in the sourcecode. Added readme
sean
parents: 3
diff changeset
6
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
7 from bottle import get, post, request, view, response, route
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
8 from bottle import template, run, static_file, error
19
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
9 import os.path, sys, configparser, functools, bottle
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
10 import logging
0
e1264e58154c initial commpit
sean
parents:
diff changeset
11
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
12 CONFIG_FILE = "dash.conf"
8
8fc4db85f2f5 fixed a path error
sean
parents: 7
diff changeset
13 PATH = os.path.abspath(os.path.dirname(sys.argv[0]))
8fc4db85f2f5 fixed a path error
sean
parents: 7
diff changeset
14 CONFIG_PATH = PATH + "/" + CONFIG_FILE
8fc4db85f2f5 fixed a path error
sean
parents: 7
diff changeset
15
9
b06cb7fbf7f8 updated template paths for daemon usage
sean
parents: 8
diff changeset
16 # Create a new list with absolute paths
b06cb7fbf7f8 updated template paths for daemon usage
sean
parents: 8
diff changeset
17 MY_TEMPLATE_PATH = [
10
d71f39618d6f used another workaround to locate the correct template
sean
parents: 9
diff changeset
18 os.path.abspath(os.path.join(os.path.dirname(__file__), './views')),
9
b06cb7fbf7f8 updated template paths for daemon usage
sean
parents: 8
diff changeset
19 ]
b06cb7fbf7f8 updated template paths for daemon usage
sean
parents: 8
diff changeset
20
b06cb7fbf7f8 updated template paths for daemon usage
sean
parents: 8
diff changeset
21 # Patch @view() so it uses the customized path list instead of the global one
b06cb7fbf7f8 updated template paths for daemon usage
sean
parents: 8
diff changeset
22 view = functools.partial(bottle.view, template_lookup=MY_TEMPLATE_PATH)
b06cb7fbf7f8 updated template paths for daemon usage
sean
parents: 8
diff changeset
23
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
24 tiles = []
7
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
25 settings = {}
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
26
7
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
27 default_settings = configparser.ConfigParser()
19
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
28 default_settings['settings'] = {'show_top_bar': False, 'rows': 2}
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
29
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
30 #logging:
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
31
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
32 logger = logging.getLogger('myapp')
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
33 hdlr = logging.FileHandler(PATH + '/bottledash.log')
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
34 formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
35 hdlr.setFormatter(formatter)
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
36 logger.addHandler(hdlr)
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
37 logger.setLevel(logging.INFO)
7
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
38
20
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
39 ### debug function: prints the current status of the "tiles" in
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
40 ### the log-file
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
41 def log_tile_status():
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
42 global tiles
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
43
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
44 try:
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
45 for tile in tiles:
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
46 logger.info("found tile : " + str(tile))
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
47 for option in tiles[0]:
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
48 logger.info(str(option) + ' : ' + str(tile[option]))
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
49 except KeyError:
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
50 pass
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
51
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
52 ###read the config file. usually "dash.conf"
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
53 def read_config():
20
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
54 global settings
8
8fc4db85f2f5 fixed a path error
sean
parents: 7
diff changeset
55 # print(PATH)
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
56
8
8fc4db85f2f5 fixed a path error
sean
parents: 7
diff changeset
57 if os.path.isfile(CONFIG_PATH) == False:
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
58 write_default_config()
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
59
20
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
60 # print("read existing config file...")
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
61 config = configparser.ConfigParser()
8
8fc4db85f2f5 fixed a path error
sean
parents: 7
diff changeset
62 config.read(CONFIG_PATH)
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
63
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
64 for section in config.items():
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
65 if "tile" in section[0]:
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
66 tiles.append(section[1])
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
67
20
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
68 ###log read tiles
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
69 logger.info("------- read tiles --------")
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
70 log_tile_status()
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
71
7
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
72 try:
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
73 if config["settings"]:
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
74 settings = config["settings"]
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
75 else:
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
76 settings = default_settings["settings"]
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
77 except KeyError:
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
78 settings = default_settings["settings"]
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
79
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
80 ###write the default condfig file if there is none
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
81 def write_default_config():
8
8fc4db85f2f5 fixed a path error
sean
parents: 7
diff changeset
82 print("there is no Config file! Creating one...")
8fc4db85f2f5 fixed a path error
sean
parents: 7
diff changeset
83 file = open(CONFIG_PATH, "w")
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
84 file.write("""
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
85 ### bottledash default configuration
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
86 ### created by sean engelhardt >sean.engelhardt@intevation.de
7
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
87 ### license: GNU GPL >= v2. See LICENSE for details
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
88 ###
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
89 ### Usage:
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
90 ### define the tiles for the dashboard in sections
7
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
91
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
92 # Settings:
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
93 # example:
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
94 # --------------------
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
95 # [settings]
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
96 # show_top_bar=True
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
97 # --------------------
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
98 # options:
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
99 # show_top_bar (True / False) [optional]
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
100 # If True, the dashboard will show the current date and the time on the top
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
101 # if False, the dashboard will not show a top-bar
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
102 # default: True
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
103 # hint: the top-bar has got a height of 5%!
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
104
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
105 [settings]
14
3a9cb396905f made a template how to use the web_view module
sean
parents: 10
diff changeset
106 show_top_bar=False
7
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
107
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
108 # Tiles:
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
109 # example:
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
110 # --------------------
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
111 # [tile1]
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
112 # type=mon
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
113 # source=192.168.0.2
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
114 # status=up
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
115 # --------------------
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
116 # options:
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
117 # type (mon / d3js) [required]
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
118 # tells the program what kind of tile you need.
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
119 # a "mon" tile can be used for IT infrastructure monitoring purposes
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
120 # a d3js tile can be used to display a chart
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
121 # default: -
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
122 #
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
123 # source (<IP> or <FQDN>) [required for mon-types]
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
124 # ONLY FOR MON-Type tiles!
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
125 # tells the tile which resource to watch
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
126 # default: none
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
127 #
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
128 # status: (up / down) [required]
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
129 # ONLY FOR DEBUGGING PURPOSE - WILL BE REMOVED LATER
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
130 # simulates up and down events for mon-type-tiles
14
3a9cb396905f made a template how to use the web_view module
sean
parents: 10
diff changeset
131 #
3a9cb396905f made a template how to use the web_view module
sean
parents: 10
diff changeset
132 # div_name: (identifier) [required for d3js-types]
3a9cb396905f made a template how to use the web_view module
sean
parents: 10
diff changeset
133 #
3a9cb396905f made a template how to use the web_view module
sean
parents: 10
diff changeset
134 # script: (name of a script without extension) [required for d3js-types0]
3a9cb396905f made a template how to use the web_view module
sean
parents: 10
diff changeset
135 #
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
136 [tile1]
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
137 type=mon
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
138 source=192.168.0.2
14
3a9cb396905f made a template how to use the web_view module
sean
parents: 10
diff changeset
139 status=down
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
140
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
141 [tile2]
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
142 type=mon
7
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
143 source=192.168.2.3
14
3a9cb396905f made a template how to use the web_view module
sean
parents: 10
diff changeset
144 status=up
7
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
145
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
146 [tile3]
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
147 type=mon
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
148 source=192.168.4.3
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
149 status=up
7
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
150
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
151 [tile4]
14
3a9cb396905f made a template how to use the web_view module
sean
parents: 10
diff changeset
152 type=d3js
3a9cb396905f made a template how to use the web_view module
sean
parents: 10
diff changeset
153 div_name=techintern
3a9cb396905f made a template how to use the web_view module
sean
parents: 10
diff changeset
154 script=display_issues_techintern
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
155 """)
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
156 file.close()
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
157
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
158 ##Bottle
0
e1264e58154c initial commpit
sean
parents:
diff changeset
159 @route('/')
15
82d66f4488cd renaming of some files
sean
parents: 14
diff changeset
160 @view('bottledash_view')
0
e1264e58154c initial commpit
sean
parents:
diff changeset
161 def call_dashboard():
7
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
162 return dict(tiles=tiles, settings=settings)
0
e1264e58154c initial commpit
sean
parents:
diff changeset
163
20
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
164 #wait for post-request which shall inform the system about running services
19
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
165 @post('/updown')
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
166 def updown():
20
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
167 global tiles
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
168
19
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
169 service = request.forms.get('service')
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
170 status = request.forms.get('status')
20
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
171 try:
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
172 for tile in tiles:
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
173 if tile["source"] == str(service):
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
174 tile["status"] = str(status)
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
175 except KeyError:
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
176 logger.info("this tile got no source : " + str(tile))
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
177
19
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
178
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
179 logger.info('------- new alert --------')
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
180 logger.info('Service : ' + str(service))
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
181 logger.info('Status : ' + str(status))
20
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
182 log_tile_status()
19
be6a1aaec717 added the post listener, write logs if someone sends a post
sean
parents: 15
diff changeset
183
20
1a13a4ecf931 can not recive post-requests wich should deliver if a server is up or down. Updated after a refresh of the webpage, wich will automatically done after 5 seconds
sean
parents: 19
diff changeset
184 return "thanks for informing bottledash! :: " + str(service) + " is " + str(status) + " !"
0
e1264e58154c initial commpit
sean
parents:
diff changeset
185
e1264e58154c initial commpit
sean
parents:
diff changeset
186 @error(404)
e1264e58154c initial commpit
sean
parents:
diff changeset
187 def error404(error):
e1264e58154c initial commpit
sean
parents:
diff changeset
188 return 'Nothing here, sorry <br /> 404'
e1264e58154c initial commpit
sean
parents:
diff changeset
189
3
3f5bcad45756 pars a .conf | dynamic adding of divs | dynamiv VP scaling
sean
parents: 0
diff changeset
190 read_config()
7
c8cb2aa0b72c fixed default condifuration
sean
parents: 5
diff changeset
191 # print(tiles)
9
b06cb7fbf7f8 updated template paths for daemon usage
sean
parents: 8
diff changeset
192 run(host='localhost', port=8080, debug=True)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)