php - Best method of retrieving stats from multiple machines on local network -
so im building application monitors rasp pi based devices on network. devices running program provides statistical array devices performance need log, can access array via socket connection device on port. network has 100 of these devices grow several hundreds of devices on single network.
currently application approached deploying script via ssh2_scp each of devices, application running through list of local ips , using stream_context_create && get_file_contents ping monitoring file on remote devices. monitoring file, gets stat array local machine $_posts data app stores in db.
this not ideal @ moment im recording takes around 1.45mins cycle through ip's check them (in cheat fashion using counter $i++ , while cycle through range of numbers rather getting ips database need when more ips added , new locations) , retrieve results , insert them db, cron job set run ping script every 2mins, number of devices increases go on 2minute periodical gap , start backlogs of data. problem there isn't method of checking weather stream contexts retrieves data, or check if device operating correctly data submitted separately.
the server application sitting on massive beast computational power on side not problem, on rasp pi devices it's running id prefer not run web server, @ maybe inbuilt php web server, id prefer them not run web server security, fact primary aim not web server.
i've been looking @ running php daemon services command line, , wondering if better suited run monitor application daemon services establish socket connections directly machines retrieve data , forth. if go down road how approach it, create daemon script monitored devices listened on port , returned stat array through that, monitoring application daemon establish connections each devices , feed data in?
any advice on best method/most efficient way of doing highly appreciated
you can access array via socket connection device on port.
i create script accepted range of hosts parameter, hit port netcat. script iterates through specified hosts, , dumps results database. alleviates rasp pi side execution. scalability, run multiple of scripts, each different ranges of devices simultaneously on beastly server.
Comments
Post a Comment