How to interact with Telegraf using Go external plugin?

I have a dummy GO plugin, using that, i want send data to telegraf. But, i’m not able to find any way to send data from the plugin to telegraf. this external Go plugin looks like below…

package main

import (
"fmt"
"time"
)

type greeting string
type n int

func (g greeting) Greet() {
    for i := 0; i < 10; i++ {
        timer1 := time.NewTimer(2 * time.Second)
        <-timer1.C
        fmt.Println("value ", i)

        sum := 0
        sum += i * 100
        fmt.Println(sum)
    }

}

// exported
var Greeter greeting

And the main file looks like

import (
"fmt"
"os"
"plugin"
)

type Greeter interface {
    Greet()
}

func main() {

var mod string

mod = "./eng/eng.so"

// load module
// 1. open the so file to load the symbols
plug, err := plugin.Open(mod)
if err != nil {
    fmt.Println(err)
    os.Exit(1)
}

// 2. look up a symbol (an exported function or variable)
// in this case, variable Greeter
symGreeter, err := plug.Lookup("Greeter")
if err != nil {
    fmt.Println(err)
    os.Exit(1)
}

// 3. Assert that loaded symbol is of a desired type
// in this case interface type Greeter (defined above)
var greeter Greeter
greeter, ok := symGreeter.(Greeter)
if !ok {
    fmt.Println("unexpected type from module symbol")
    os.Exit(1)
}

// 4. use the module
greeter.Greet()
}

Can anyone help me find a way or a direction on how to make interaction between GO plugin and telegraf work. Any heads up is appreciated.

Hi @jyoti_prakash_das, can you include the content of your question in here? It’s more likely to get a response if people don’t have to go from one system to another to read it.