Skip to content

Commit 6dc94e5

Browse files
committed
final version with file log and cron-ready management function
1 parent 1f30bb4 commit 6dc94e5

File tree

5 files changed

+94
-5
lines changed

5 files changed

+94
-5
lines changed

db/default.db

8 KB
Binary file not shown.

hping.log

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
[SUCCESS] http://google.com @ 2013-07-22 18:26:40.585947+00:00: got 200 response in 0.357029914856ms and requirement SUCCESS
2+
[FAILED] http:/gazeta.pl @ 2013-07-22 18:26:40.629463+00:00: got 0 response in 9.89437103271e-05ms and requirement SUCCESS
3+
[SUCCESS] http://microsoft.com @ 2013-07-22 18:26:42.997515+00:00: got 200 response in 2.32547211647ms and requirement SUCCESS
4+
[SUCCESS] http://youtube.com @ 2013-07-22 18:26:43.793934+00:00: got 200 response in 0.743886947632ms and requirement SUCCESS
5+
[SUCCESS] http://yahoo.com @ 2013-07-22 18:26:45.815585+00:00: got 200 response in 1.96936607361ms and requirement SUCCESS
6+
[SUCCESS] http://live.com @ 2013-07-22 18:26:47.817769+00:00: got 200 response in 1.95135784149ms and requirement SUCCESS
7+
[SUCCESS] http://msn.com @ 2013-07-22 18:26:49.093004+00:00: got 200 response in 1.22828102112ms and requirement SUCCESS
8+
[SUCCESS] http://google.com @ 2013-07-22 18:29:46.794833+00:00: got 200 response in 0.358870029449ms and requirement SUCCESS
9+
[FAILED] http:/gazeta.pl @ 2013-07-22 18:29:46.842343+00:00: got 0 response in 0.000125169754028ms and requirement SUCCESS
10+
[SUCCESS] http://microsoft.com @ 2013-07-22 18:29:49.235710+00:00: got 200 response in 2.33428812027ms and requirement SUCCESS
11+
[SUCCESS] http://youtube.com @ 2013-07-22 18:29:50.097583+00:00: got 200 response in 0.810618877411ms and requirement SUCCESS
12+
[SUCCESS] http://yahoo.com @ 2013-07-22 18:29:51.643261+00:00: got 200 response in 1.49449801445ms and requirement SUCCESS
13+
[SUCCESS] http://live.com @ 2013-07-22 18:29:53.607982+00:00: got 200 response in 1.91315889359ms and requirement SUCCESS
14+
[SUCCESS] http://msn.com @ 2013-07-22 18:29:55.086773+00:00: got 200 response in 1.43039608002ms and requirement SUCCESS
15+
[SUCCESS] http://google.com @ 2013-07-22 18:37:45.346300+00:00: got 200 response in 0.430261135101ms and requirement SUCCESS
16+
[FAILED] http:/gazeta.pl @ 2013-07-22 18:37:45.395076+00:00: got 0 response in 0.000103950500488ms and requirement SUCCESS
17+
[SUCCESS] http://microsoft.com @ 2013-07-22 18:37:47.793779+00:00: got 200 response in 2.35330486298ms and requirement SUCCESS
18+
[SUCCESS] http://youtube.com @ 2013-07-22 18:37:48.705787+00:00: got 200 response in 0.859516859055ms and requirement SUCCESS
19+
[FAILED] http://yahoo.com @ 2013-07-22 18:37:50.397728+00:00: got 200 response in 1.64185500145ms and requirement FAILED
20+
[FAILED] http://live.com @ 2013-07-22 18:37:52.685535+00:00: got 200 response in 2.24259805679ms and requirement FAILED
21+
[FAILED] http://msn.com @ 2013-07-22 18:37:54.296192+00:00: got 200 response in 1.55136489868ms and requirement FAILED
22+
[SUCCESS] http://google.com @ 2013-07-22 18:38:43.155890+00:00: got 200 response in 0.314653158188ms and requirement SUCCESS
23+
[FAILED] http:/gazeta.pl @ 2013-07-22 18:38:43.213777+00:00: got 0 response in 0.000105857849121ms and requirement SUCCESS
24+
[SUCCESS] http://microsoft.com @ 2013-07-22 18:38:45.625889+00:00: got 200 response in 2.33361506462ms and requirement SUCCESS
25+
[SUCCESS] http://youtube.com @ 2013-07-22 18:38:46.401619+00:00: got 200 response in 0.72292304039ms and requirement SUCCESS
26+
[FAILED] http://yahoo.com @ 2013-07-22 18:38:47.968741+00:00: got 200 response in 1.5173740387ms and requirement FAILED
27+
[FAILED] http://live.com @ 2013-07-22 18:38:50.149390+00:00: got 200 response in 2.1292090416ms and requirement FAILED
28+
[FAILED] http://msn.com @ 2013-07-22 18:38:51.513618+00:00: got 200 response in 1.31335306168ms and requirement FAILED
29+
[SUCCESS] http://google.com @ 2013-07-22 18:40:24.566642+00:00: got 200 response in 0.375428915024ms and requirement SUCCESS
30+
[SUCCESS] http://google.com @ 2013-07-22 18:40:54.979030+00:00: got 200 response in 0.360522031784ms and requirement SUCCESS
31+
[FAILED] http:/gazeta.pl @ 2013-07-22 18:40:55.116494+00:00: got 0 response in 0.000169992446899ms and requirement FAILED
32+
[SUCCESS] http://microsoft.com @ 2013-07-22 18:40:57.432474+00:00: got 200 response in 2.23070311546ms and requirement SUCCESS
33+
[SUCCESS] http://youtube.com @ 2013-07-22 18:40:58.342546+00:00: got 200 response in 0.766290903091ms and requirement SUCCESS
34+
[FAILED] http://yahoo.com @ 2013-07-22 18:41:00.144727+00:00: got 200 response in 1.71389198303ms and requirement FAILED
35+
[FAILED] http://live.com @ 2013-07-22 18:41:02.236469+00:00: got 200 response in 2.00373411179ms and requirement FAILED
36+
[FAILED] http://msn.com @ 2013-07-22 18:41:03.618546+00:00: got 200 response in 1.24588990211ms and requirement FAILED
37+
[FAILED] http://google.com @ 2013-07-22 18:49:17.012118+00:00: got 200 response in 0.415549039841ms and requirement FAILED
38+
[FAILED] http:/gazeta.pl @ 2013-07-22 18:49:17.059858+00:00: got 0 response in 9.98973846436e-05ms and requirement FAILED
39+
[FAILED] http://microsoft.com @ 2013-07-22 18:49:19.464935+00:00: got 200 response in 2.35861086845ms and requirement FAILED
40+
[FAILED] http://youtube.com @ 2013-07-22 18:49:20.392305+00:00: got 200 response in 0.878509044647ms and requirement FAILED
41+
[FAILED] http://yahoo.com @ 2013-07-22 18:49:22.084877+00:00: got 200 response in 1.64701080322ms and requirement FAILED
42+
[FAILED] http://live.com @ 2013-07-22 18:49:24.319108+00:00: got 200 response in 2.16799497604ms and requirement FAILED
43+
[FAILED] http://msn.com @ 2013-07-22 18:49:25.668847+00:00: got 200 response in 1.30241203308ms and requirement FAILED
44+
[SUCCESS] http://google.com @ 2013-07-22 18:51:27.342956+00:00: got 200 response in 0.360445022583ms and requirement SUCCESS
45+
[FAILED] http:/gazeta.pl @ 2013-07-22 18:51:27.450176+00:00: got 0 response in 0.000180959701538ms and requirement FAILED
46+
[SUCCESS] http://microsoft.com @ 2013-07-22 18:51:29.998007+00:00: got 200 response in 2.36105489731ms and requirement SUCCESS
47+
[SUCCESS] http://youtube.com @ 2013-07-22 18:51:30.938988+00:00: got 200 response in 0.735389947891ms and requirement SUCCESS
48+
[FAILED] http://yahoo.com @ 2013-07-22 18:51:32.693755+00:00: got 200 response in 1.54417610168ms and requirement FAILED
49+
[FAILED] http://live.com @ 2013-07-22 18:51:34.902870+00:00: got 200 response in 2.10565900803ms and requirement FAILED
50+
[FAILED] http://msn.com @ 2013-07-22 18:51:36.471016+00:00: got 200 response in 1.41563391685ms and requirement FAILED
51+
[SUCCESS] http://google.com @ 2013-07-22 19:00:59.498918+00:00: got 200 response in 0.387929201126ms and requirement SUCCESS
52+
[FAILED] http:/gazeta.pl @ 2013-07-22 19:00:59.548242+00:00: got 0 response in 0.000102043151855ms and requirement FAILED
53+
[SUCCESS] http://microsoft.com @ 2013-07-22 19:01:02.062791+00:00: got 200 response in 2.46556901932ms and requirement SUCCESS
54+
[SUCCESS] http://youtube.com @ 2013-07-22 19:01:02.997482+00:00: got 200 response in 0.881413936615ms and requirement SUCCESS
55+
[FAILED] http://yahoo.com @ 2013-07-22 19:01:04.847265+00:00: got 200 response in 1.7766020298ms and requirement FAILED
56+
[SUCCESS] http://live.com @ 2013-07-22 19:01:06.965750+00:00: got 200 response in 2.06510305405ms and requirement SUCCESS
57+
[FAILED] http://msn.com @ 2013-07-22 19:01:08.179075+00:00: got 200 response in 1.16950702667ms and requirement FAILED
58+
[SUCCESS] http://google.com @ 2013-07-22 19:23:44.889797+00:00: got 200 response in 0.409160137177ms and requirement SUCCESS
59+
[FAILED] http:/gazeta.pl @ 2013-07-22 19:23:44.940589+00:00: got 0 response in 0.000101804733276ms and requirement FAILED
60+
[SUCCESS] http://microsoft.com @ 2013-07-22 19:23:47.446509+00:00: got 200 response in 2.43411898613ms and requirement SUCCESS
61+
[SUCCESS] http://youtube.com @ 2013-07-22 19:23:48.510266+00:00: got 200 response in 0.986694097519ms and requirement SUCCESS
62+
[FAILED] http://yahoo.com @ 2013-07-22 19:23:50.257954+00:00: got 200 response in 1.67286896706ms and requirement FAILED
63+
[SUCCESS] http://live.com @ 2013-07-22 19:23:52.577776+00:00: got 200 response in 2.20936512947ms and requirement SUCCESS
64+
[FAILED] http://msn.com @ 2013-07-22 19:23:54.171253+00:00: got 200 response in 1.53267002106ms and requirement FAILED

