diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:19:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:19:22 +0000 |
commit | c21c3b0befeb46a51b6bf3758ffa30813bea0ff0 (patch) | |
tree | 9754ff1ca740f6346cf8483ec915d4054bc5da2d /fluent-bit/lib/monkey/examples/list.py | |
parent | Adding upstream version 1.43.2. (diff) | |
download | netdata-c21c3b0befeb46a51b6bf3758ffa30813bea0ff0.tar.xz netdata-c21c3b0befeb46a51b6bf3758ffa30813bea0ff0.zip |
Adding upstream version 1.44.3.upstream/1.44.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fluent-bit/lib/monkey/examples/list.py')
-rw-r--r-- | fluent-bit/lib/monkey/examples/list.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/fluent-bit/lib/monkey/examples/list.py b/fluent-bit/lib/monkey/examples/list.py new file mode 100644 index 000000000..d401d4280 --- /dev/null +++ b/fluent-bit/lib/monkey/examples/list.py @@ -0,0 +1,24 @@ +import monkey +import subprocess + +content = '' + +def list_cb(vhost, url, get, get_len, post, post_len, header): + global content + content = "<html><body><h2>Hello friend. You asked for %s.</h2>\n" + content += "<pre>" + content += subprocess.check_output(['ls', '-lh', '/tmp']) + content += "</pre></body></html>" + + ret = {} + ret['return'] = 1 + ret['content'] = content + ret['content_len'] = len(ret['content']) + + return ret + +monkey.init(None, 0, 0, None) +monkey.set_callback('data', list_cb) +monkey.start() +raw_input("Press enter to stop the server...") +monkey.stop() |