1
0
Fork 0
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:
postmannen 2022-03-11 11:44:19 +01:00
parent c8a400de60
commit 0d89631289
22 changed files with 174 additions and 62 deletions

View 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
}
]

View 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"
}
]

View file

@ -0,0 +1,10 @@
[
{
"directory": "copy",
"fileName": "copy.log",
"toNodes": ["ship1"],
"method":"REQCopyFileFrom",
"methodArgs": ["./tmp2.txt","ship2","/tmp/tmp2.txt"],
"replyMethod":"REQToFileAppend"
}
]

View file

@ -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

View 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"
}
]

View 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"
}
]

View 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"
}
]

View 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"
}
]

View 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
}
]

View file

@ -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
}
]

View file

@ -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
}
]

View 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
}
]