settings/common.py

+19-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
5858
# although not all choices may be available on all operating systems.
5959
# In a Windows environment this must be set to your system time zone.
60-
TIME_ZONE = 'America/Chicago'
60+
TIME_ZONE = 'Europe/Warsaw'
6161

6262
# Language code for this installation. All choices can be found here:
6363
# http://www.i18nguy.com/unicode/language-identifiers.html
@@ -170,12 +170,25 @@
170170
'()': 'django.utils.log.RequireDebugFalse'
171171
}
172172
},
173+
'formatters': {
174+
'verbose': {
175+
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
176+
},
177+
'simple': {
178+
'format': '%(levelname)s %(message)s'
179+
},
180+
},
173181
'handlers': {
174182
'mail_admins': {
175183
'level': 'ERROR',
176184
'filters': ['require_debug_false'],
177185
'class': 'django.utils.log.AdminEmailHandler'
178-
}
186+
},
187+
'console':{
188+
'level': 'DEBUG',
189+
'class': 'logging.StreamHandler',
190+
'formatter': 'simple'
191+
},
179192
},
180193
'loggers': {
181194
'django.request': {
@@ -185,3 +198,7 @@
185198
},
186199
}
187200
}
201+
202+
########## LOGFILE CONFIGURATION
203+
LOGFILE = normpath(join(DJANGO_ROOT, 'hping.log'))
204+
########## END LOGFILE CONFIGURATION

