Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
some kinda jackal
Feb 25, 2003

 
 
Thanks guys. I found something on stackoverflow that did pretty much what I wanted in Python to and cleaned up the remainder with unix tools. I'm not great in python but it did the job in this case. Also thank you for the bash examples, they make a lot more sense to me and I'll see if I can go back and play with them after the fact to get better output.

I should put the time in to learn Python properly :unsmith:

But in this case it was five lines in Python so that was probably the right tool :haw:

Adbot
ADBOT LOVES YOU

SoftNum
Mar 31, 2011

Martytoof posted:

I should put the time in to learn Python properly :unsmith:

But in this case it was five lines in Python so that was probably the right tool :haw:

but but my GIL :cry:

evol262
Nov 30, 2010
#!/usr/bin/perl

xzzy posted:

Well that's programming in general. As business requirements change that nice simple script turns into a bowl of spaghetti.

I mean, yes. But it's much harder to turn Python or Ruby into spaghetti if you start with those

Methanar
Sep 26, 2013

by the sex ghost
code:
#numbers prefaced with a 0 are interpretted as being an octal number. 
#8 and 9 are not valid numbers within an octal system and will throw an error. 
#Strips off the 0.

lolbash=$(echo $line | awk '{print $3}')
lolbash=${lolbash#0}
echo $lolbash
...
if ! grep -q t$(printf '%02d' $lolbash) < <(awk '{print $4}' $dir/${a}.tmp); then
It's me. I'm the bad person who wrote 2000 lines of bash.

Ellie Crabcakes
Feb 1, 2008

Stop emailing my boyfriend Gay Crungus

Methanar posted:

code:
#numbers prefaced with a 0 are interpretted as being an octal number. 
#8 and 9 are not valid numbers within an octal system and will throw an error. 
#Strips off the 0.

lolbash=$(echo $line | awk '{print $3}')
lolbash=${lolbash#0}
echo $lolbash
...
if ! grep -q t$(printf '%02d' $lolbash) < <(awk '{print $4}' $dir/${a}.tmp); then
It's me. I'm the bad person who wrote 2000 lines of bash.
Why would you do that to yourself? Is this a cry for help?

Furism
Feb 21, 2006

Live long and headbang
I'm looking for a simple-ish, fast monitoring solution that Just Works ; to run from a Raspberry. Basically I'd like to be able to monitor my CentOS-running NAS, a MySQL server, maybe health check some website to check WAN connectivity, that sort of things. I don't mind installing agents if I have to (if the said agents are not too troublesome to setup on major distros like CentOS or Raspbian), but SNMP OIDs would be fine too I guess. This is just for some home monitoring so nothing critical. I'd like a clean, light interface with graphs. Does this exist?

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Furism posted:

I'm looking for a simple-ish, fast monitoring solution that Just Works ; to run from a Raspberry. Basically I'd like to be able to monitor my CentOS-running NAS, a MySQL server, maybe health check some website to check WAN connectivity, that sort of things. I don't mind installing agents if I have to (if the said agents are not too troublesome to setup on major distros like CentOS or Raspbian), but SNMP OIDs would be fine too I guess. This is just for some home monitoring so nothing critical. I'd like a clean, light interface with graphs. Does this exist?

I haven't found anything really easy like this that doesn't have some downside that I'm not happy with.

I've been using Grafanta + telegraf + influxdb for awhile and I'm pretty happy, but it's not exactly simple and easy to set up.

xzzy
Mar 5, 2009

Shot in the dark: anyone heard of or encountered a issue with OSX 10.12 ssh'ing into a RHEL7 based system?

Got a user who randomly "can't type" on a RHEL7 server. Like, they press spacebar once, get nothing. Press it again and they get a space. Or they're typing a string and input simply stops working for a few seconds. Or they paste a block of text and only part of it makes it across. It's pretty sporadic, it happens "for a while" then goes away "for a while." But it's fine if they do work on a RHEL6 based system. Description makes it sound like network problems but I've eliminated that as a possibility as much as possible. I was about to go down the "well we don't officially support workstations so you're SOL" but then another user piped in that this happens to them "rarely" on their macbook too.

Some kind of weird input bug on a mac maybe? Incompatibility between the ssh client and sshd that decides to throw away characters sometimes? :iiam:


I spent some time in the google machine and couldn't come up with something but it seems like such a subtle issue, maybe it just hasn't got anyone's attention yet.

Tigren
Oct 3, 2003

xzzy posted:

Shot in the dark: anyone heard of or encountered a issue with OSX 10.12 ssh'ing into a RHEL7 based system?

Got a user who randomly "can't type" on a RHEL7 server. Like, they press spacebar once, get nothing. Press it again and they get a space. Or they're typing a string and input simply stops working for a few seconds. Or they paste a block of text and only part of it makes it across. It's pretty sporadic, it happens "for a while" then goes away "for a while." But it's fine if they do work on a RHEL6 based system. Description makes it sound like network problems but I've eliminated that as a possibility as much as possible. I was about to go down the "well we don't officially support workstations so you're SOL" but then another user piped in that this happens to them "rarely" on their macbook too.

Some kind of weird input bug on a mac maybe? Incompatibility between the ssh client and sshd that decides to throw away characters sometimes? :iiam:


I spent some time in the google machine and couldn't come up with something but it seems like such a subtle issue, maybe it just hasn't got anyone's attention yet.

I spend my whole day every day sshing to various RHEL5/6/7 boxes from macOS Sierra and there is no input bug I've ever run into.

evol262
Nov 30, 2010
#!/usr/bin/perl
Have they checked $TERM? The rhel6 system may have a .bash_profile which sets it to a correct value instead of whatever they're getting now

xzzy
Mar 5, 2009

Working on playing with $TERM right now. But I don't have a macbook so it's the blind leading the blind here.

xzzy
Mar 5, 2009

Well, playing with $TERM at least found a workaround. Turns out the user was doing a macbook -> random linux server -> RHEL7 box. They were running a tmux session on the middle hop, and when doing so tmux sets $TERM to 'screen'. Then when they log into a RHEL7 system from inside tmux, response is garbage. When on a RHEL6 box it's fine. After forcing their terminal to xterm on the RHEL7 box, everything was fine.

Clearly some kind of library conflict somewhere in the chain but I can't reproduce it on any of my machines so I suppose the investigation ends there.

Volguus
Mar 3, 2009

Furism posted:

I'm looking for a simple-ish, fast monitoring solution that Just Works ; to run from a Raspberry. Basically I'd like to be able to monitor my CentOS-running NAS, a MySQL server, maybe health check some website to check WAN connectivity, that sort of things. I don't mind installing agents if I have to (if the said agents are not too troublesome to setup on major distros like CentOS or Raspbian), but SNMP OIDs would be fine too I guess. This is just for some home monitoring so nothing critical. I'd like a clean, light interface with graphs. Does this exist?

This is a shot in the dark since the solution is available since before the dinosaurs walked the earth (so you probably tried it already), but what is wrong with MRTG for your needs? Worst case scenario ... nagios? It has a bazillion agents, but i personally never tried it. At home I just MRTG and is .... fine. Old,. but fine. And adding scripts (that do whatever that spits out 2 numbers) for it is quite easy.

Furism
Feb 21, 2006

Live long and headbang

Volguus posted:

This is a shot in the dark since the solution is available since before the dinosaurs walked the earth (so you probably tried it already), but what is wrong with MRTG for your needs? Worst case scenario ... nagios? It has a bazillion agents, but i personally never tried it. At home I just MRTG and is .... fine. Old,. but fine. And adding scripts (that do whatever that spits out 2 numbers) for it is quite easy.

Nagios seemed overkill and MRTG seemed ... yeah, old (I saw the fact that their demo page returns a 404 as a bad sign). I was hoping for something more modern, but if that fails I might just get fallback to MRTG. Thanks!

Roargasm
Oct 21, 2010

Hate to sound sleazy
But tease me
I don't want it if it's that easy

Furism posted:

I'm looking for a simple-ish, fast monitoring solution that Just Works ; to run from a Raspberry. Basically I'd like to be able to monitor my CentOS-running NAS, a MySQL server, maybe health check some website to check WAN connectivity, that sort of things. I don't mind installing agents if I have to (if the said agents are not too troublesome to setup on major distros like CentOS or Raspbian), but SNMP OIDs would be fine too I guess. This is just for some home monitoring so nothing critical. I'd like a clean, light interface with graphs. Does this exist?

prometheus, prometheus-node-exporter, and grafana all work really good together for this. kind of overkill but a fun project. Prometheus node exporter by itself will expose all your system metrics on a webpage

Furism
Feb 21, 2006

Live long and headbang

Roargasm posted:

prometheus, prometheus-node-exporter, and grafana all work really good together for this. kind of overkill but a fun project. Prometheus node exporter by itself will expose all your system metrics on a webpage

Grafana looks sweet as hell, I'm going to try that! Thanks mate.

apropos man
Sep 5, 2016

You get a hundred and forty one thousand years and you're out in eight!
Could you give a brief rundown of how you set it up?

Last time I tried I gave up. Tried on CentOS with influxdb and also the other main db solution. This was a while ago, though. It might be a slicker experience now. It does look very good once it's working.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Furism posted:

Grafana looks sweet as hell, I'm going to try that! Thanks mate.

You fucker, i already told you to use grafana!

Furism
Feb 21, 2006

Live long and headbang

Thermopyle posted:

You fucker, i already told you to use grafana!

Sorry, I overlooked the thread I think :(

Ryaath
Apr 8, 2003

Roargasm posted:

prometheus, prometheus-node-exporter, and grafana all work really good together for this. kind of overkill but a fun project. Prometheus node exporter by itself will expose all your system metrics on a webpage

I did a collectd -> influxdb -> grafana setup that I've been really happy with. collectd is super easy to manage with config mgmt tools, and is handily available in most linuxes default repos...

What sort of hotness does prometheus give? I've seen it brought up in multiple places, but it seemed... complicated?

Hed
Mar 31, 2004

Fun Shoe
Edit: wrong thread

Hed fucked around with this message at 01:10 on Sep 10, 2017

Hed
Mar 31, 2004

Fun Shoe
Edit: I am an idiot

Docjowles
Apr 9, 2009

Furism posted:

Grafana looks sweet as hell, I'm going to try that! Thanks mate.

You still need something to actually poll and store the metrics. But yeah for visualizing things and making sweet dashboards, Grafana owns. And it can do alerting too as of a few versions ago.

Furism
Feb 21, 2006

Live long and headbang

Docjowles posted:

You still need something to actually poll and store the metrics. But yeah for visualizing things and making sweet dashboards, Grafana owns. And it can do alerting too as of a few versions ago.

Yes and apparently that'd be Prometheus? For now I'm still setting up the Raspberry. Compiling Go on a Raspberry is not quick. Apparently now InfluxDb offers ARM binaries so I might not even have to compile it myself, but I have to figure out the right way to manually extract the files where they must go because there's no ARM .deb package (just the binaries and files you have to extract).

I might just go "gently caress this" and simply install it on my CentOS NAS though.

evol262
Nov 30, 2010
#!/usr/bin/perl
Why not just look at where an x86 deb puts the files? Basically guaranteed to be the same

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Furism posted:

Yes and apparently that'd be Prometheus? For now I'm still setting up the Raspberry. Compiling Go on a Raspberry is not quick. Apparently now InfluxDb offers ARM binaries so I might not even have to compile it myself, but I have to figure out the right way to manually extract the files where they must go because there's no ARM .deb package (just the binaries and files you have to extract).

I might just go "gently caress this" and simply install it on my CentOS NAS though.

I found telegraf easier to understand and set up.

Docjowles
Apr 9, 2009

I've always used collectd for the stats-gathering part. Though apparently the "TICK Stack" has been gathering steam. Telegraf is the T in TICK. I wouldn't really describe collectd as easy to understand or setup myself, so I'm interested to hear more about telegraf.

Furism
Feb 21, 2006

Live long and headbang

Thermopyle posted:

I found telegraf easier to understand and set up.

Yes I'll use that, mostly I'm struggling a little bit with the InfluxDB setup.

Good tip to look into the x86 deb to replicate on ARM. Never looked before into how packages are built so that should be an interesting learning experience.

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Furism posted:

Yes I'll use that, mostly I'm struggling a little bit with the InfluxDB setup.
InfluxDB itself isn't terribly complicated, but there are a lot of really weird things the documentation sort of assumes you know about how it works. Where are you getting stuck?

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Docjowles posted:

I've always used collectd for the stats-gathering part. Though apparently the "TICK Stack" has been gathering steam. Telegraf is the T in TICK. I wouldn't really describe collectd as easy to understand or setup myself, so I'm interested to hear more about telegraf.

Not much to say about telegraf (though I say this as someone who already went through the process of getting it set up and everything always looks easier in hindsight).

You basically just install it, edit its simple-to-understand-config to monitor the things you want, and then run it.

The hardest part is when you're configuring it to monitor some service that you don't understand real well. In that case you don't always understand what you want to monitor.

Paul MaudDib
May 3, 2006

TEAM NVIDIA:
FORUM POLICE
As sort of a holistic exercise in homelab management, I was thinking of setting up a SLURM cluster. To simplify (lol) hardware needs I'd like to PXE boot the nodes from an iSCSI served by my ZFS NAS.

Ideally I'd like to have a base system image with each node getting its own "instance" with copy-on-write type behavior. My "story" for this behavior is something like:

  • I make a change to the base image
  • Backend nodes reboot and PXE boot the new image
  • As they boot, each node uses some kind of persistent system serial (MAC address? CPUID serial?) to reacquire its old node number
  • Cluster comes back up with the new version and tasks resume processing

My specific questions here are how to do that "re-acquire the node number" part and what is the most effective way to implement the versioning for the filesystem.

If the PXE image is truly immutable then I could just serve a block image, the other way I could go would be to declare a ZFS dataset and have each node clone a snapshot. The advantage of the dataset path seems like a more "natural" filesystem (writeable), and in theory deduplication should be able to keep usage down to the actual shared fileset. I may also have problems with CoW on a block image.

As for the node number... is there something I should be looking towards as a model, like how Docker swarms set themselves up or something? Usually there is not a "persistent" ID, but I'm not sure that having nodes come and go from underneath SLURM's workload scheduler is the best idea.

Methanar
Sep 26, 2013

by the sex ghost

Paul MaudDib posted:

As sort of a holistic exercise in homelab management, I was thinking of setting up a SLURM cluster. To simplify (lol) hardware needs I'd like to PXE boot the nodes from an iSCSI served by my ZFS NAS.

Ideally I'd like to have a base system image with each node getting its own "instance" with copy-on-write type behavior. My "story" for this behavior is something like:

  • I make a change to the base image
  • Backend nodes reboot and PXE boot the new image
  • As they boot, each node uses some kind of persistent system serial (MAC address? CPUID serial?) to reacquire its old node number
  • Cluster comes back up with the new version and tasks resume processing

My specific questions here are how to do that "re-acquire the node number" part and what is the most effective way to implement the versioning for the filesystem.

If the PXE image is truly immutable then I could just serve a block image, the other way I could go would be to declare a ZFS dataset and have each node clone a snapshot. The advantage of the dataset path seems like a more "natural" filesystem (writeable), and in theory deduplication should be able to keep usage down to the actual shared fileset. I may also have problems with CoW on a block image.

As for the node number... is there something I should be looking towards as a model, like how Docker swarms set themselves up or something? Usually there is not a "persistent" ID, but I'm not sure that having nodes come and go from underneath SLURM's workload scheduler is the best idea.


I'm not familiar with SLURM, but I've done something similar to this before. Anyway, I'm a big fan of using MAC addresses as machine identifiers. It's an easily accessible ID that you can do some fancy things with by scraping ARP tables, MAC address tables, tracing it to a physical switch port, etc.

What exactly are you PXE booting to? A RO NFS root? A "live" installation held entirely in ram?

Paul MaudDib
May 3, 2006

TEAM NVIDIA:
FORUM POLICE

Methanar posted:

What exactly are you PXE booting to? A RO NFS root? A "live" installation held entirely in ram?

I've never done PXE booting before so I'm fully open to suggestions as to the least painful way to implement this. NFS seems like it might be a decent idea, if all the backend nodes were pulling from a single RO filesystem then all I would have to do is update it and the changes would effectively propagate to the nodes. If the nodes could also get their node ID from a lookup based on the MAC address then the PXE image could be basically immutable.

Methanar
Sep 26, 2013

by the sex ghost

Paul MaudDib posted:

I've never done PXE booting before so I'm fully open to suggestions as to the least painful way to implement this. NFS seems like it might be a decent idea, if all the backend nodes were pulling from a single RO filesystem then all I would have to do is update it and the changes would effectively propagate to the nodes. If the nodes could also get their node ID from a lookup based on the MAC address then the PXE image could be basically immutable.

I've used both of your suggestions, truly immutable OS image and creating a ZFS clone for each node. I'd definitely recommend the immutable option if you have it available to you. Much easier to set up, fewer things to go wrong, and like you say, it's one change on the ZFS dataset to propagate changes.

PXE boot through iSCSI or however you would like, but ultimately get your root file system mounted read only https://spin.atomicobject.com/2015/03/10/protecting-ubuntu-root-filesystem/. A gotcha is definitely make sure dhcpd on your PXE booted node doesn't do anything silly like a release/renew after 30 minutes of being online (or even as it comes up in the first place), cutting out the root filesystem beneath itself. That's something frustrating that's bit me before.

Then have a little python script or something query a redis instance somewhere mapping MAC to node ID. Set that as an environment variable that you pass to your application.

evol262
Nov 30, 2010
#!/usr/bin/perl
I'd use the motherboard UUID if available. If not, generate one with the MAC as a salt.

Note that RO root support is pretty poo poo in 2017 unless you layer COW or a ramdisk on top of it, and you should expect a million little things to fail (because they're trying to write crap somewhere in /usr/share or whatever)

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

evol262 posted:

I'd use the motherboard UUID if available. If not, generate one with the MAC as a salt.

Note that RO root support is pretty poo poo in 2017 unless you layer COW or a ramdisk on top of it, and you should expect a million little things to fail (because they're trying to write crap somewhere in /usr/share or whatever)
overlayfs is definitely recommended. overlayfs on Debian-based systems is stupid easy with overlayroot, which is a one-line change in a config file and a reboot. Like Methanar said, the NFS root piece is usually harder than the immutable piece because of dumb poo poo like the OS trying to drop network in the middle of shutdown, losing its connection to everything it needs to finish rebooting, but everything (other than SELinux labels, AppArmor contexts, and other weird stuff) should basically just work with an upper tmpfs in the mix.

jaegerx
Sep 10, 2012

Maybe this post will get me on your ignore list!


What’s the good rhcsa book now?

Furism
Feb 21, 2006

Live long and headbang

Vulture Culture posted:

InfluxDB itself isn't terribly complicated, but there are a lot of really weird things the documentation sort of assumes you know about how it works. Where are you getting stuck?

I'm not sure what the proper way to install it from the tar is. When I untar it I get /var, /usr, /etc directories created, each with subdirectories of its own and files in them. My assumption was that if I sudo untar into / then it should be fine? But I'm not sure because I don't know enough about Linux and the differences between distros (would Debian put/look for the files in the same directory as RHEL? If not, how do I know which distro this tar was made for?).

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Furism posted:

I'm not sure what the proper way to install it from the tar is. When I untar it I get /var, /usr, /etc directories created, each with subdirectories of its own and files in them. My assumption was that if I sudo untar into / then it should be fine? But I'm not sure because I don't know enough about Linux and the differences between distros (would Debian put/look for the files in the same directory as RHEL? If not, how do I know which distro this tar was made for?).
There are native packages for Debian/Ubuntu and CentOS/RHEL/Fedora available from their download page. Your best bet is to use those unless you have a different distro underneath. Anything else, you're on your own for making it play nice with your init system.

Adbot
ADBOT LOVES YOU

Furism
Feb 21, 2006

Live long and headbang
Problem I had was that their packages were all for x86 and I'm using a Raspberry so needed the ARM architecture. However after spending about 2 hours compiling go (to then compile InfluxDB) I thought I'd apt-cache search and guess what? There is a package in the main Raspbian repos! So now it's all good.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply