-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e4c366
commit e0f8c8a
Showing
4 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package app | ||
|
||
import ( | ||
"fmt" | ||
tele "gopkg.in/telebot.v3" | ||
"main/pkg/types/render" | ||
) | ||
|
||
func (a *App) HandleHelp(c tele.Context) error { | ||
a.Logger.Info(). | ||
Str("sender", c.Sender().Username). | ||
Str("text", c.Text()). | ||
Msg("Got help query") | ||
|
||
template, err := a.TemplateManager.Render("help", render.RenderStruct{ | ||
Grafana: a.Grafana, | ||
Alertmanager: a.Alertmanager, | ||
Data: nil, | ||
}) | ||
if err != nil { | ||
a.Logger.Error().Err(err).Msg("Error rendering help template") | ||
return c.Reply(fmt.Sprintf("Error rendering template: %s", err)) | ||
} | ||
|
||
return a.BotReply(c, template) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<a href="https://github.com/freak12techno/grafana-interacter">grafana-interacter</a> | ||
A Telegram bot that allows you to interact with your Grafana, Prometheus and Alertmanager instances. | ||
Can understand the following commands: | ||
|
||
- /help, or /start - displays this message | ||
- /render [opts] panelname - renders the panel and sends it as image. If there are multiple panels with the same name (for example, you have a 'dashboard1' and 'dashboard2' both containing panel with name 'panel'), it will render the first panel it will find. For specifying it, you may add the dashboard name as a prefix to your query (like <code>/render dashboard1 panel</code>). You can also provide options in a 'key=value' format, which will be internally passed to a <code>/render</code> query to Grafana. Some examples are 'from', 'to', 'width', 'height' (the command would look something like <code>/render from=now-14d to=now-7d width=100 height=100 dashboard1 panel</code>). By default, the params are: <code>width=1000&height=500&from=now-30m&to=now&tz=Europe/Moscow</code>. | ||
- /dashboards - will list Grafana dashboards and links to them. | ||
- /dashboard [name] - will return a link to a dashboard and its panels. | ||
- /datasources - will return Grafana datasources. | ||
- /alerts - will list both Grafana alerts and Prometheus alerts from all Prometheus datasources, if any | ||
- /firing - will list firing and pending alerts from both Grafana and Prometheus datasources, along with their details | ||
- /silence [duration] [params] - creates a silence for Grafana alert. You need to pass a duration (like <code>/silence 2h test alert</code>) and some params for matching alerts to silence. You may use '=' for matching the value exactly (example: <code>/silence 2h host=localhost</code>), '!=' for matching everything except this value (example: <code>/silence 2h host!=localhost</code>), '=~' for matching everything that matches the regexp (example: <code>/silence 2h host=~local</code>), '!~' for matching everything that doesn't match the regexp (example: <code>/silence 2h host!~local</code>), or just provide a string that will be treated as an alert name (example: <code>/silence 2h test alert</code>). | ||
- /silences - list silences (both active and expired). | ||
- /unsilence [silence ID] - deletes a silence. | ||
- /alertmanager_silences - same as /silences, but using external Alertmanager. | ||
- /alertmanager_silence - same as /silence, but using external Alertmanager. | ||
- /alertmanager_unsilence - same as /unsilence, but using external Alertmanager. | ||
|
||
Created by <a href="https://github.com/freak12techno">freak12techno</a> with ❤️. |