I have a Pi which is set up with a read-only filesystem, and as such packaged network monitoring solutions aren't happy. Neither wicd nor network-manager like this setup.
I'm not a fan of either, to be honest - for a GUI based PC they have benefits but for a headless box something simpler will suffice.
I have cobbled together a basic bash script that checks to see if it can ping the default gateway and restarts wifi otherwise, but its far from elegant.
Has anyone done anything similar or found any similar scripts online that they use? Ideally, for example, it would be able to "manage" both eth0 and wlan0 (or even wlan1 - in the case of a Pi 3 with an external Wifi added in for better signal strength).
(I'm worried about edge cases with my current script. I can either run in through cron, but that risks it thinking the network is offline just because it hasn't come up yet after a boot which might have bad side effects. I'm currently running it as a systemd service with e network dependency to avoid that, but I'm not sure how that'll work if the network fails to come up after a reboot. Then there's all the things I haven't thought of...)
On 10/01/18 12:46, Mark Rogers wrote:
I have a Pi which is set up with a read-only filesystem, and as such packaged network monitoring solutions aren't happy. Neither wicd nor network-manager like this setup.
A) Can I ask why it's got a read-only filesystem?
I'm not a fan of either, to be honest - for a GUI based PC they have benefits but for a headless box something simpler will suffice.
I have cobbled together a basic bash script that checks to see if it can ping the default gateway and restarts wifi otherwise, but its far from elegant.
Has anyone done anything similar or found any similar scripts online that they use? Ideally, for example, it would be able to "manage" both eth0 and wlan0 (or even wlan1 - in the case of a Pi 3 with an external Wifi added in for better signal strength).
(I'm worried about edge cases with my current script. I can either run in through cron, but that risks it thinking the network is offline just because it hasn't come up yet after a boot which might have bad side effects. I'm currently running it as a systemd service with e network dependency to avoid that, but I'm not sure how that'll work if the network fails to come up after a reboot. Then there's all the things I haven't thought of...)
Monit.
You can configure it to monitor almost anything. It is available to install in the Rasbian repository. It is configured via config files. It can be checked & configured via a web interface. If it finds something not working it can restart it or email you about it or stop checking it. There are many examples on how to configure it (scripts) on-line.
It can take a while to setup, but it's worth it.
Once installed, there are several subdirectories under /etc/monit. These are sample scripts which you can edit or move to enable them (I can't remember exactly how to enable them.). Monitrc has multiple tests all commented out.
Very simple how to install: https://www.digitalocean.com/community/tutorials/how-to-install-and-configur...
Documentation: https://mmonit.com/monit/documentation/monit.html
Specific to network it says:
Network
|CHECK NETWORK <unique name> <ADDRESS <ipaddress> | INTERFACE <name>>|
<ipaddress> is the IPv4 or IPv6 address of the monitored network interface. It is also possible to use interface name, such as "eth0" on Linux.
Monitrc has this commented out test
# check network public with interface eth0 # if failed link then alert # if changed link then alertb # if saturation > 90% then alert # if download > 10 MB/s then alert # if total upload > 1 GB in last hour then alert #
I use mine to check that I can still connect to a remote webcam ip address and many other things.
HTH Steve
On 10 January 2018 at 14:52, steve-ALUG@hst.me.uk wrote:
A) Can I ask why it's got a read-only filesystem?
Because it will lose power occasionally and I'm trying to avoid corrupted filesystems.
(It's actually a data logger, so it has a read-write data partition but a read-only O/S partition. That means I can generally symlink various files to the read-write partition as needed, but some things still make life difficult, like deleting and recreating files - or rather failing to).
Monit.
Interesting suggestion; I have used monit before years ago (not for this purpose) and long forgotten about it.
Thanks for the suggestion.
Part of the challenge will be working out what *should* work in a general case. Ie there's no point worrying about wifi being offline if it's not configured, for example, and I'm trying to make something generic. But from what I remember of monit there's some useful stuff in there that I need to revisit.
Mark
On 10/01/18 15:22, Mark Rogers wrote:
On 10 January 2018 at 14:52, steve-ALUG@hst.me.uk wrote:
A) Can I ask why it's got a read-only filesystem?
Because it will lose power occasionally and I'm trying to avoid corrupted filesystems.
Fairy Nuff! :-)
Monit.
Interesting suggestion; I have used monit before years ago (not for this purpose) and long forgotten about it.
Thanks for the suggestion.
Part of the challenge will be working out what *should* work in a general case. Ie there's no point worrying about wifi being offline if it's not configured, for example, and I'm trying to make something generic. But from what I remember of monit there's some useful stuff in there that I need to revisit.
I'm fairly sure that you'll be able to configure it as you may need, but I think that it'll have to be individually configured rather than generic. Obvs you don't have to check Wifi if it's not needed or configured, and you could check ethernet instead etc. However, the recent change from (IMHO) useful and easy device names like eth0 to an unpredictable name based on the mac address (or whatever) makes things much harder!
Good luck
Steve
On 10/01/18 15:22, Mark Rogers wrote:
On 10 January 2018 at 14:52, steve-ALUG@hst.me.uk wrote:
A) Can I ask why it's got a read-only filesystem?
Because it will lose power occasionally and I'm trying to avoid corrupted filesystems.
(It's actually a data logger, so it has a read-write data partition but a read-only O/S partition. That means I can generally symlink various files to the read-write partition as needed, but some things still make life difficult, like deleting and recreating files - or rather failing to).
Possibly irrelevant, but there are UPSes and Battery backup systems that you can plug in to a Pi, or even Power Over Ethernet. e.g. https://www.pi-supply.com/product-category/power-supplies-and-batteries/
Just included it in case it helps.
Cheers Steve
On 10 January 2018 at 16:29, steve-ALUG@hst.me.uk wrote:
Possibly irrelevant, but there are UPSes and Battery backup systems that you can plug in to a Pi, or even Power Over Ethernet.
Not irrelevant at all, thanks for the info.
I have played with a couple of these in the past. They tend to get a bit "fun" when you want to shut the unit down or power it up from shutdown. I can't remember exactly what the problems were but they're reasonably well documented.
For my use case though, loss of power likely means "I want to turn it off" rather than "temporary power loss". Having something headless makes proper shutdown harder, and I can't rely on someone using whatever process I do provide, so making it as robust against unplanned power cycling as I can is a plus. Losing that for something like wifi (which really shouldn't need to regularly write to /etc like wicd does) isn't a road I want to go down.
On Wed, 2018-01-10 at 15:22 +0000, Mark Rogers wrote:
On 10 January 2018 at 14:52, steve-ALUG@hst.me.uk wrote:
A) Can I ask why it's got a read-only filesystem?
Because it will lose power occasionally and I'm trying to avoid corrupted filesystems.
I've been powering off my Linux Smoothwall firewall every night for years without any problem. I wouldn't worry about it.
On 19 January 2018 at 09:14, Huge huge@huge.org.uk wrote:
I've been powering off my Linux Smoothwall firewall every night for years without any problem. I wouldn't worry about it.
I have had the opposite experience.
I suspect that in my case it's not the occasional power cycle, its further power cycles during boot (ie when it might be repairing the filesystem from a previous power cycle). It's speculation - I don't have control over the power - but corrupt filesystems have hit me enough times that working around them has justified quite a lot of time spent on it.
The advantage I suspect you have is that if you have a problem you can get to it with keyboard/mouse/monitor to investigate; I usually don't have that option, it's either working or it isn't. Even if all this effort does is point the finger at a different likely culprit then it's served its purpose.
On Fri, 2018-01-19 at 16:46 +0000, Mark Rogers wrote:
On 19 January 2018 at 09:14, Huge huge@huge.org.uk wrote:
I've been powering off my Linux Smoothwall firewall every night for years without any problem. I wouldn't worry about it.
I have had the opposite experience.
Sorry to hear it.
I've just bought an HP Procurve Switch 1700-8 (J9079A) switch online (it's an 8 port network switch) without a power supply, under the mistaken impression (from the pix on ebay) that it uses a standard co-axial "wall-wart" power plug.
It doesn't.
None of the plugs I have (and I have a large box of wall warts I've accumulated over the years) will fit, since the centre pin of the socket is too large. I've tried drilling out the likeliest one, but the centre conductor just spins round, so the drill won't "bite". Also, it looks like the centre pin in the socket has a third connector inside it, so I'm not sure a universal wall-wart will work, even if I can get the plug to go in.
Anyone know where I can get a power supply for one of these? The vendor doesn't have one, and I don't want to send the switch back until I've exhausted all avenues, since it's my fault.
On 21/01/18 13:51, Huge wrote:
I've just bought an HP Procurve Switch 1700-8 (J9079A) switch online (it's an 8 port network switch) without a power supply, under the mistaken impression (from the pix on ebay) that it uses a standard co-axial "wall-wart" power plug.
It doesn't.
None of the plugs I have (and I have a large box of wall warts I've accumulated over the years) will fit, since the centre pin of the socket is too large. I've tried drilling out the likeliest one, but the centre conductor just spins round, so the drill won't "bite". Also, it looks like the centre pin in the socket has a third connector inside it, so I'm not sure a universal wall-wart will work, even if I can get the plug to go in.
Anyone know where I can get a power supply for one of these? The vendor doesn't have one, and I don't want to send the switch back until I've exhausted all avenues, since it's my fault.
I don't suppose this will help but I suspect that it requires a specialised PSU like my laptop does. My laptop has the extra pin in the middle, & I suspect it's a data line to tell the laptop the capabilities of the PSU. There must be some "magic" like that as my laptop knows things about the PSU, like its rating etc so they must be communicating somehow.
I'd suggest finding/downloading a manual and looking for the PSU part number and then hunting one down.
Not really very helpful I'm afraid.
Good luck Steve
On Mon, 2018-01-22 at 10:30 +0000, steve-ALUG@hst.me.uk wrote:
On 21/01/18 13:51, Huge wrote:
I've just bought an HP Procurve Switch 1700-8 (J9079A) switch online
[snippage]
Anyone know where I can get a power supply for one of these? The vendor doesn't have one, and I don't want to send the switch back until I've exhausted all avenues, since it's my fault.
I don't suppose this will help but I suspect that it requires a specialised PSU like my laptop does. My laptop has the extra pin in the middle, & I suspect it's a data line to tell the laptop the capabilities of the PSU. There must be some "magic" like that as my laptop knows things about the PSU, like its rating etc so they must be communicating somehow.
I'd suggest finding/downloading a manual and looking for the PSU part number and then hunting one down.
Not really very helpful I'm afraid.
Actually, exceedingly helpful. Just not very timely! :o)
Someone elsewhere told me the part number of the real power supply (HP-5188-6700) and using that I found a clone on eBay, which I have ordered.
Thanks very much all the same!!
Regards,
Hugh.
On 22/01/18 10:35, Huge wrote:
Actually, exceedingly helpful. Just not very timely! :o)
Someone elsewhere told me the part number of the real power supply (HP-5188-6700) and using that I found a clone on eBay, which I have ordered.
Thanks very much all the same!!
Regards,
Hugh.
Glad you're sorted :-)
Steve