Adding upstream version 1.34.4.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
e393c3af3f
commit
4978089aab
4963 changed files with 677545 additions and 0 deletions
24
plugins/inputs/execd/examples/count.go
Normal file
24
plugins/inputs/execd/examples/count.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
// Example using HUP signaling
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func main() {
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGHUP)
|
||||
|
||||
counter := 0
|
||||
|
||||
for {
|
||||
<-c
|
||||
|
||||
fmt.Printf("counter_go count=%d\n", counter)
|
||||
counter++
|
||||
}
|
||||
}
|
12
plugins/inputs/execd/examples/count.py
Normal file
12
plugins/inputs/execd/examples/count.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import time
|
||||
|
||||
COUNTER = 0
|
||||
|
||||
while True:
|
||||
print("counter_python count=" + str(COUNTER))
|
||||
sys.stdout.flush()
|
||||
COUNTER += 1
|
||||
|
||||
time.sleep(1)
|
21
plugins/inputs/execd/examples/count.rb
Normal file
21
plugins/inputs/execd/examples/count.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
## Example in Ruby not using any signaling
|
||||
|
||||
counter = 0
|
||||
|
||||
def time_ns_str(t)
|
||||
ns = t.nsec.to_s
|
||||
(9 - ns.size).times do
|
||||
ns = "0" + ns # left pad
|
||||
end
|
||||
t.to_i.to_s + ns
|
||||
end
|
||||
|
||||
loop do
|
||||
puts "counter_ruby count=#{counter} #{time_ns_str(Time.now)}"
|
||||
STDOUT.flush
|
||||
counter += 1
|
||||
|
||||
sleep 1
|
||||
end
|
12
plugins/inputs/execd/examples/count.sh
Normal file
12
plugins/inputs/execd/examples/count.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
## Example in bash using STDIN signaling
|
||||
|
||||
counter=0
|
||||
|
||||
while read -r _; do
|
||||
echo "counter_bash count=${counter}"
|
||||
counter=$((counter+1))
|
||||
done
|
||||
|
||||
trap "echo terminate 1>&2" EXIT
|
Loading…
Add table
Add a link
Reference in a new issue