check vrouter xmpp
diff --git a/sensu/files/checks/check_vrouter_xmpp.sh b/sensu/files/checks/check_vrouter_xmpp.sh
new file mode 100644
index 0000000..1872be3
--- /dev/null
+++ b/sensu/files/checks/check_vrouter_xmpp.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+#usage: ./check_vrouter_xmpp.sh vrouter_ip
+
+vrouter_ip=$1
+
+exit_critical() {
+ echo "CRITICAL: $*"
+ exit 2
+}
+
+exit_ok() {
+ echo "OK: $*"
+ exit 0
+}
+
+read -ra ips <<< $(curl -s http://$vrouter_ip:8085/Snh_AgentXmppConnectionStatusReq? | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}')
+
+if [[ ${#ips[@]} -eq 0 ]]; then
+ exit_critical "No vrouter ip found"
+fi
+
+read -ra est <<< $(curl -s http://$vrouter_ip:8085/Snh_AgentXmppConnectionStatusReq? | grep -o 'Established')
+
+if [[ ${#ips[@]} -eq ${#est[@]} ]]; then
+ exit_ok "XMPP connection established"
+else
+ exit_critical "XMPP connection failed! http://$vrouter_ip:8085/Snh_AgentXmppConnectionStatusReq?"
+fi
+
diff --git a/sensu/map.jinja b/sensu/map.jinja
index 33d2d65..b93c2c0 100644
--- a/sensu/map.jinja
+++ b/sensu/map.jinja
@@ -11,11 +11,11 @@
{% set client = salt['grains.filter_by']({
'Debian': {
- 'pkgs': ['sensu', 'nagios-plugins-basic', 'curl'],
+ 'pkgs': ['sensu', 'nagios-plugins-basic', 'curl' 'bc'],
'plugin': {}
},
'RedHat': {
- 'pkgs': ['sensu', 'nagios-plugins-ping', 'nagios-plugins-procs', 'nagios-plugins-load', 'nagios-plugins-swap', 'nagios-plugins-ntp', 'nagios-plugins-http', 'nagios-plugins-disk', 'net-snmp-utils', 'pynag','bc'],
+ 'pkgs': ['sensu', 'nagios-plugins-ping', 'nagios-plugins-procs', 'nagios-plugins-load', 'nagios-plugins-swap', 'nagios-plugins-ntp', 'nagios-plugins-http', 'nagios-plugins-disk', 'net-snmp-utils', 'pynag', 'bc'],
'plugin': {}
},
}, merge=salt['pillar.get']('sensu:client')) %}