1. bash / Говнокод #22371

    −97

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    #!/bin/sh
    # 
    # Plugin to monitor the number of connections to RabbitMQ
    #
    # Usage: Link or copy into /etc/munin/node.d/
    #
    # Parameters
    #     env.conn_warn <warning connections>
    #     env.conn_crit <critical connections>
    #
    if [ "$1" = "autoconf" ]; then
    	echo yes
    	exit 0
    fi
    
    HOME=/tmp/
    
    # If run with the "config"-parameter, give out information on how the
    # graphs should look. 
    
    if [ "$1" = "config" ]; then
            CONN_WARN=${queue_warn:-500}
            CONN_CRIT=${queue_crit:-1000}
    
    	# The host name this plugin is for. (Can be overridden to have
    	# one machine answer for several)
    
    	# The title of the graph
    	echo 'graph_title RabbitMQ connections'
    	# Arguments to "rrdtool graph". In this case, tell it that the
    	# lower limit of the graph is '0', and that 1k=1000 (not 1024)
    	echo 'graph_args --base 1000 -l 0'
    	# The Y-axis label
    	echo 'graph_vlabel connections'
    	# We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of
    	# 420 milliload)
    	#echo 'graph_scale no'
    	echo 'graph_category RabbitMQ'
    
    	echo "connections.label Connections"
    	echo "connections.warning $CONN_WARN"
    	echo "connections.critical $CONN_CRIT"
    	echo "connections.info Number of active connections"
    
    	echo 'graph_info Shows the number of connections to RabbitMQ'
    	# Last, if run with the "config"-parameter, quit here (don't
    	# display any data)
    	exit 0
    fi
    
    # If not run with any parameters at all (or only unknown ones), do the
    # real work - i.e. display the data. Almost always this will be
    # "value" subfield for every data field.
    
    echo "connections.value $(HOME=$HOME rabbitmqctl list_connections | grep -v "^Listing" | grep -v "done.$" | wc -l)"

    Запостил: munin, 19 Февраля 2017

    Комментарии (0) RSS

    Добавить комментарий

    Ошибка компиляции комментария:
    1. Гости могут высказаться только в понедельник, среду, четверг или воскресение
    ava Я, guest, находясь в здравом уме и твердой памяти, торжественно заявляю:
    А не использовать ли нам bbcode?
    • [b]жирный[/b] — жирный
    • [i]курсив[/i] — курсив
    • [u]подчеркнутый[/u] — подчеркнутый
    • [s]перечеркнутый[/s] — перечеркнутый
    • [blink]мигающий[/blink] — мигающий
    • [color=red]цвет[/color] — цвет (подробнее)
    • [size=20]размер[/size] — размер (подробнее)
    • [code=<language>]some code[/code] (подробнее)
    Проверочный код