Last active
July 29, 2017 01:57
-
-
Save raphapr/73414fb0fdfd1041f139d8ac9f80cbea to your computer and use it in GitHub Desktop.
Revisions
-
raphapr revised this gist
Jun 13, 2017 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,6 @@ debug "curl is ${C}" debug "jq is ${JQ}" debug "queue file is ${QFILE}" LBUSER= LBTOKEN= -
raphapr revised this gist
Jun 13, 2017 . 1 changed file with 15 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,25 @@ #!/bin/bash # It sends LDAP (389 DS) metrics to Librato # Install shellbrato: # git clone https://github.com/djosephsen/shellbrato.git # sudo cp -a shellbrato /opt source /opt/shellbrato/shellbrato.sh debug "shellbrato successfully sourced" debug "curl is ${C}" debug "jq is ${JQ}" debug "queue file is ${QFILE}" LBUSER= LBTOKEN= src="host" metric_name="freeipa.ldap.monitor" wait_secs=30 metrics=( anonymousbinds @@ -36,10 +45,10 @@ while true; do query_output=$(ldapsearch -x -b "cn=Monitor") for i in ${!metrics[*]} do metric_subname=${metrics[$i]} metric_value=$(getLDAPMetrics ${metrics[$i]}) Q=$(queueCounter "${now}||${metric_name}.${metric_subname}||${metric_value}||${src}") sendMetrics ${Q} done sleep ${wait_secs} done -
raphapr created this gist
Jun 13, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ #!/bin/bash source /opt/shellbrato/shellbrato.sh LBUSER= LBTOKEN= debug "shellbrato successfully sourced" debug "curl is ${C}" debug "jq is ${JQ}" debug "queue file is ${QFILE}" src="host" metrics=( anonymousbinds simpleauthbinds strongauthbinds currentconnections totalconnections entriessent bytessent bytesrecv searchops modifyentryops inops ) getLDAPMetrics() { printf "$query_output" | sed -n -e 's/^.*'"$1"': //p' | head -n 1 } while true; do now=$(date +%s) query_output=$(ldapsearch -x -b "cn=Monitor") for i in ${!metrics[*]} do metric_name=${metrics[$i]} metric_value=$(getLDAPMetrics ${metrics[$i]}) Q=$(queueCounter "${now}||freeipa.ldap.monitor.${metric_name}||${metric_value}||${src}") sendMetrics ${Q} done sleep 30 done