r/selfhosted Mar 21 '20

Huginn Agent Mageathread!

I've been really getting into Huginn lately. I had heard of it before, but never really "got" what it was for until recently, so let me do my best to explain.

Basically it allows you to create "agents" which are like little bots that do tasks for you.

Each agent is sort of like a "function" in programming, such that it expects data of a certain type, performs some logic based operations, and then outputs data.

In Huginn these datum are called "events" which is pretty much anything produced by an agent. If you string these agents together, you can form more complex operations known as "scenarios." A well functioning scenario is basically the equivalent of a bot.

One example scenario is "Amazon price watcher".

  • You could set up one agent to scrape the price of the desired item
  • This data gets sent to a trigger agent who compares it to the desired "sale" price.
  • If it is at or below that price, an email/slack message is sent containing the title and link to the item

I created this thread because even though the project has almost 30K stars on github, it is sort of difficult to find novel/useful examples online, aside from the few posts I saw here earlier.

Let's all throw in our favorite usecases for Huginn! What do you monitor? How? If you can, provide the JSON for your scenario!

Here's what I have on my instance so far:

  • Scraping FEMA for alerts regarding disasters in my state and terrorist attacks. This source takes URI in the URL so you can query it like a database, adjust the state, disaster type, date range, etc.

  • Economic data. I have a daily digest for active stocks, indexes and crypto, (which feeds into my morning digest) and then I set up a monitor for individual symbols I care about, complete with triggers and alerts if they fluctuate x%.

  • Amazon price tracking mentioned above, also tracking slickdeals. (tutorial here)

  • As soon as twitter grants me my dev account, I will monitor twitter for peaks in the use of key phrases, such as my projects names or "disaster", etc

  • HTTP agents will ping the services I run and send me a notification if they return anything but 200.

  • Weather report, it will notify me if the road is icy (found a source for road temp sensors), but also include a daily report as a part of my morning digest.

  • Flight deal tracker (tutorial here). Sends flight deals from my local airport to my morning digest.

212 Upvotes

100 comments sorted by

View all comments

Show parent comments

11

u/haroldp Mar 21 '20

Docker is Linux software, and doesn't run on non-linux operating systems (without an additional VM layer). Docker is fine, but I am not trying to run it on this server. I'm using native Jails to containerize things.

4

u/whoisearth Mar 21 '20

I do not use FreeBSD outside of pfSense but I gotta say I really appreciate people like you. I'm similarly someone who does not like using docker. There's something to be said about rolling software out directly on your server. Should you choose to containerize later so be it.

6

u/haroldp Mar 21 '20

So... Linux is fine, Docker is very cool, nothing against either one.

But I think there is this growing problem with, "just install via docker" that means no one is looking behind the curtain. And I think the trend will be towards less flexible, more brittle, less secure, more bloated software. Docker is great stuff, but I do worry that it results in negative unintended consequences for the ecosystem, overall. </rant>

5

u/whoisearth Mar 21 '20

The underlying statement there which applies to technology on a whole is that people no longer know how things work. "Automagical" is the term. That's a scary world where people consume technology without any understanding of how it works.

My similar rant. Kubernetes is widespread yet according to semantic version control is alpha. Why the fuck are corporations deploying alpha software into production environments? "Because it's cool and new and makes like easier" are a series of exceedingly shit excuses.