mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
doc - create example message files
This commit is contained in:
parent
c8a400de60
commit
0d89631289
22 changed files with 174 additions and 62 deletions
17
doc/example-messages/cli-command-cont-tail-log-file.json
Normal file
17
doc/example-messages/cli-command-cont-tail-log-file.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
[
|
||||
{
|
||||
"directory":"system",
|
||||
"fileName": "test",
|
||||
"toNodes": ["ship1"],
|
||||
"relayViaNode": "central",
|
||||
"relayReplyMethod": "REQToConsole",
|
||||
"methodArgs": ["bash","-c","cat /etc/hostname && journalctl -u steward -n 5 --follow"],
|
||||
"method":"REQCliCommandCont",
|
||||
"replyMethod":"REQToFileAppend",
|
||||
"ACKTimeout":5,
|
||||
"retries":3,
|
||||
"replyACKTimeout":5,
|
||||
"replyRetries":3,
|
||||
"methodTimeout": 5
|
||||
}
|
||||
]
|
20
doc/example-messages/clicommand-to-console.json
Normal file
20
doc/example-messages/clicommand-to-console.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
[
|
||||
{
|
||||
"toNodes": ["ship1"],
|
||||
"method": "REQCliCommand",
|
||||
"methodArgs": [
|
||||
"bash",
|
||||
"-c",
|
||||
"hostname && curl -v http://debian.org"
|
||||
],
|
||||
"replyMethod": "REQToConsole",
|
||||
"ACKTimeout": 5,
|
||||
"retries": 3,
|
||||
"replyACKTimeout": 5,
|
||||
"replyRetries": 5,
|
||||
"methodTimeout": 5,
|
||||
"replyMethodTimeout": 120,
|
||||
"directory": "debug",
|
||||
"fileName": "test.txt"
|
||||
}
|
||||
]
|
10
doc/example-messages/copy-files.json
Normal file
10
doc/example-messages/copy-files.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
[
|
||||
{
|
||||
"directory": "copy",
|
||||
"fileName": "copy.log",
|
||||
"toNodes": ["ship1"],
|
||||
"method":"REQCopyFileFrom",
|
||||
"methodArgs": ["./tmp2.txt","ship2","/tmp/tmp2.txt"],
|
||||
"replyMethod":"REQToFileAppend"
|
||||
}
|
||||
]
|
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
- toNodes:
|
||||
- ship1
|
||||
- ship2
|
||||
method: REQCliCommand
|
||||
methodArgs:
|
||||
- "bash"
|
||||
- "-c"
|
||||
- |
|
||||
cat <<-"EOF" >test.sh
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "error: No argument supplied, give the hostname as the only argument"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
touch $1
|
||||
echo "sorry..." > $1
|
||||
|
||||
EOF
|
||||
|
||||
chmod +x test.sh
|
||||
|
||||
./test.sh WHOOPS.txt
|
||||
|
||||
replyMethod: REQToFile
|
||||
ACKTimeout: 5
|
||||
retries: 120
|
||||
replyACKTimeout: 5
|
||||
replyRetries: 3
|
||||
methodTimeout: 5
|
||||
directory: system
|
||||
fileName: system.log
|
19
doc/example-messages/create-msg-startup-folder.json
Normal file
19
doc/example-messages/create-msg-startup-folder.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
[
|
||||
{
|
||||
"relayViaNode": "central",
|
||||
"relayReplyMethod": "REQToConsole",
|
||||
"toNodes": ["ship1","ship2"],
|
||||
"method": "REQCliCommand",
|
||||
"methodArgs": [
|
||||
"bash","-c","cat <<< $'[{\"directory\": \"metrics\",\"fileName\": \"edgeAgent.prom\",\"fromNode\":\"metrics\",\"toNode\": \"ship1\",\"method\":\"REQHttpGetScheduled\",\"methodArgs\": [\"http://127.0.0.1:9601/metrics\",\"60\",\"5000000\"],\"replyMethod\":\"REQToFile\",\"ACKTimeout\":10,\"retries\": 3,\"methodTimeout\": 3}]'>/usr/local/steward/startup/scrape-edge-agent.msg && cat <<< $'[{\"directory\": \"metrics\",\"fileName\": \"edgeHub.prom\",\"fromNode\":\"metrics\",\"toNode\": \"ship2\",\"method\":\"REQHttpGetScheduled\",\"methodArgs\": [\"http://127.0.0.1:9602/metrics\",\"60\",\"5000000\"],\"replyMethod\":\"REQToFile\",\"ACKTimeout\":10,\"retries\": 3,\"methodTimeout\": 3}]'>/usr/local/steward/startup/scrape-edge-hub.msg && systemctl restart steward"
|
||||
],
|
||||
"replyMethod": "REQToFile",
|
||||
"ACKTimeout": 20,
|
||||
"retries": 3,
|
||||
"replyACKTimeout": 20,
|
||||
"replyRetries": 3,
|
||||
"methodTimeout": 5,
|
||||
"directory": "system",
|
||||
"fileName": "system.log"
|
||||
}
|
||||
]
|
19
doc/example-messages/create-startup-relay-central.json
Normal file
19
doc/example-messages/create-startup-relay-central.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
[
|
||||
{
|
||||
"relayViaNode": "central",
|
||||
"relayReplyMethod": "REQToConsole",
|
||||
"toNodes": ["ship1"],
|
||||
"method": "REQCliCommand",
|
||||
"methodArgs": [
|
||||
"bash","-c","cat <<< $'[{\"directory\": \"metrics\",\"fileName\": \"edgeHub.prom\",\"fromNode\":\"metrics\",\"toNode\": \"ship1\",\"method\":\"REQHttpGetScheduled\",\"methodArgs\": [\"http://127.0.0.1:9602/metrics\",\"60\",\"5000000\"],\"replyMethod\":\"REQToFile\",\"ACKTimeout\":10,\"retries\": 3,\"methodTimeout\": 3}]'>/usr/local/steward/startup/scrape-edge-hub.msg && systemctl restart steward"
|
||||
],
|
||||
"replyMethod": "REQToFile",
|
||||
"ACKTimeout": 5,
|
||||
"retries": 3,
|
||||
"replyACKTimeout": 5,
|
||||
"replyRetries": 3,
|
||||
"methodTimeout": 5,
|
||||
"directory": "system",
|
||||
"fileName": "system.log"
|
||||
}
|
||||
]
|
22
doc/example-messages/flush-dns-restart-wireguard.json
Normal file
22
doc/example-messages/flush-dns-restart-wireguard.json
Normal file
|
@ -0,0 +1,22 @@
|
|||
[
|
||||
{
|
||||
"toNodes": ["ship1","ship2"],
|
||||
"method": "REQCliCommand",
|
||||
"methodArgs": [
|
||||
"bash",
|
||||
"-c",
|
||||
"cat /etc/hostname && systemd-resolve --flush-caches &&wg-quick down wg0 && sleep 2 && wg-quick up wg0"
|
||||
],
|
||||
"replyMethod": "REQToFile",
|
||||
"ACKTimeout": 20,
|
||||
"retries": 3,
|
||||
"replyACKTimeout": 20,
|
||||
"replyRetries": 3,
|
||||
"methodTimeout": 20,
|
||||
"replyMethodTimeout": 120,
|
||||
"directory": "system/wireguard",
|
||||
"fileName": "wireguard-down-up.log",
|
||||
"relayViaNode": "central",
|
||||
"relayReplyMethod": "REQToConsole"
|
||||
}
|
||||
]
|
18
doc/example-messages/http-get-scheduled.json
Normal file
18
doc/example-messages/http-get-scheduled.json
Normal file
|
@ -0,0 +1,18 @@
|
|||
[
|
||||
{
|
||||
"toNodes": ["ship1"],
|
||||
"method": "REQHttpGetScheduled",
|
||||
"methodArgs": [
|
||||
"https://vg.no","10","1"
|
||||
],
|
||||
"replyMethod": "REQToConsole",
|
||||
"ACKTimeout": 5,
|
||||
"retries": 3,
|
||||
"replyACKTimeout": 5,
|
||||
"replyRetries": 3,
|
||||
"methodTimeout": 5,
|
||||
"replyMethodTimeout": 120,
|
||||
"directory": "test",
|
||||
"fileName": "test.txt"
|
||||
}
|
||||
]
|
0
doc/example-messages/operation-start-proc.json
Normal file
0
doc/example-messages/operation-start-proc.json
Normal file
0
doc/example-messages/operation-stop-proc.json
Normal file
0
doc/example-messages/operation-stop-proc.json
Normal file
|
@ -1,21 +0,0 @@
|
|||
[
|
||||
{
|
||||
"directory":"opcommand_logs",
|
||||
"fileName": "somefile.log",
|
||||
"toNode": "ship2",
|
||||
"data": [],
|
||||
"method":"REQOpCommand",
|
||||
"operation":{
|
||||
"opCmd":"startProc",
|
||||
"opArg": {
|
||||
"method": "REQHttpGet"
|
||||
}
|
||||
},
|
||||
"replyMethod":"REQToFileAppend",
|
||||
"ACKTimeout":3,
|
||||
"retries":3,
|
||||
"replyACKTimeout":3,
|
||||
"replyRetries":3,
|
||||
"MethodTimeout": 7
|
||||
}
|
||||
]
|
|
@ -1,23 +0,0 @@
|
|||
[
|
||||
{
|
||||
"directory":"opcommand_logs",
|
||||
"fileName": "somefile.log",
|
||||
"toNode": "ship2",
|
||||
"data": [],
|
||||
"method":"REQOpCommand",
|
||||
"operation":{
|
||||
"opCmd":"stopProc",
|
||||
"opArg": {
|
||||
"method": "REQHttpGet",
|
||||
"kind": "subscriber",
|
||||
"receivingNode": "ship2"
|
||||
}
|
||||
},
|
||||
"replyMethod":"REQToFileAppend",
|
||||
"ACKTimeout":3,
|
||||
"retries":3,
|
||||
"replyACKTimeout":3,
|
||||
"replyRetries":3,
|
||||
"MethodTimeout": 7
|
||||
}
|
||||
]
|
|
@ -1,18 +0,0 @@
|
|||
[
|
||||
{
|
||||
"directory":"opcommand_logs",
|
||||
"fileName": "somefile.log",
|
||||
"toNode": "ship2",
|
||||
"data": [],
|
||||
"method":"REQOpCommand",
|
||||
"operation":{
|
||||
"opCmd":"ps"
|
||||
},
|
||||
"replyMethod":"REQToFileAppend",
|
||||
"ACKTimeout":3,
|
||||
"retries":3,
|
||||
"replyACKTimeout":3,
|
||||
"replyRetries":3,
|
||||
"MethodTimeout": 7
|
||||
}
|
||||
]
|
15
doc/example-messages/use-sed-to-edit-files.json
Normal file
15
doc/example-messages/use-sed-to-edit-files.json
Normal file
|
@ -0,0 +1,15 @@
|
|||
[
|
||||
{
|
||||
"directory":"system",
|
||||
"fileName": "test.txt",
|
||||
"toNodes": ["ship1","ship2"],
|
||||
"methodArgs": ["bash","-c","sed -i 's/StartSubREQErrorLog =.*/StartSubREQErrorLog = false/g' /usr/local/steward/etc/config.toml && systemctl restart steward"],
|
||||
"method":"REQCliCommand",
|
||||
"replyMethod":"REQToFile",
|
||||
"ACKTimeout":10,
|
||||
"retries":1,
|
||||
"replyACKTimeout":10,
|
||||
"replyRetries":3,
|
||||
"methodTimeout": 60
|
||||
}
|
||||
]
|
Loading…
Reference in a new issue