From 070e5051c6590cd8623ee36c2d0829c51e75cceb Mon Sep 17 00:00:00 2001 From: xtan <38320121+tanxiao1990@users.noreply.github.com> Date: Fri, 27 May 2022 17:38:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dgo=20plugin=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E9=94=99=E8=AF=AF=20(#964)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: tanxiao --- docker/n9eetc/script/notify/README.md | 4 ++-- docker/n9eetc/script/notify/notify.go | 4 ++-- etc/script/notify/README.md | 4 ++-- etc/script/notify/notify.go | 4 ++-- etc/server.conf | 3 ++- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docker/n9eetc/script/notify/README.md b/docker/n9eetc/script/notify/README.md index e8b2d68d..73d977f9 100644 --- a/docker/n9eetc/script/notify/README.md +++ b/docker/n9eetc/script/notify/README.md @@ -29,7 +29,7 @@ type inter interface { [Alerting.CallPlugin] Enable = false PluginPath = "./etc/script/notify.so" -# 注意此处caller必须在notify.so中作为变量暴露 -Caller = "n9eCaller" +# 注意此处caller必须在notify.so中作为变量暴露,首字母必须大写才能暴露 +Caller = "N9eCaller" ``` diff --git a/docker/n9eetc/script/notify/notify.go b/docker/n9eetc/script/notify/notify.go index bfd360a0..faa65a52 100644 --- a/docker/n9eetc/script/notify/notify.go +++ b/docker/n9eetc/script/notify/notify.go @@ -37,8 +37,8 @@ func (n *N9EPlugin) Notify(bs []byte) { } } -// will be loaded for alertingCall -var n9eCaller = N9EPlugin{ +// will be loaded for alertingCall , The first letter must be capitalized to be exported +var N9eCaller = N9EPlugin{ Name: "n9e", Description: "演示告警通过动态链接库方式通知", BuildAt: time.Now().Local().Format("2006/01/02 15:04:05"), diff --git a/etc/script/notify/README.md b/etc/script/notify/README.md index e8b2d68d..73d977f9 100644 --- a/etc/script/notify/README.md +++ b/etc/script/notify/README.md @@ -29,7 +29,7 @@ type inter interface { [Alerting.CallPlugin] Enable = false PluginPath = "./etc/script/notify.so" -# 注意此处caller必须在notify.so中作为变量暴露 -Caller = "n9eCaller" +# 注意此处caller必须在notify.so中作为变量暴露,首字母必须大写才能暴露 +Caller = "N9eCaller" ``` diff --git a/etc/script/notify/notify.go b/etc/script/notify/notify.go index bfd360a0..faa65a52 100644 --- a/etc/script/notify/notify.go +++ b/etc/script/notify/notify.go @@ -37,8 +37,8 @@ func (n *N9EPlugin) Notify(bs []byte) { } } -// will be loaded for alertingCall -var n9eCaller = N9EPlugin{ +// will be loaded for alertingCall , The first letter must be capitalized to be exported +var N9eCaller = N9EPlugin{ Name: "n9e", Description: "演示告警通过动态链接库方式通知", BuildAt: time.Now().Local().Format("2006/01/02 15:04:05"), diff --git a/etc/server.conf b/etc/server.conf index 7a3bc5eb..2c2814aa 100644 --- a/etc/server.conf +++ b/etc/server.conf @@ -85,7 +85,8 @@ ScriptPath = "./etc/script/notify.py" Enable = false # use a plugin via `go build -buildmode=plugin -o notify.so` PluginPath = "./etc/script/notify.so" -Caller = "n9eCaller" +# The first letter must be capitalized to be exported +Caller = "N9eCaller" [Alerting.RedisPub] Enable = false