settings/dev.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,12 @@
55
########## DEBUG CONFIGURATION
66
DEBUG = True
77
TEMPLATE_DEBUG = DEBUG
8-
########## END DEBUG CONFIGURATION
8+
########## END DEBUG CONFIGURATION
9+
10+
LOGGING['loggers'].update({
11+
'pinger': {
12+
'handlers': ['console'],
13+
'level': 'DEBUG',
14+
'propagate': True,
15+
},
16+
})

templates/pinger/haystack_list.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ <h2>Actions</h2>
99
<dd> Add new services to be monitored from file </dd>
1010
<dt><a href="{% url "hay_run" %}"> <i class="icon-play"></i> Run manually now</a> </dt>
1111
<dd> Refresh monitored url status now </dd>
12-
<dt><a href="{% url "hay_upload" %}"> <i class="icon-list"></i> View logs</a> </dt>
12+
<dt><a href="{% url "hay_log" num=50 %}"> <i class="icon-list"></i> View logs</a> </dt>
1313
<dd> View logfile from monitoring events </dd>
1414
</dl>
1515
<h2>List of monitored urls</h2>
@@ -28,7 +28,7 @@ <h2>List of monitored urls</h2>
2828
</thead>
2929
<tbody>
3030
{% for straw in object_list %}
31-
<tr {% if straw.last_error > straw.last_ok %}class="error" {% endif %}>
31+
<tr {% if straw.last_error > straw.last_ok or straw.last_error != None and straw.last_ok == Null %}class="error" {% endif %}>
3232
<td>{{ straw.pk }}</td>
3333
<td><strong>{{ straw.name }}</strong></td>
3434
<td><strong>{{ straw.url }}</strong></td>

0 commit comments

Comments
 (0)