Adding FTP (anonymous) check

This commit is contained in:
Axel 2021-12-28 17:41:52 +01:00
parent dde679411a
commit 42f1187776
4 changed files with 14 additions and 7 deletions

View file

@ -119,7 +119,11 @@ class RunMonitoring extends Command
break; break;
case 'http': case 'http':
$result = $this->checkHttp($task); $result = $this->checkRequest($task, CURLPROTO_HTTP | CURLPROTO_HTTPS);
break;
case 'ftp':
$result = $this->checkRequest($task, CURLPROTO_FTP | CURLPROTO_FTPS);
break; break;
default: default:
@ -250,17 +254,19 @@ class RunMonitoring extends Command
return true; return true;
} }
final private function checkHttp(Task $task) { final private function checkRequest(Task $task, $protocol = CURLPROTO_HTTP | CURLPROTO_HTTPS) {
if (app()->environment() == 'local') { if (app()->environment() == 'local') {
//throw new MonitoringException('Forcing error for testing'); //throw new MonitoringException('Forcing error for testing');
} }
// Preparing cURL // Preparing cURL
$opts = [ $opts = [
CURLOPT_HEADER => true, CURLOPT_HEADER => true,
CURLOPT_HTTPGET => true, CURLOPT_HTTPGET => true,
CURLOPT_FRESH_CONNECT => true, CURLOPT_FRESH_CONNECT => true,
CURLOPT_PROTOCOLS => CURLPROTO_HTTP | CURLPROTO_HTTPS, CURLOPT_PROTOCOLS => $protocol,
CURLOPT_SSL_VERIFYHOST => 2, CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_RETURNTRANSFER => true, CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true, CURLOPT_FOLLOWLOCATION => true,

1
public/img/ftp.svg Normal file
View file

@ -0,0 +1 @@
<?xml version="1.0" ?><svg data-name="Layer 1" id="Layer_1" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path d="M7,25A7,7,0,0,1,7,11a1,1,0,0,1,0,2A5,5,0,0,0,7,23a1,1,0,0,1,0,2Z"/><path d="M25,25a1,1,0,0,1,0-2,5,5,0,0,0,0-10,1,1,0,0,1,0-2,7,7,0,0,1,0,14Z"/><path d="M25,13a1,1,0,0,1-1-1A8,8,0,0,0,8,12a1,1,0,0,1-2,0,10,10,0,0,1,20,0A1,1,0,0,1,25,13Z"/><path d="M21,22H11a1,1,0,0,1,0-2H21a1,1,0,0,1,0,2Z"/><path d="M21,28H11a1,1,0,0,1,0-2H21a1,1,0,0,1,0,2Z"/><path d="M21,28a1,1,0,0,1-.83-.45l-2-3a1,1,0,1,1,1.66-1.1l2,3a1,1,0,0,1-.28,1.38A.94.94,0,0,1,21,28Z"/><path d="M19,31a.94.94,0,0,1-.55-.17,1,1,0,0,1-.28-1.38l2-3a1,1,0,0,1,1.66,1.1l-2,3A1,1,0,0,1,19,31Z"/><path d="M13,25a1,1,0,0,1-.83-.45l-2-3a1,1,0,0,1,1.66-1.1l2,3a1,1,0,0,1-.28,1.38A.94.94,0,0,1,13,25Z"/><path d="M11,22a.94.94,0,0,1-.55-.17,1,1,0,0,1-.28-1.38l2-3a1,1,0,0,1,1.66,1.1l-2,3A1,1,0,0,1,11,22Z"/><path d="M9,25H7a1,1,0,0,1,0-2H9a1,1,0,0,1,0,2Z"/><path d="M25,25H23a1,1,0,0,1,0-2h2a1,1,0,0,1,0,2Z"/></svg>

After

Width:  |  Height:  |  Size: 989 B

File diff suppressed because one or more lines are too long

View file

@ -38,7 +38,7 @@
<a :href="task.host" target="_blank">{{ task.host }}</a> <a :href="task.host" target="_blank">{{ task.host }}</a>
</td> </td>
<td> <td>
<img :src="task.type == 'http' ? '/img/http.svg' : '/img/ping.svg'" width="16" alt="Type of check" :title="'Type: '+task.type" /> <img :src="'/img/'+task.type+'.svg'" width="16" alt="Type of check" :title="'Type: '+task.type" />
</td> </td>
<td> <td>
<span <span
@ -83,7 +83,7 @@ export default {
computed: { computed: {
tasks: function() { tasks: function() {
return this.$store.state.tasks return this.$store.state.tasks
} },
}, },
methods: { methods: {
statusText: function (status) { statusText: function (status) {