Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Poduptime
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
diasporg
Poduptime
Commits
32ba3075
Unverified
Commit
32ba3075
authored
Jan 20, 2017
by
dmorley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gather enough stats on our own for longterm use
parent
7f7f8db8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
5 deletions
+10
-5
db/migration00001.sql
db/migration00001.sql
+1
-0
db/pull.php
db/pull.php
+8
-5
db/tables.sql
db/tables.sql
+1
-0
No files found.
db/migration00001.sql
View file @
32ba3075
...
...
@@ -40,5 +40,6 @@ CREATE TABLE checks (
domain
text
,
online
boolean
,
error
text
,
ttl
numeric
(
8
,
6
),
date_checked
timestamp
DEFAULT
current_timestamp
);
db/pull.php
View file @
32ba3075
...
...
@@ -107,26 +107,29 @@ while ($row = pg_fetch_assoc($result)) {
$outputssl
=
curl_exec
(
$chss
);
$outputsslerror
=
curl_error
(
$chss
);
$info
=
curl_getinfo
(
$chss
,
CURLINFO_CERTINFO
);
$ttl
=
curl_getinfo
(
$chss
,
CURLINFO_CONNECT_TIME
);
$sslexpire
=
$info
[
0
][
'Expire date'
]
??
null
;
curl_close
(
$chss
);
_debug
(
'Nodeinfo output'
,
$outputssl
,
true
);
_debug
(
'Nodeinfo output error'
,
$outputsslerror
,
true
);
_debug
(
'Cert expire date'
,
$sslexpire
);
_debug
(
'TTL'
,
$ttl
);
//get new json from nodeinfo
$jsonssl
=
json_decode
(
$outputssl
);
if
(
!
$jsonssl
)
{
_debug
(
'Connection'
,
'Can not connect to pod'
);
$sql_errors
=
'INSERT INTO checks (domain, online, error
) VALUES ($1, $2, $3
)'
;
$result_errors
=
pg_query_params
(
$dbh
,
$sql_errors
,
[
$domain
,
(
int
)
false
,
$outputsslerror
]);
$sql_errors
=
'INSERT INTO checks (domain, online, error
, ttl) VALUES ($1, $2, $3, $4
)'
;
$result_errors
=
pg_query_params
(
$dbh
,
$sql_errors
,
[
$domain
,
(
int
)
false
,
$outputsslerror
,
$ttl
]);
$result_errors
||
die
(
'Error in SQL query: '
.
pg_last_error
());
}
if
(
$jsonssl
!==
null
)
{
$sql_checks
=
'INSERT INTO checks (domain, online
) VALUES ($1, $2
)'
;
$result_checks
=
pg_query_params
(
$dbh
,
$sql_checks
,
[
$domain
,
(
int
)
true
]);
$sql_checks
=
'INSERT INTO checks (domain, online
, ttl) VALUES ($1, $2, $3
)'
;
$result_checks
=
pg_query_params
(
$dbh
,
$sql_checks
,
[
$domain
,
(
int
)
true
,
$ttl
]);
$result_checks
||
die
(
'Error in SQL query: '
.
pg_last_error
());
(
!
$jsonssl
->
software
->
version
)
||
$score
+=
1
;
...
...
db/tables.sql
View file @
32ba3075
...
...
@@ -76,6 +76,7 @@ CREATE TABLE checks (
domain
text
,
online
boolean
,
error
text
,
ttl
numeric
(
8
,
6
),
date_checked
timestamp
DEFAULT
current_timestamp
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment