最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

Agents Standing By: Introduction to Huginn

2022-07-23 12:17 作者:Memorainer  | 我要投稿

What is Huginn?

Have you ever felt out of the loop on current events? Do you tire of manually checking dozens of sites every day for the information you need? Do you wish you could quickly whip up a bot without learning a new API and programming language?

Before last week, I had heard of Huginn, but not seen how it could fit into my workflow. Now that I have a better understanding of its features, allow me to explain the ways Huginn can improve the way you monitor important data.

At its core, Huginn is an?event monitoring?framework. Huginn operates with something called?agents. These agents are analogous to a 【function】?in programming.

An agent will listen for a specific type of data (known as an 【event】), preform some logic based operations with that data, and then emit another event with the processed data.

On their own, the agents have limited capability. The true power of Huginn is leveraged when we?combine?agents, into something called a?scenario. A scenario is a tagged collection of agents, which usually communicate with each other to perform more complex tasks.

Let me go over an example scenario so you can get an idea of how agents interact

Huginn 的流程圖

The top level shows three 【Website Agents】. These scrape the sites of your choice and extract data from 【HTML】, 【JSON】, or 【XML】. I have these website agents monitoring a 【JSON】?feed of cryptocurrency, market indexes, and stocks.

Here is the 【JSON】?for the stock monitoring agent.

{

? "expected_update_period_in_days": "2",

? "url": "https://financialmodelingprep.com/api/v3/quote/AAPL,FB",

? "type": "json",

? "mode": "on_change",

? "extract": {

? ? "price": {

? ? ? "path": "[*].price"

? ? },

? ? "symbol": {

? ? ? "path": "[*].symbol"

? ? },

? ? "name": {

? ? ? "path": "[*].name"

? ? },

? ? "changesPercentage": {

? ? ? "path": "[*].changesPercentage"

? ? }

? }

}

These 【JSON】feeds get sent to the middle layer of 【Trigger Agents】. These agents take the incoming event (in this case 【JSON】?stock data) and evaluate it based on a value comparison or regex.


{

? "expected_receive_period_in_days": "2",

? "keep_event": "false",

? "rules": [

? ? {

? ? ? "type": "field>=value",

? ? ? "value": "10.00",

? ? ? "path": "changesPercentage"

? ? }

? ],

? "message": "{{name}} changed {{changesPercentage}}%. Current rate is {{price}}$.",

? "must_match": "1"

}

I have them set to extract the 【changesPercentage】?field from the incoming event and re-emit an event if the symbol fluctuated +/- 10%.

When these trigger agents emit an event, it is a stock fluctuation I want to know about immediately. That is why these events are sent to two notification agents. One is an email, which I will see whenever I check it. I also send a push notification to myself so I can see the events as they happen.

What about Grafana?

The way I see it, Huginn and Grafana fill very separate rolls in my workflow. Grafana (and the whole TIG stack) excel at monitoring lots of different data points over time and visualizing them beautifully. For example I could view how my hard drives are filling up over time, or which docker container is causing my CPU to throttle.

Huginn is great for on the fly creation of “bots” that will monitor very specific data points and perform actions based on them. Maybe I want an text whenever a specific model of CPU goes on sale. Or maybe I want an XKCD comic and a weather report delivered to me in a daily morning email. This is where Huginn shines.

However, I plan on experimenting with?combining?the two. What if I used Huginn to monitor and format a web data source, and send that nice formatted data to Grafana to display? I am still trying to figure out how this would work. I have attempted to use the?JSON Datasource(https://grafana.com/grafana/plugins/simpod-json-datasource)?on Grafana, but I have not been able to get it working even once.

Does Grafana?require?you to store the data in some external DB? I could?make?the Huginn data go to 【InfluxDB】, but it seems like it would be a lot of extra work.

Conclusion

In my next post, I will go over installing Huginn using docker-compose and setting up the basic SMTP server which allows for email notifications. Then we will get into setting up some useful agents and getting used to the Huginn workflow.

Agents Standing By: Introduction to Huginn的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
石狮市| 安吉县| 洪江市| 渑池县| 密云县| 抚顺县| 大余县| 宁城县| 尉犁县| 冀州市| 怀仁县| 宁河县| 固阳县| 景泰县| 衡阳市| 石景山区| 溆浦县| 杭锦后旗| 吴桥县| 灌云县| 沙洋县| 赣州市| 读书| 津市市| 分宜县| 巴彦县| 张家川| 恩施市| 图们市| 太仓市| 宜兰县| 惠来县| 夏河县| 正阳县| 都江堰市| 榆林市| 洛宁县| 高安市| 丰城市| 沈丘县| 舞钢市|