1
0
mirror of https://gitlab.com/JKANetwork/CheckServer.git synced 2026-02-15 17:51:39 +01:00

Don't throw too much errors if not root ping

This commit is contained in:
2020-10-17 13:39:24 +02:00
parent b907ed0765
commit 2e88377665
2 changed files with 12 additions and 8 deletions

View File

@@ -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

View File

@@ -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);