ethCore7

u/ethCore7


r/golang•

Hello,

I have a small utility function which I use to time execution of other functions for logging and metrics. Simplified, it looks like this:

func NewTimer(label string) func(error) {
    start := time.Now()
	return func(err error) {
    	fmt.Printf("%s took %s, error=%v\n", label, time.Since(start).String(), err)
        // the real code updates some prometheus counters based on the value of err
    }
}

It is then used like this:

func SomeExpensiveOperation() (err error) {
    defer func() { NewTimer("operation-id")(err) }()

    ...
    return fmt.Errorf("something went wrong")
}

The trouble is that it can also be called like this:

defer 
24

r/sysadmin•

Hi r/sysadmin,

I'm looking for examples on what on-call rotation schedules everyone uses. We started out in 3 people rotating whole weeks, but being on call 7 days in a row was pretty taxing.

Some time later, we then gained one more admin and moved to "fixed days" schedule, where each of us has on-call one fixed day of a week (Mo-Th) with rotating weekends, which works pretty well.

However, now we're up to 5 people and can't decide on the schedule to use. We tried rotating the 5th guy over the fixed days, which works but isn't fair for him, as everyone else has a fixed day and his on-calls move through the week. We're also toying with leaving 1 person out of the schedule for 1 or 3 mon

811

r/devops•

Hi there,

I'm looking at deploying Consul, initially only for basic service discovery to use with prometheus, and later for backend service config.

I have around 30 servers in one (core) site, which all share a public and a private network (but some of those don't have a public IP) , and around 10 more servers, where each of those is in some remote site. On the remote sites, I "own" only the remote server, which sits in a dedicated /30 IPv4 network, and don't have access to anything else.

From what I've read in Consul docs, it seems like I'll have to run a single-node Consul cluster on each of those remote nodes and then join them back to the core DC server instances using the WAN gossip

02

r/devops•

Hello,

I'm moving towards Prometheus for data collection and alerting needs, and I was wondering what would be the best way to enrich alerts with some custom status messages.

Let's say I have a service doing some operation periodically, which can fail for one or more reasons. I was thinking of exporting a 0/1 gauge with a "status" label, which would either have the value of "ok", or the reason the last loop failed. Is this the preferred way to do it?

Thanks!

59

r/golang•

There was a post some time ago that announced a release of an utility written in go, that basically worked like a HTTP API for launching scripts/commands.

Does anybody know the name? My search-fu is turning up nothing so far :(

25

r/golang•

Hello,

I'm currently working on a set of microservices and I'm looking for some feedback on the package design I've chosen, as I'm not 100% satisfied with it.

For some context, all these services are part of a platform for content streaming. One does user auth, second routes content requests, third is a GC for stale content, etc. All of these services need to pull configuration from a core backend service, which has an API that is being used for end devices as well.

At the moment I have a shared backend package, which provides a Client, that in turn has methods representing each of the needed API methods. Each of the microservices then defines an interface, which matches signatures o

23

r/buildapc•

###Build Help/Ready:

Have you read the sidebar and rules? (Please do)

Yes

What is your intended use for this build? The more details the better.

I'd like to get back into gaming as I've had only a modest laptop for the past 5 years (university and frequent hopping between places) - the last 'serious' game I played was Battlefield 3 at medium settings and 15-25 FPS. Apart from gaming, I intend to use this build for software development - that's one of the reasons I picked the ultrawide monitor to have enough of screen estate (I use double 24''s at work and wanted to get close without needing to get 2 monitors).

**If gaming, what kind

26

r/linuxquestions•

Hello there,

I'm having troubles with an udev rule that should run a script for each added network interface. The rule looks like this:

SUBSYSTEM=="net", ACTION=="add", RUN+="/etc/udev/scripts/set_eth_params.sh"

When i run udevadm test <eth devpath>, it looks like the rule is working:

udev_rules_apply_to_event: RUN '/etc/udev/scripts/set_eth_params.sh' /lib/udev/rules.d/81-irqbind.rules:1
<...>
udevadm_test: DEVPATH=/devices/pci0000:00/0000:00:03.0/0000:0d:00.0/0000:0e:02.0/0000:0f:00.0/net/eth4
udevadm_test: INTERFACE=eth4
udevadm_test: IFINDEX=6
udevadm_test: ACTION=add
udevadm_test: SUBSYSTEM=net
<....>
udevadm_test: run: '/e
00

r/learnpython•

Hello there,

I'm playing around with collectd at the moment, and I'd like the server to read in various data via a few python scripts.

According to the collectd-python manpage, I should import the collectd module via import collectd, but when trying in the python shell (both py2 and 3), it fails with ImportError saying there's no such module.

I installed collectd via apt-get install collectd collectd-utils. The manpage for collectd-python exists on my system, and I can see the python.so library under /usr/lib/collectd directory.

My collectd.conf contains the following:

<LoadPlugin python>
    
13

r/learnpython•

Hello all,

I'm currently working on implementing some custom checks in Zabbix (monitoring solution), and I've run into a problem which resists all my attempts to fix it.

So, here's the thing: I'm periodically running a python script triggered by a Zabbix check. The script pulls some data from external servers, and then feeds it into zabbix via it's zabbix_sender utility.

zabbix_sender works like this: you feed it one or multiple lines in '<hostname> <zabbix key> <json formatted string>' format, and it sends these lines to the zabbix server for processing. Now, here's the problem.

When I manually run the script, direct it's output into a file, and then call zabbix_sender

17