exim.chart.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # shellcheck shell=bash
  2. # no need for shebang - this file is loaded from charts.d.plugin
  3. # SPDX-License-Identifier: GPL-3.0-or-later
  4. # netdata
  5. # real-time performance and health monitoring, done right!
  6. # (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
  7. #
  8. # Contributed by @jsveiga with PR #480
  9. # the exim command to run
  10. exim_command=
  11. # how frequently to collect queue size
  12. exim_update_every=5
  13. exim_priority=60000
  14. exim_check() {
  15. if [ -z "${exim_command}" ]
  16. then
  17. require_cmd exim || return 1
  18. exim_command="${EXIM_CMD}"
  19. fi
  20. if [ "$(${exim_command} -bpc 2>&1 | grep -c denied)" -ne 0 ]
  21. then
  22. error "permission denied - please set 'queue_list_requires_admin = false' in your exim options file"
  23. return 1
  24. fi
  25. return 0
  26. }
  27. exim_create() {
  28. cat <<EOF
  29. CHART exim_local.qemails '' "Exim Queue Emails" "emails" queue exim.queued.emails line $((exim_priority + 1)) $exim_update_every
  30. DIMENSION emails '' absolute 1 1
  31. EOF
  32. return 0
  33. }
  34. exim_update() {
  35. echo "BEGIN exim_local.qemails $1"
  36. echo "SET emails = $(run "${exim_command}" -bpc)"
  37. echo "END"
  38. return 0
  39. }