PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : مانیتورینگ ساست php script for monitoring website



IrIsT
August 14th, 2016, 12:11
سلام و درود.
یک اسکریپت میذارم برای دوستان عزیز monitoring website on php
که این اسکرپیت جهت چک کردن افلاین یا انلاین بودن سایت و ایمیل دادن به صاحب سایت کاربرد داره




<?php
function checkURL($url) {

//array of emails to send warning
$adminEmails=array("admin1@t-zones.sk","admin2@vodafonemail.cz");
//email of sender
$senderEmail="monitoring@domain.tld";
//array of valid http codes
$validStatus=array(200,301,302);
//minimum filesize in bytes
$minFileSize=500;

if(!function_exists('curl_init')) die("Curl PHP package not installed!");

$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response=curl_exec($ch);
$info=curl_getinfo($ch);
$statusCode=intval($info['http_code']);
$filesize=$info['size_download'];

if(!in_array($statusCode,$validStatus) || $filesize<$minFileSize) {
$message = "Web ERROR ($url) - Status Code: $statusCode, Filesize: $filesize\r\n";
foreach($adminEmails as $email) {
mail($email, "Web Monitoring ERROR", $message, "From: $senderEmail\r\nReply-To: $senderEmail\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=UTF-8\r\n");
}
}
}

checkURL("http://google.com/");
?>

vmpanel.ir
August 14th, 2016, 16:32
با سلام

ممنون از شما دوست گرامي ولي تا زماني كه سايتهاي قدرتمندي مانند https://uptimerobot.com هست . بهتره از اين سايتها استفاده كنيد .

IrIsT
August 14th, 2016, 16:45
با سلام

ممنون از شما دوست گرامي ولي تا زماني كه سايتهاي قدرتمندي مانند https://uptimerobot.com هست . بهتره از اين سايتها استفاده كنيد .

سلام و درود.من سایتی رو ندیدیم که کلا رایگان باشه.تریال داره اما چند روز.اما با اسکریپت راحت میصه چک کرد.حنی اگه یکی بلد باشه sms و یا ایمبل رو که این راحتهوفعال کنه،خیلی استفادهومیصه کرد
دوستان اگه کد دیگه ایودارند بذارند

vmpanel.ir
August 14th, 2016, 17:02
سايتي كه خدمتتون دادم كاملا رايگان الان چند سال است استفاده ميكنيم
https://uptimerobot.com

IrIsT
August 16th, 2016, 13:21
سلام و درود
یک اسکریپت دیگه برای مانیتور کردن سرور برای صما قرار میدم
این اسکریپت در صورت بالا رفتن لود سایت ایمیل میده.با bash نوشته شده که میتونید داخل کرون جاب قرار بدین تاچند دقیقه یک بار چک کنه




#!/bin/bash

We set a trigger for how high the load can get before we're
alerted via e-mail from this script.
trigger=4.00

We set a load variable to read the current server load from
/proc/loadavg and only from the first column which is the live load.
load=`cat /proc/loadavg | awk '{print $1}'`

We set a response variable to the word "greater" if the current
load is greater than our trigger that we set.
response=`echo | awk -v T=$trigger -v L=$load 'BEGIN{if ( L > T){ print "greater"}}'`

If the response is set to "greater" we run the sar -q command
and pipe | that data to the mail command for recipient@example.com
this sends an e-mail with the server's recent load averages there.
if [[ $response = "greater" ]]
then
sar -q | mail -s"High load on server - [ $load ]" iedb.team@gmail.com
fi



موفق باشید.

mohsen_sh
August 16th, 2016, 15:43
سايتي كه خدمتتون دادم كاملا رايگان الان چند سال است استفاده ميكنيم
https://uptimerobot.com


دوست من آپتایم روبوت رو همه می شناسیم
ولی نصب همچین اسکریپتی به نظر من خوبه و ضرر نداره!




به هرحال تشکر از استارتر عزیز