--- /dev/null
+#!/usr/bin/env python
+#
+# Authors:
+# rafael@postgresql.org.es / http://www.postgresql.org.es/
+#
+# Copyright (c) 2016 USIT-University of Oslo
+#
+# get_webapps_instances.py is free software: you can redistribute
+# it and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation, either version
+# 3 of the License, or (at your option) any later version.
+#
+# get_webapps_instances.py is distributed in the hope that it will
+# be useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with sms_send. If not, see <http://www.gnu.org/licenses/>.
+#
+
+import os
+import sys
+import json
+import requests
+
+# Zabbix-mgmt
+zabbix_mgmt_url = 'http://zabbix-mgmt.uio.no/zabbix/V2'
+
+# ############################################
+# get_webapps_servers()
+# ############################################
+
+def get_webapp_instances(application):
+
+ try:
+
+ request_data = requests.get(zabbix_mgmt_url + "/" + application + ".json")
+
+ if request_data.status_code != 200:
+ sys.exit(1)
+
+ autodiscovery_data = request_data.content
+ print autodiscovery_data
+
+ except Exception:
+ sys.exit(1)
+
+
+# ############################################
+# Main
+# ############################################
+
+if __name__ == '__main__':
+
+ try:
+ application = sys.argv[1]
+ get_webapp_instances(application)
+
+ except Exception, e:
+ sys.exit(1)
--- /dev/null
+#!/usr/bin/env python
+
+import os
+import sys
+import socket
+import subprocess
+
+
+
+# Reverse DNS lookup - because the eapol_test command must have an IP address as input
+
+def resolv(hostname):
+ try:
+ host_ip = socket.gethostbyname(hostname)
+ return host_ip
+
+ except Exception as e:
+ raise e
+
+
+
+# Used to get the username(identity), password, key_mgmt, eap and phase2 information needed to log into
+# the Radius service. This information can be found in the .zabbix_radius_config file in the home
+# directory of the user running this script.
+
+def get_config_file():
+ config_file = os.getenv('HOME') + '/.zabbix_radius_config'
+
+ if os.path.isfile(config_file):
+ return config_file
+
+ else:
+ raise Exception("[ERROR]: The configuration file: %s does not exist" % config_file)
+
+
+
+# Get the secret needed to login to radius from the file .zabbix_radius_secret located in the home dir of the user running this script
+
+def get_secret_file():
+ secret_file = os.getenv('HOME') + '/.zabbix_radius_secret'
+
+ if os.path.isfile(secret_file):
+ try:
+ with open(secret_file,'r') as file:
+ for line in file:
+ radius_secret = line.rstrip()
+ return radius_secret
+
+ except Exception as e:
+ raise Exception("Error: %s\n" % e)
+
+ else:
+ raise Exception("[ERROR]: The file with the radius secret: %s does not exist" % secret_file)
+
+
+
+# runs eapol_test and returns 0 for successfull login to radius, 1 for login errors and 2 for the rest.
+
+def run_test(command):
+ try:
+ p = subprocess.Popen(command,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+ out = p.communicate()[0]
+ last_line = out.splitlines()[-1]
+
+ if last_line == "FAILURE":
+ return 1
+ elif last_line == "SUCCESS":
+ return 0
+ else:
+ return 2
+
+ except Exception as e:
+ raise Exception ("Error: %s\n" % e)
+
+
+
+# Puts together a eapol_test command pulling parameters from input and files
+# Default timeout of eapol_test is 30 seconds but here it is set to 10.
+
+if __name__ == "__main__":
+ try:
+ if len(sys.argv) == 3:
+ command = ["eapol_test", "-c", get_config_file(), "-a", resolv(sys.argv[1]), "-p", sys.argv[2], "-s", get_secret_file(), "-t", "10"]
+
+ print run_test(command)
+
+ else:
+ print "Error: Wrong number of parameters"
+ print 'Format: ' + sys.argv[0] + ' <hostname>' + ' <port>'
+ sys.exit(1)
+
+ except Exception as e:
+ sys.exit(2)
--- /dev/null
+#! /bin/sh
+
+DEBUG=0
+if [ $DEBUG -gt 0 ]
+then
+ exec 2>>/tmp/oracle_ldap_search.log
+ set -x
+fi
+
+option=$1
+ldap_server=$2
+
+case $option in
+ -H)
+ /usr/bin/ldapsearch -h $ldap_server -x -b "dc=no" dc=uio dc > /dev/null 2>&1
+ echo $?
+ ;;
+
+ *)
+ echo "usage: $0 [-H] hostname"
+ echo " -H Oracle ldap server"
+ ;;
+esac
--- /dev/null
+#! /bin/sh
+#------------------------------------------------------------
+# zext_ssl_cert.sh
+# Script checks for number of days until certificate expires or the issuing authority
+# depending on switch passed on command line.
+#
+#Based on script from aperto.fr (http://aperto.fr/cms/en/blog/15-blog-en/15-ssl-certificate-expiration-monitoring-with-zabbix.html)
+#with additions by racooper@tamu.edu
+#------------------------------------------------------------
+
+DEBUG=0
+if [ $DEBUG -gt 0 ]
+then
+ exec 2>>/tmp/my.log
+ set -x
+fi
+
+f=$1
+host=$2
+port=$3
+sni=$4
+proto=$5
+
+if [ -z "$sni" ]
+then
+ servername=$host
+else
+ servername=$sni
+fi
+
+if [ -n "$proto" ]
+then
+ starttls="-starttls $proto"
+fi
+
+case $f in
+-d)
+end_date=`openssl s_client -servername $servername -host $host -port $port -showcerts $starttls -prexit </dev/null 2>/dev/null |
+ sed -n '/BEGIN CERTIFICATE/,/END CERT/p' |
+ openssl x509 -text 2>/dev/null |
+ sed -n 's/ *Not After : *//p'`
+
+if [ -n "$end_date" ]
+then
+ end_date_seconds=`date '+%s' --date "$end_date"`
+ now_seconds=`date '+%s'`
+ echo "($end_date_seconds-$now_seconds)/24/3600" | bc
+fi
+;;
+
+-i)
+issue_dn=`openssl s_client -servername $servername -host $host -port $port -showcerts $starttls -prexit </dev/null 2>/dev/null |
+ sed -n '/BEGIN CERTIFICATE/,/END CERT/p' |
+ openssl x509 -text 2>/dev/null |
+ sed -n 's/ *Issuer: *//p'`
+
+if [ -n "$issue_dn" ]
+then
+ issuer=`echo $issue_dn | sed -n 's/.*CN=*//p'`
+ echo $issuer
+fi
+;;
+*)
+echo "usage: $0 [-i|-d] hostname port sni"
+echo " -i Show Issuer"
+echo " -d Show valid days remaining"
+;;
+esac