Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Okay our hoster has a Problem and they are fixing it. But still, does anyone know a package like this?
-
CptFox16166yUse cronjob to run a script that attempts some connection to something and logs failures ?
-
you can easily script things like that. Do you have root? What BASH version is in there? what's the OS?
[oh right, you've mentioned apt. So it's gotta be *buntu] -
#!/bin/bash
LOG_FILE="/tmp/outages.log";
PROBE_ADDR="googlesss.com";
PROBE_PORT="80";
result=$(nc -w 2 -vz "${PROBE_ADDR}" "${PROBE_PORT}" 2>&1) ;
failed=${?};
date >>"${LOG_FILE}";
echo "${result}" >>"${LOG_FILE}";
if [[ ${failed} -eq 1 ]] ; then
uptime >>"${LOG_FILE}";
route -n >>"${LOG_FILE}";
ifconfig -a >>"${LOG_FILE}";
ifconfig | awk '/Link/ {print $1}' | while read nic; do
ethtool ${nic} >>"${LOG_FILE}";
done;
nslookup "${PROBE_ADDR}" >>"${LOG_FILE}";
ping -c3 "${PROBE_ADDR}" >>"${LOG_FILE}";
traceroute "${PROBE_ADDR}" >>"${LOG_FILE}";
netstat -ntpla >>"${LOG_FILE}";
:;
printf "========================================\n\n" >>"${LOG_FILE}";
fi;
You can wrap this in a loop. Or add the script to cron to be triggered every x minutes.
Edit settings ofc with your probe inet address/port and log file address. Make sure you have all those tools installed -
ALSO have a look at dmesg output. And /var/log/{syslog,kern.log}. These are quite likely to suggest what has happened
Is there any package to install with apt to detect if the Server has no Internet connection and output maybe a netstat to a file if so?
My problem is: I have a Server and since today it randomly has no Internet for hours. I don't know if it's a DDoS or something different and I want to find out. I also can only SSH into it so it needs Internet to let me do anything.
(It's just a fun project so there is really only me who could do something)
question