Skip to content

Instantly share code, notes, and snippets.

@tsleite
Created January 4, 2021 14:54
Show Gist options
  • Save tsleite/0ab85edb84c7dcdb8d557a8b15fddb9e to your computer and use it in GitHub Desktop.
Save tsleite/0ab85edb84c7dcdb8d557a8b15fddb9e to your computer and use it in GitHub Desktop.
#!/bin/bash
# Foked script
# Discovery all process running
# Data: 01/09/2020
set -e
run=`echo -n '{"data":[' ;ps -A -o comm= -o time= -o vsz= | grep -v ' 00:00:00' | awk '$3 != 0' | cut -c-15 | sed 's/ *$//' | awk '!a[$0]++' | sed 's/\(.*\)/{"{#N_PROCESSO}":"\1"}/g' | sed '$!s/$/,/' | tr '\n' ' ' ;echo -n ']}'`
echo -e "$run" | jq .
@tsleite
Copy link
Author

tsleite commented Jan 4, 2021

Build json for Zabbix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment