@cryptotaxi247 / netdata-1 / commits / c3ff6235e

Minor variable fixes.

manosf committed Feb 28, 2018 at 16:06 UTC c3ff6235e21f0b004f6fe0ad6ccfcae5c4bee131
1 file changed +6 -6
plugins.d/alarm-notify.sh
+6 -6
@@ -1471,9 +1471,9 @@ EOF
1471 # irc sender
1472
1473 send_irc() {
1474 - local NICKNAME="${1}" REALNAME="${2}" CHANNELS="${3}" NETWORK="${4}" MESSAGE="${5}" sent=0 channel color send_alarm reply_codes error
1474 + local NICKNAME="${1}" REALNAME="${2}" CHANNELS="${3}" NETWORK="${4}" SERVERNAME="${5}" MESSAGE="${6}" sent=0 channel color send_alarm reply_codes error
1475
1476 - if [ "${SEND_IRC}" = "YES" -a ! -z "${nickname}" -a ! -z "${realname}" -a ! -z "${channels}" -a ! -z "${network}" -a ! -z "${servername}" ]
1476 + if [ "${SEND_IRC}" = "YES" -a ! -z "${NICKNAME}" -a ! -z "${REALNAME}" -a ! -z "${CHANNELS}" -a ! -z "${NETWORK}" -a ! -z "${SERVERNAME}" ]
1477 then
1478 case "${status}" in
1479 WARNING) color="warning" ;;
@@ -1482,10 +1482,10 @@ send_irc() {
1482 *) color="#777777" ;;
1483 esac
1484
1485 - for channel in ${CHANNELS}
1485 + for CHANNEL in ${CHANNELS}
1486 do
1487 error=0
1488 - send_alarm=$(echo -e "USER ${NICKNAME} guest ${REALNAME} ${SERVERNAME}\nNICK ${NICKNAME}\nJOIN ${CHANNEL}\nPRIVMSG ${CHANNEL}> :${MESSAGE}\nQUIT\n" \ | nc ${NETWORK} 6667)
1488 + send_alarm=$(echo -e "USER ${NICKNAME} guest ${REALNAME} ${SERVERNAME}\nNICK ${NICKNAME}\nJOIN ${CHANNEL}\nPRIVMSG ${CHANNEL} :${MESSAGE}\nQUIT\n" \ | nc ${NETWORK} 6667)
1489 reply_codes=$(echo ${send_alarm} | cut -d ' ' -f 2 | grep -o '[0-9]*')
1490 for code in ${reply_codes}
1491 do
@@ -1494,10 +1494,10 @@ send_irc() {
1494
1495 if [ "${error}" -eq 0 ]
1496 then
1497 - info "sent irc notification for: ${host} ${chart}.${name} is ${status} to '${channel}'"
1497 + info "sent irc notification for: ${host} ${chart}.${name} is ${status} to '${CHANNEL}'"
1498 sent=$((sent + 1))
1499 else
1500 - error "failed to send irc notification for: ${host} ${chart}.${name} is ${status} to '${channel}', with error code ${code}."
1500 + error "failed to send irc notification for: ${host} ${chart}.${name} is ${status} to '${CHANNEL}', with error code ${code}."
1501 fi
1502 done
1503 fi