Implement support for notification types
- add new flag "-t" for notification types to matrix-host-notification and matrix-service-notification - implement value validation for HostState and ServiceState
This commit is contained in:
parent
902d4cb310
commit
1aeacd0d1b
6 changed files with 81 additions and 10 deletions
|
@ -45,9 +45,10 @@ func parseFlags() *icinga2.HostParameters {
|
|||
flag.StringVar(&config.LongDateTime, "d", "", "long date time ($icinga.long_date_time$)")
|
||||
flag.StringVar(&config.Hostname, "l", "", "hostname ($host.name$)")
|
||||
flag.StringVar(&config.HostDisplayName, "n", "", "host display name ($host.display_name$)")
|
||||
flag.Var(&config.NotificationType, "t", "notification type ($notification_type$)")
|
||||
|
||||
flag.StringVar(&config.HostOutput, "o", "", "host output ($host.output$)")
|
||||
flag.StringVar(&config.HostState, "s", "", "host state ($host.state$)")
|
||||
flag.Var(&config.HostState, "s", "host state ($host.state$)")
|
||||
|
||||
flag.StringVar(&config.MatrixRoom, "m", "", "matrix room ($notification_matrix_room$)")
|
||||
flag.Var(&config.MatrixServer, "x", "matrix server ($notification_matrix_server$)")
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
// The main package for matrix-service-notification
|
||||
package main
|
||||
|
||||
import (
|
||||
|
@ -45,11 +47,12 @@ func parseFlags() *icinga2.ServiceParameters {
|
|||
flag.StringVar(¶meters.LongDateTime, "d", "", "long date time ($icinga.long_date_time$)")
|
||||
flag.StringVar(¶meters.Hostname, "l", "", "hostname ($host.name$)")
|
||||
flag.StringVar(¶meters.HostDisplayName, "n", "", "host display name ($host.display_name$)")
|
||||
flag.Var(¶meters.NotificationType, "t", "notification type ($notification_type$)")
|
||||
|
||||
flag.StringVar(¶meters.ServiceName, "e", "", "service name ($service.name$)")
|
||||
flag.StringVar(¶meters.ServiceDisplayName, "u", "", "service display name ($service.display_name$)")
|
||||
flag.StringVar(¶meters.ServiceOutput, "o", "", "service output ($service.output$)")
|
||||
flag.StringVar(¶meters.ServiceState, "s", "", "service state ($service.state$)")
|
||||
flag.Var(¶meters.ServiceState, "s", "service state ($service.state$)")
|
||||
|
||||
flag.StringVar(¶meters.MatrixRoom, "m", "", "matrix room ($notification_matrix_room$)")
|
||||
flag.Var(¶meters.MatrixServer, "x", "matrix server ($notification_matrix_server$)")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue