Total Lines | 20 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package cmd |
||
2 | |||
3 | import ( |
||
4 | "github.com/SerhiiCho/shoshka-go/telegram" |
||
5 | |||
6 | "github.com/spf13/cobra" |
||
7 | ) |
||
8 | |||
9 | var pingCmd = &cobra.Command{ |
||
10 | Use: "ping", |
||
11 | Short: "Checks the state of the production server by using ping command. Sends 3 ping requests and if 1 of 3 requests is not successful, sends telegram message to a provided chat.", |
||
12 | Run: func(cmd *cobra.Command, args []string) { |
||
13 | for _, msg := range telegram.GetMessageIfPingIsNotSuccessful() { |
||
14 | telegram.SendMessage(msg) |
||
15 | } |
||
16 | }, |
||
17 | } |
||
18 | |||
19 | func init() { |
||
20 | rootCmd.AddCommand(pingCmd) |
||
21 | } |
||
22 |