diff --git a/README.md b/README.md index 5f8a017..9febbe9 100755 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ ## For < 1.0 version (Legacy sqlite3 and simpler version), go here: https://gitlab.com/JKANetwork/CheckServer/tree/v0.9.4 -# CheckServer (New) +# CheckServer -CheckServer is a PHP app that monitor (using crons) some parameters in servers, ping to it, services, and views simple stadistics. +CheckServer is a PHP app that monitor (using cron) some parameters in servers, ping to it, services, and views simple stadistics. It only needs PHP, MySQL, and for talking with Windows machines, Linux wmi-client package (I'm open to change with a PHP library that works) Also has a index stadistics page for guests (Not logued) @@ -16,11 +16,10 @@ Also has a index stadistics page for guests (Not logued) - Cron # Bugs -- Ping needs root because socket use in some distros, can be used in cron +- Ping needs root because socket use in some distros, only will refresh in cron (Run php as root in cron). # Install -Download last version from https://gitlab.com/JKANetwork/CheckServer/tags (not git master, reason -below. Think of tags as releases), unzip it and copy all to the folder in your hosting. +Download last version from https://gitlab.com/JKANetwork/CheckServer/tags (Tags=Releases, master is not released quality code), unzip it and copy all to the folder in your hosting. Go to browser, /install.php and follow the installer @@ -32,9 +31,11 @@ For finishing it, you have to add a cron in your system for running checks. The # TODO -Allow http response views +- Allow http response views -At future, read sensors in routers/switchs/SNMP +- WMI support for Windows servers + +- At future, read sensors in routers/switchs/SNMP # Changelog diff --git a/functions.php b/functions.php index f33d915..aef0a36 100644 --- a/functions.php +++ b/functions.php @@ -164,7 +164,10 @@ function ping($ip, $timeout = 2,$rTimes = 2) { while ($retry < $rTimes){ //Retry rTimes times if fail //Create ICMP socket and see if works $package = "\x08\x00\x7d\x4b\x00\x00\x00\x00PingHost"; - $socket = socket_create(AF_INET, SOCK_RAW, 1); + $socket = socket_create(AF_INET, SOCK_RAW, 1); + if ($socket == FALSE){ //If not works, please don't continue. + break; + } socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => $timeout, 'usec' => 0)); socket_connect($socket, $ip, null);