1 |
diff -Nur -x '*.orig' -x '*.rej' smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias |
2 |
--- smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias 2010-09-02 17:11:33.000000000 +0200 |
3 |
+++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias 2010-09-02 17:11:14.000000000 +0200 |
4 |
@@ -4,7 +4,16 @@ |
5 |
$runasroot .= ', /var/lib/zabbix/bin/megaraid-parser.pl'; |
6 |
} |
7 |
$runasroot .= "\n"; |
8 |
-$OUT .= 'Cmnd_Alias ZABBIX_AGENT_ROOT = '.$runasroot |
9 |
+$OUT .= 'Cmnd_Alias ZABBIX_AGENT_ROOT = '.$runasroot; |
10 |
+ |
11 |
+if ( -x '/usr/sbin/asterisk' ){ |
12 |
+ $OUT.=<<"HERE" |
13 |
+ |
14 |
+Cmnd_Alias ZABBIX_AGENT_ASTERISK = /var/lib/zabbix/bin/check_asterisk * |
15 |
+ |
16 |
+HERE |
17 |
+} |
18 |
+ |
19 |
} |
20 |
Cmnd_Alias ZABBIX_AGENT_MYSQL = /usr/bin/du -s /var/lib/mysql |
21 |
|
22 |
diff -Nur -x '*.orig' -x '*.rej' smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/30zabbixAgent mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/30zabbixAgent |
23 |
--- smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/30zabbixAgent 2010-09-02 17:11:33.000000000 +0200 |
24 |
+++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/30zabbixAgent 2010-09-02 17:10:47.000000000 +0200 |
25 |
@@ -1,3 +1,9 @@ |
26 |
zabbix ALL=(root) NOPASSWD: ZABBIX_AGENT_ROOT |
27 |
zabbix ALL=(mysql) NOPASSWD: ZABBIX_AGENT_MYSQL |
28 |
- |
29 |
+{ |
30 |
+if ( -x '/usr/sbin/asterisk' ){ |
31 |
+ $OUT.=<<"HERE" |
32 |
+zabbix ALL=(asterisk) NOPASSWD: ZABBIX_AGENT_ASTERISK |
33 |
+HERE |
34 |
+} |
35 |
+} |
36 |
diff -Nur -x '*.orig' -x '*.rej' smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_asterisk mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_asterisk |
37 |
--- smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_asterisk 1970-01-01 01:00:00.000000000 +0100 |
38 |
+++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_asterisk 2010-09-02 17:10:47.000000000 +0200 |
39 |
@@ -0,0 +1,18 @@ |
40 |
+{ |
41 |
+ |
42 |
+if ( -x '/usr/sbin/asterisk' ){ |
43 |
+ $OUT.=<<"HERE" |
44 |
+# Type: Agent or Agent (active) |
45 |
+# Key: asterisk[key] where key can be max_latency, sip_peers, iax2_peers, channels, calls, version |
46 |
+# Type of information: Numeric (integer 64bit) or characters (for version) |
47 |
+# Units: depends on the key |
48 |
+# Custom multiplier: Do not use |
49 |
+# Store Value: As is |
50 |
+ |
51 |
+UserParameter=asterisk[*],/usr/bin/sudo -u asterisk /var/lib/zabbix/bin/check_asterisk_monitoring \$1 |
52 |
+ |
53 |
+HERE |
54 |
+} |
55 |
+ |
56 |
+} |
57 |
+ |
58 |
diff -Nur -x '*.orig' -x '*.rej' smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/check_asterisk mezzanine_patched_smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/check_asterisk |
59 |
--- smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/check_asterisk 1970-01-01 01:00:00.000000000 +0100 |
60 |
+++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/check_asterisk 2010-09-02 17:10:47.000000000 +0200 |
61 |
@@ -0,0 +1,61 @@ |
62 |
+#!/bin/bash |
63 |
+ |
64 |
+# Asterisk check script |
65 |
+# by Steeve Avoungou Firewall Services |
66 |
+ |
67 |
+if [ $# -ne "1" ]; then |
68 |
+ echo "Usage:" |
69 |
+ echo "$0 <arg>" |
70 |
+ echo "Where <arg> can be one of version, sip_peers, iax2_peers, max_latency, channels, calls" |
71 |
+ exit 1 |
72 |
+fi |
73 |
+ |
74 |
+ |
75 |
+case "$@" in |
76 |
+ |
77 |
+ # Show version of asterisk: |
78 |
+ version) |
79 |
+ echo $(asterisk -rx 'core show version') |
80 |
+ ;; |
81 |
+ |
82 |
+ # Count SIP peers |
83 |
+ sip_peers) |
84 |
+ echo $(asterisk -rx 'sip show peers'| grep -v 'Name/username' | egrep -v '[[:digit:]] sip peers' | wc -l) |
85 |
+ ;; |
86 |
+ |
87 |
+ # Display the higher latency |
88 |
+ max_latency) |
89 |
+ max_latency=0 |
90 |
+ for i in $(asterisk -rx 'sip show peers' | awk '{print $8}' | grep -o '[0-9][0-9]*'); do |
91 |
+ if [ "$i" -gt "$max_latency" ]; then |
92 |
+ max_latency=$i |
93 |
+ fi |
94 |
+ done |
95 |
+ for i in $(asterisk -rx 'iax2 show peers' | awk '{print $8}' | grep -o '[0-9][0-9]*'); do |
96 |
+ if [ "$i" -gt "$max_latency" ]; then |
97 |
+ max_latency=$i |
98 |
+ fi |
99 |
+ done |
100 |
+ echo $max_latency |
101 |
+ ;; |
102 |
+ |
103 |
+ # Count IAX2 peers |
104 |
+ iax2_peers) |
105 |
+ echo $(asterisk -rx 'iax2 show peers' | grep -v 'Name/Username' | egrep -v '[[:digit:]] iax2 peers' | wc -l) |
106 |
+ ;; |
107 |
+ |
108 |
+ # Count number of active channels |
109 |
+ channels) |
110 |
+ echo $(asterisk -rx "core show channels" | grep 'active channel' | awk '{print $1}') |
111 |
+ ;; |
112 |
+ |
113 |
+ # Count number of active calls |
114 |
+ calls) |
115 |
+ echo $(asterisk -rx "core show channels" | grep 'active call' | awk '{print $1}') |
116 |
+ ;; |
117 |
+ |
118 |
+ *) |
119 |
+ echo 'ZBX_NOTSUPPORTED' |
120 |
+ ;; |
121 |
+esac |
122 |
+ |