Titel | oracle_sessions: Read parameters from the database |
Komponente | Checks & Agents |
Datum | 2018-02-20 |
Status | Done (Won't Do) |
Klasse | Feature/Improvement |
ich wollt nur ne kleine Anregung fuer euren neuen check oracle_sessions in 1.2.7i geben.
Waere es sinnvoll, die Parameter fuer die Sessions direkt aus der Datenbank zu holen, da diese dort per default vorhanden sind.
Der Select waere
select current_utilization,limit_value from v\\\$resource_limit where resource_name like 'sessions'
damit haette man als Output die Werte Nutzung Limit
Bsp:
dialentw 59 1522
und koennte dann die Schwellwerte prozentual festlegen
Ich habe einen entsprechenden check gebaut und ich haeng ihn einfach mal als Beispiel an
----------------------------
Beispielcheck:
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# <<
>>
# pengt 15 40
# hirni 22 70
oracle_total_sessions_default_levels = (70.0, 90.0)
def inventory_oracle_total_sessions(info):
return [ (line[0], "oracle_total_sessions_default_levels") for line in info if len(line) >= 2 ]
def check_oracle_total_sessions(item, params, info):
for line in info:
if line[0] == item:
err = oracle_handle_ora_errors(line)
if err == False:
continue
elif isinstance(err, tuple):
return err
warn, crit = params
sessions = int(line[1])
maxsess = int(line[2])
sessUse = ((sessions * 100) / maxsess)
infotext = "%.2f %% used: %d of max. %d Sessions (Levels: %.2f / %.2f %%)" % (sessUse, sessions, maxsess, warn, crit)
perfdata = [("total_sessions", sessUse, warn, crit)]
if sessUse >= crit:
return (2, infotext, perfdata)
elif sessUse >= warn:
return (1, infotext, perfdata)
else:
return (0, infotext, perfdata)
infotext = "Database not existing or not running"
return (3, infotext)
check_includes['oracle_total_sessions'] = [ "oracle.include" ]
check_info["oracle_total_sessions"] = {
'check_function': check_oracle_total_sessions,
'inventory_function': inventory_oracle_total_sessions,
'service_description': 'ORA %s total_Sessions',
'has_perfdata': True,
'group': 'oracle_total_sessions',
}