#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# |             ____ _               _        __  __ _  __           |
# |            / ___| |__   ___  ___| | __   |  \/  | |/ /           |
# |           | |   | '_ \ / _ \/ __| |/ /   | |\/| | ' /            |
# |           | |___| | | |  __/ (__|   <    | |  | | . \            |
# |            \____|_| |_|\___|\___|_|\_\___|_|  |_|_|\_\           |
# |                                                                  |
# +------------------------------------------------------------------+
#
# This file is an addon for Check_MK.
# The official homepage for this check is at http://bitbucket.org/darkfader
#
# check_mk 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 in version 2.  check_mk is  distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;  with-
# out even the implied warranty of  MERCHANTABILITY  or  FITNESS FOR A
# PARTICULAR PURPOSE. See the  GNU General Public License for more de-
# ails.  You should have  received  a copy of the  GNU  General Public
# License along with GNU Make; see the file  COPYING.  If  not,  write
# to the Free Software Foundation, Inc., 51 Franklin St,  Fifth Floor,
# Boston, MA 02110-1301 USA.


#<<<java_version:sep(124)>>>
#/usr/bin/java|Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)


# Here we can configure the "base" version, change this number as new 
# security flaws are found, and hopefully fixed.

java_allowed_versions = {
  # set to none as there's a 0day for any version at the moment.
  "Java(TM) SE Runtime" : None 
}


def inventory_java_version(info):
    inventory = []
    for line in info:
      # skip if this line has wrong number of parts
      if len(line) != 2:
          continue

      jre_path, jre_version = line
      for jre in java_allowed_versions.keys():
          if jre.startswith("jre_version"):
              # generate one service per installed jre
              inventory.append(jre_path, "java_allowed_versions")
      
    return inventory
        

def check_java_version(item, params, info):
     return (3, "UNKNOWN - Check not yet implemented")




#check_info
