\FastPing
Fast ping implementation
Synopsis
class FastPing
{
- // constants
- const PID_NAME = 'FASTPING';
- const CACHE_KEY = 'FASTPING';
- const CACHE_DEAD = 'FASTDEAD';
- const LIST_PATH = 'exports/fastping_iplist';
- const MASK_ALIVE = 'is alive';
- const CACHE_TIMEOUT = 2592000;
- // members
- protected array $altCfg = ;
- protected array $billCfg = ;
- protected $pid = '';
- protected $cache = '';
- protected array $cachedData = ;
- protected array $deadCache = ;
- protected string $sudoPath = '/usr/local/bin/sudo';
- protected string $fpingPath = '/usr/local/sbin/fping -r 1 -t 10';
- // methods
- public void __construct()
- protected void loadConfigs()
- protected void setOptions()
- protected void initStarDust()
- protected void initCache()
- protected void loadCache()
- protected void saveCache()
- public array getAllStates()
- public int getState()
- public bool isAlive()
- public bool isDead()
- protected array runPing()
- public array repingDevices()
Constants
Name | Value |
---|---|
PID_NAME | 'FASTPING' |
CACHE_KEY | 'FASTPING' |
CACHE_DEAD | 'FASTDEAD' |
LIST_PATH | 'exports/fastping_iplist' |
MASK_ALIVE | 'is alive' |
CACHE_TIMEOUT | 2592000 |
Members
protected
- $altCfg
—
array
Contains system alter.ini config as key=>value - $billCfg
—
array
Contains system billing.ini config as key=>value - $cache
—
System caching engine instance placeholder - $cachedData
—
array
Contains cached data from previous runs as ip=>state[1/0] - $deadCache
—
array
Contains cached dead devices data as ip=>location - $fpingPath
—
string
Contains default fping path - $pid
—
StarDust process manager instance placeholder - $sudoPath
—
string
Contains system sudo full path
Methods
protected
- initCache() — Inits system cache
- initStarDust() — Inits system process manager
- loadCache() — Loads previous runs results into protected property cachedData
- loadConfigs() — Loads all required configs in protected propeties for futher usage
- runPing() — Runs fping system binary and returns it result
- saveCache() — Saves fastping results to cache
- setOptions() — Sets required system options
public
- __construct()
- getAllStates() — Returns all devices states from previous run
- getState() — Returns selected IP last state
- isAlive() — Performs fast check is some IP alive?
- isDead() — Performs fast check is some IP dead?
- repingDevices() — Performs fast ping of all available active devices from switches directory