Project OpenNMS
Version OpenNMS 090807
Version Date 2009-08-07

Tables
alarm_attributes (public)
Column Data Type Nullable Default Description
alarmid integer null
attributename varchar(63) null
attributevalue varchar(255) null
Index Type Columns
alarm_attributes_aan_idx Unique alarmid, attributename
alarm_attributes_idx alarmid
Foreign Key Column Referenced Column
alarms (public) alarmid alarmid
alarms (public)
alaaaaaaarm
Column Data Type Nullable Default Description
alarmid integer not null
eventuei varchar(256) not null
dpname varchar(12) not null
nodeid integer null
ipaddr varchar(16) null
serviceid integer null
reductionkey varchar(256) null
alarmtype integer null
counter integer not null
severity integer not null
lasteventid integer null
firsteventtime timestamp with time zone null
lasteventtime timestamp with time zone null
firstautomationtime timestamp with time zone null
lastautomationtime timestamp with time zone null
description varchar(4000) null
logmsg varchar(256) null
operinstruct varchar(1024) null
tticketid varchar(128) null
tticketstate integer null
mouseovertext varchar(64) null
suppresseduntil timestamp with time zone null
suppresseduser varchar(256) null
suppressedtime timestamp with time zone null
alarmackuser varchar(256) null
alarmacktime timestamp with time zone null
clearuei varchar(256) null
managedobjectinstance varchar(512) null
managedobjecttype varchar(512) null
applicationdn varchar(512) null
ossprimarykey varchar(512) null
x733alarmtype varchar(31) null
x733probablecause integer not null 0
qosalarmstate varchar(31) null
clearkey varchar(256) null
Primary Key Columns
pk_alarmid alarmid
Index Type Columns
alarm_reductionkey_idx Unique reductionkey
alarm_app_dn applicationdn
alarm_clearkey_idx clearkey
alarm_eventid_idx lasteventid
alarm_nodeid_idx nodeid
alarm_oss_primary_key ossprimarykey
alarm_reduction2_idx alarmid, eventuei, dpname, nodeid, serviceid, reductionkey
alarm_uei_idx eventuei
Foreign Key Column Referenced Column
events (public) lasteventid eventid
Detail Table Column Referencing Column
alarm_attributes (public) alarmid alarmid
application_service_map (public)
Column Data Type Nullable Default Description
appid integer null
ifserviceid integer null
Index Type Columns
appid_ifserviceid_idex Unique appid, ifserviceid
appid_idx appid
ifserviceid_idx ifserviceid
Foreign Key Column Referenced Column
applications (public) appid id
ifservices (public) ifserviceid id
applications (public)
Column Data Type Nullable Default Description
id integer not null
name varchar(32) not null
Primary Key Columns
applications_pkey id
Index Type Columns
applications_name_idx Unique name
Detail Table Column Referencing Column
application_service_map (public) id appid
assets (public)
Column Data Type Nullable Default Description
id integer not null nextval('opennmsnxtid'::regclass)
nodeid integer null
category varchar(64) not null
manufacturer varchar(64) null
vendor varchar(64) null
modelnumber varchar(64) null
serialnumber varchar(64) null
description varchar(128) null
circuitid varchar(64) null
assetnumber varchar(64) null
operatingsystem varchar(64) null
rack varchar(64) null
slot varchar(64) null
port varchar(64) null
region varchar(64) null
division varchar(64) null
department varchar(64) null
address1 varchar(256) null
address2 varchar(256) null
city varchar(64) null
state varchar(64) null
zip varchar(64) null
building varchar(64) null
floor varchar(64) null
room varchar(64) null
vendorphone varchar(64) null
vendorfax varchar(64) null
vendorassetnumber varchar(64) null
userlastmodified char(20) not null
lastmodifieddate timestamp with time zone not null
dateinstalled varchar(64) null
lease varchar(64) null
leaseexpires varchar(64) null
supportphone varchar(64) null
maintcontract varchar(64) null
maintcontractexpires varchar(64) null
displaycategory varchar(64) null
notifycategory varchar(64) null
pollercategory varchar(64) null
thresholdcategory varchar(64) null
comment text null
managedobjectinstance varchar(512) null
managedobjecttype varchar(512) null
Primary Key Columns
pk_assetid id
Index Type Columns
assets_nodeid_idx nodeid
assets_an_idx assetnumber
Foreign Key Column Referenced Column
node (public) nodeid nodeid
atinterface (public)
Column Data Type Nullable Default Description
id integer not null nextval('opennmsnxtid'::regclass)
nodeid integer not null
ipaddr varchar(16) not null
atphysaddr varchar(12) not null
status char(1) not null
sourcenodeid integer not null
ifindex integer not null
lastpolltime timestamp without time zone not null
Primary Key Columns
pk_atinterface nodeid, ipaddr, atphysaddr
Index Type Columns
atinterface_nodeid_idx nodeid
atinterface_atphysaddr_idx atphysaddr
atinterface_node_ipaddr_idx nodeid, ipaddr
Foreign Key Column Referenced Column
node (public) nodeid nodeid
categories (public)
Column Data Type Nullable Default Description
categoryid integer not null
categoryname varchar(64) not null
categorydescription varchar(256) null
Primary Key Columns
category_pkey categoryid
Index Type Columns
category_idx Unique categoryname
Detail Table Column Referencing Column
category_node (public) categoryid categoryid
category_node (public)
Column Data Type Nullable Default Description
categoryid integer null
nodeid integer null
Index Type Columns
catenode_unique_idx Unique categoryid, nodeid
catid_idx categoryid
catnode_idx nodeid
Foreign Key Column Referenced Column
categories (public) categoryid categoryid
node (public) nodeid nodeid
datalinkinterface (public)
Column Data Type Nullable Default Description
nodeid integer not null
ifindex integer not null
nodeparentid integer not null
parentifindex integer not null
status char(1) not null
lastpolltime timestamp without time zone not null
Primary Key Columns
pk_datalinkinterface nodeid, ifindex
Index Type Columns
dlint_nodeparent_idx nodeparentid
dlint_node_idx nodeid
dlint_nodeparent_paifindex_idx nodeparentid, parentifindex
Foreign Key Column Referenced Column
node (public) nodeid nodeid
node (public) nodeparentid nodeid
demandpolls (public)
Column Data Type Nullable Default Description
id integer not null
requesttime timestamp with time zone null
username varchar(32) null
description varchar(128) null
Primary Key Columns
demandpoll_pkey id
Index Type Columns
demandpoll_request_time requesttime
Detail Table Column Referencing Column
pollresults (public) id pollid
distpoller (public)
Column Data Type Nullable Default Description
dpname varchar(12) not null
dpip varchar(16) not null
dpcomment varchar(256) null
dpdisclimit numeric(5, 2) null
dplastnodepull timestamp with time zone null
dplasteventpull timestamp with time zone null
dplastpackagepush timestamp with time zone null
dpadminstate integer null
dprunstate integer null
Primary Key Columns
pk_dpname dpname
Detail Table Column Referencing Column
node (public) dpname dpname
element (public)
Column Data Type Nullable Default Description
mapid integer not null
elementid integer not null
elementtype char(1) not null
elementlabel varchar(256) not null
elementicon varchar(256) null
elementx integer null
elementy integer null
Primary Key Columns
pk_element mapid, elementid, elementtype
Index Type Columns
element_mapid_elementid mapid, elementid
Foreign Key Column Referenced Column
map (public) mapid mapid
events (public)
Column Data Type Nullable Default Description
eventid integer not null
eventuei varchar(256) not null
nodeid integer null
eventtime timestamp with time zone not null
eventhost varchar(256) null
eventsource varchar(128) not null
ipaddr varchar(16) null
eventdpname varchar(12) not null
eventsnmphost varchar(256) null
serviceid integer null
eventsnmp varchar(256) null
eventparms text null
eventcreatetime timestamp with time zone not null
eventdescr varchar(4000) null
eventloggroup varchar(32) null
eventlogmsg varchar(256) null
eventseverity integer not null
eventpathoutage varchar(1024) null
eventcorrelation varchar(1024) null
eventsuppressedcount integer null
eventoperinstruct varchar(1024) null
eventautoaction varchar(256) null
eventoperaction varchar(256) null
eventoperactionmenutext varchar(64) null
eventnotification varchar(128) null
eventtticket varchar(128) null
eventtticketstate integer null
eventforward varchar(256) null
eventmouseovertext varchar(64) null
eventlog char(1) not null
eventdisplay char(1) not null
eventackuser varchar(256) null
eventacktime timestamp with time zone null
alarmid integer null
Primary Key Columns
pk_eventid eventid
Index Type Columns
events_time_idx eventtime
events_uei_idx eventuei
events_serviceid_idx serviceid
events_nodeid_idx nodeid
events_nodeid_display_ackuser nodeid, eventdisplay, eventackuser
events_log_idx eventlog
events_ipaddr_idx ipaddr
events_display_idx eventdisplay
events_alarmid_idx alarmid
events_ackuser_idx eventackuser
events_acktime_idx eventacktime
events_severity_idx eventseverity
Detail Table Column Referencing Column
outages (public) eventid svclosteventid
outages (public) eventid svcregainedeventid
notifications (public) eventid eventid
alarms (public) eventid lasteventid
ifservices (public)
Column Data Type Nullable Default Description
id integer not null nextval('opennmsnxtid'::regclass)
nodeid integer not null
ipaddr varchar(16) not null
ifindex integer null
serviceid integer not null
lastgood timestamp with time zone null
lastfail timestamp with time zone null
qualifier char(16) null
status char(1) null
source char(1) null
notify char(1) null
ipinterfaceid integer not null
Primary Key Columns
ifservices_pkey id
Index Type Columns
ifservices_nodeid_ipaddr_svc_unique Unique nodeid, ipaddr, serviceid
ifservices_serviceid_idx serviceid
ifservices_nodeid_ipaddr_status nodeid, ipaddr, status
ifservices_nodeid_status nodeid, status
ifservicves_ipinterfaceid_idx ipinterfaceid
ifservices_nodeid_idx nodeid
ifservices_nodeid_serviceid_idx nodeid, serviceid
Foreign Key Column Referenced Column
node (public) nodeid nodeid
service (public) serviceid serviceid
ipinterface (public) ipinterfaceid id
Detail Table Column Referencing Column
outages (public) nodeid nodeid
outages (public) nodeid nodeid
outages (public) nodeid nodeid
outages (public) id ifserviceid
application_service_map (public) id ifserviceid
location_specific_status_changes (public) id ifserviceid
Triggers Type Function
setipinterfacekeysoninserttrigger ROW BEFORE INSERT setipinterfacekeysoninsert
setipinterfacekeysonupdatetrigger ROW BEFORE UPDATE setipinterfacekeysonupdate
inventory (public)
Column Data Type Nullable Default Description
nodeid integer not null
name varchar(30) not null
createtime timestamp without time zone not null
lastpolltime timestamp without time zone not null
pathtofile varchar(256) not null
status char(1) not null
Index Type Columns
inventory_lastpolltime_idx lastpolltime
inventory_nodeid_idx nodeid
inventory_nodeid_name_idx nodeid, name
inventory_status_idx status
Foreign Key Column Referenced Column
node (public) nodeid nodeid
ipinterface (public)
Column Data Type Nullable Default Description
id integer not null nextval('opennmsnxtid'::regclass)
nodeid integer not null
ipaddr varchar(16) not null
ifindex integer null
iphostname varchar(256) null
ismanaged char(1) null
ipstatus integer null
iplastcapsdpoll timestamp with time zone null
issnmpprimary char(1) null
snmpinterfaceid integer null
Primary Key Columns
ipinterface_pkey id
Index Type Columns
ipinterface_nodeid_ipaddr_notzero_idx Unique nodeid, ipaddr
ipinterface_snmpinterfaceid_idx snmpinterfaceid
ipinterface_nodeid_ismanaged_idx ipaddr
ipinterface_ipaddr_idx ipaddr
ipinterface_ipaddr_ismanaged_idx ipaddr, ismanaged
ipinterface_nodeid_idx nodeid
ipinterface_nodeid_ipaddr_ismanaged_idx nodeid, ipaddr, ismanaged
Foreign Key Column Referenced Column
node (public) nodeid nodeid
snmpinterface (public) snmpinterfaceid id
Detail Table Column Referencing Column
ifservices (public) id ipinterfaceid
Triggers Type Function
setsnmpinterfacekeysoninserttrigger ROW BEFORE INSERT setsnmpinterfacekeysoninsert
setsnmpinterfacekeysonupdatetrigger ROW BEFORE UPDATE setsnmpinterfacekeysonupdate
iprouteinterface (public)
Column Data Type Nullable Default Description
nodeid integer not null
routedest varchar(16) not null
routemask varchar(16) not null
routenexthop varchar(16) not null
routeifindex integer not null
routemetric1 integer null
routemetric2 integer null
routemetric3 integer null
routemetric4 integer null
routemetric5 integer null
routetype integer null
routeproto integer null
status char(1) not null
lastpolltime timestamp without time zone not null
Primary Key Columns
pk_iprouteinterface nodeid, routedest
Index Type Columns
iprouteinterface_rnh_idx routenexthop
iprouteinterface_node_ifdex_idx nodeid, routeifindex
iprouteinterface_nodeid_idx nodeid
Foreign Key Column Referenced Column
node (public) nodeid nodeid
location_monitor_details (public)
Column Data Type Nullable Default Description
locationmonitorid integer not null
property varchar(255) not null
propertyvalue varchar(255) null
Index Type Columns
location_monitor_details_id_property Unique locationmonitorid, property
location_monitor_details_id locationmonitorid
Foreign Key Column Referenced Column
location_monitors (public) locationmonitorid id
location_monitors (public)
Column Data Type Nullable Default Description
id integer not null
status varchar(31) not null
lastcheckintime timestamp with time zone null
definitionname varchar(31) not null
Primary Key Columns
location_monitors_pkey id
Detail Table Column Referencing Column
location_monitor_details (public) id locationmonitorid
location_specific_status_changes (public) id locationmonitorid
location_specific_status_changes (public)
Column Data Type Nullable Default Description
id integer not null
locationmonitorid integer not null
ifserviceid integer not null
statuscode integer not null
statustime timestamp with time zone not null
statusreason varchar(255) null
responsetime double precision null
Primary Key Columns
location_specific_status_changes_pkey id
Index Type Columns
location_specific_status_changes_statustime statustime
location_specific_status_changes_locationmonitorid_ifserviceid locationmonitorid, ifserviceid
location_specific_status_changes_locationmonitorid locationmonitorid
location_specific_status_changes_ifserviceid ifserviceid
location_specific_status_changes_locationmonitorid_loc_if_time locationmonitorid, ifserviceid, statustime
Foreign Key Column Referenced Column
ifservices (public) ifserviceid id
location_monitors (public) locationmonitorid id
map (public)
Column Data Type Nullable Default Description
mapid integer not null
mapname varchar(40) not null
mapbackground varchar(256) null
mapowner varchar(64) not null
mapcreatetime timestamp without time zone not null
mapaccess char(6) not null
userlastmodifies varchar(64) not null
lastmodifiedtime timestamp without time zone not null
mapscale double precision null
mapxoffset integer null
mapyoffset integer null
maptype char(1) null
mapwidth integer not null
mapheight integer not null
Primary Key Columns
pk_mapid mapid
Detail Table Column Referencing Column
element (public) mapid mapid
node (public)
Column Data Type Nullable Default Description
nodeid integer not null
dpname varchar(12) null
nodecreatetime timestamp with time zone not null
nodeparentid integer null
nodetype char(1) null
nodesysoid varchar(256) null
nodesysname varchar(256) null
nodesysdescription varchar(256) null
nodesyslocation varchar(256) null
nodesyscontact varchar(256) null
nodelabel varchar(256) null
nodelabelsource char(1) null
nodenetbiosname varchar(16) null
nodedomainname varchar(16) null
operatingsystem varchar(64) null
lastcapsdpoll timestamp with time zone null
foreignsource varchar(64) null
foreignid varchar(64) null
Primary Key Columns
pk_nodeid nodeid
Index Type Columns
node_foreign_unique_idx Unique foreignsource, foreignid
node_dpname_idx dpname
node_id_type_idx nodeid, nodetype
node_label_idx nodelabel
Foreign Key Column Referenced Column
distpoller (public) dpname dpname
Detail Table Column Referencing Column
atinterface (public) nodeid nodeid
stpnode (public) nodeid nodeid
stpinterface (public) nodeid nodeid
iprouteinterface (public) nodeid nodeid
datalinkinterface (public) nodeid nodeid
datalinkinterface (public) nodeid nodeparentid
inventory (public) nodeid nodeid
vlan (public) nodeid nodeid
ipinterface (public) nodeid nodeid
snmpinterface (public) nodeid nodeid
ifservices (public) nodeid nodeid
outages (public) nodeid nodeid
assets (public) nodeid nodeid
notifications (public) nodeid nodeid
pathoutage (public) nodeid nodeid
category_node (public) nodeid nodeid
notifications (public)
Column Data Type Nullable Default Description
textmsg varchar(4000) not null
subject varchar(256) null
numericmsg varchar(256) null
notifyid integer not null
pagetime timestamp with time zone null
respondtime timestamp with time zone null
answeredby varchar(256) null
nodeid integer null
interfaceid varchar(16) null
serviceid integer null
queueid varchar(256) null
eventid integer null
eventuei varchar(256) not null
notifconfigname varchar(63) null
Primary Key Columns
pk_notifyid notifyid
Index Type Columns
notifications_nodeid_idx nodeid
notifications_serviceid_idx serviceid
notifications_answeredby_idx answeredby
notifications_eventid_idx eventid
notifications_eventuei_idx eventuei
notifications_ipaddr_idx interfaceid
notifications_respondtime_idx respondtime
Foreign Key Column Referenced Column
events (public) eventid eventid
node (public) nodeid nodeid
Detail Table Column Referencing Column
usersnotified (public) notifyid notifyid
outages (public)
Column Data Type Nullable Default Description
outageid integer not null
svclosteventid integer null
svcregainedeventid integer null
nodeid integer not null
ipaddr varchar(16) not null
serviceid integer not null
iflostservice timestamp with time zone not null
ifregainedservice timestamp with time zone null
suppresstime timestamp with time zone null
suppressedby varchar(256) null
ifserviceid integer not null
Primary Key Columns
pk_outageid outageid
Index Type Columns
outages_ifservivceid_idx ifserviceid
outages_svcregainedid_idx svcregainedeventid
outages_svclostid_idx svclosteventid
outages_serviceid_idx serviceid
outages_regainedservice_idx ifregainedservice
outages_nodeid_ipaddr_svc_idx nodeid, ipaddr, serviceid
outages_nodeid_idx nodeid
outages_ipaddr_idx ipaddr
Foreign Key Column Referenced Column
events (public) svclosteventid eventid
events (public) svcregainedeventid eventid
node (public) nodeid nodeid
service (public) serviceid serviceid
ifservices (public) nodeid nodeid
ifservices (public) ifserviceid id
Triggers Type Function
setifservicekeysoninserttrigger ROW BEFORE INSERT setifservicekeysoninsert
setifservicekeysonupdatetrigger ROW BEFORE UPDATE setifservicekeysonupdate
pathoutage (public)
Column Data Type Nullable Default Description
nodeid integer null
criticalpathip varchar(16) not null
criticalpathservicename varchar(32) null
Index Type Columns
pathoutage_nodeid Unique nodeid
pathoutage_criticalpathip criticalpathip
pathoutage_criticalpathservicename_idx criticalpathservicename
Foreign Key Column Referenced Column
node (public) nodeid nodeid
pollresults (public)
Column Data Type Nullable Default Description
id integer not null
pollid integer null
nodeid integer null
ipaddr varchar(16) null
ifindex integer null
serviceid integer null
statuscode integer null
statusname varchar(32) null
reason varchar(128) null
Primary Key Columns
pollresult_pkey id
Index Type Columns
pollresults_service nodeid, ipaddr, ifindex, serviceid
pollresults_poll_id pollid
Foreign Key Column Referenced Column
demandpolls (public) pollid id
qrtz_blob_triggers (public)
Column Data Type Nullable Default Description
trigger_name varchar(80) not null
trigger_group varchar(80) not null
blob_data bytea null
Primary Key Columns
pk_qrtz_blob_triggers trigger_name, trigger_group
Foreign Key Column Referenced Column
qrtz_triggers (public) trigger_name trigger_name
qrtz_calendars (public)
Column Data Type Nullable Default Description
calendar_name varchar(80) not null
calendar bytea not null
Primary Key Columns
pk_qrtz_calendars calendar_name
qrtz_cron_triggers (public)
Column Data Type Nullable Default Description
trigger_name varchar(80) not null
trigger_group varchar(80) not null
cron_expression varchar(80) not null
time_zone_id varchar(80) null
Primary Key Columns
pk_qrtz_cron_triggers trigger_name, trigger_group
Foreign Key Column Referenced Column
qrtz_triggers (public) trigger_name trigger_name
qrtz_fired_triggers (public)
Column Data Type Nullable Default Description
entry_id varchar(95) not null
trigger_name varchar(80) not null
trigger_group varchar(80) not null
is_volatile boolean not null
instance_name varchar(80) not null
fired_time bigint not null
state varchar(16) not null
job_name varchar(80) null
job_group varchar(80) null
is_stateful boolean null
requests_recovery boolean null
Primary Key Columns
pk_qrtz_fired_triggers entry_id
qrtz_job_details (public)
Column Data Type Nullable Default Description
job_name varchar(80) not null
job_group varchar(80) not null
description varchar(120) null
job_class_name varchar(128) not null
is_durable boolean not null
is_volatile boolean not null
is_stateful boolean not null
requests_recovery boolean not null
job_data bytea not null
Primary Key Columns
qrtz_job_details_pkey job_name, job_group
Detail Table Column Referencing Column
qrtz_job_listeners (public) job_name job_name
qrtz_job_listeners (public) job_name job_name
qrtz_triggers (public) job_name job_name
qrtz_triggers (public) job_name job_name
qrtz_job_listeners (public)
Column Data Type Nullable Default Description
job_name varchar(80) not null
job_group varchar(80) not null
job_listener varchar(80) not null
Primary Key Columns
pk_qrtz_job_listeners job_name, job_group, job_listener
Foreign Key Column Referenced Column
qrtz_job_details (public) job_name job_name
qrtz_locks (public)
Column Data Type Nullable Default Description
lock_name varchar(40) not null
Primary Key Columns
pk_qrtz_locks lock_name
qrtz_paused_trigger_grps (public)
Column Data Type Nullable Default Description
trigger_group varchar(80) not null
Primary Key Columns
pk_qrtz_paused_trigger_grps trigger_group
qrtz_scheduler_state (public)
Column Data Type Nullable Default Description
instance_name varchar(80) not null
last_checkin_time bigint not null
checkin_interval bigint not null
recoverer varchar(80) null
Primary Key Columns
pk_qrtz_scheduler_state instance_name
qrtz_simple_triggers (public)
Column Data Type Nullable Default Description
trigger_name varchar(80) not null
trigger_group varchar(80) not null
repeat_count bigint not null
repeat_interval bigint not null
times_triggered bigint not null
Primary Key Columns
pk_qrtz_simple_triggers trigger_name, trigger_group
Foreign Key Column Referenced Column
qrtz_triggers (public) trigger_name trigger_name
qrtz_trigger_listeners (public)
Column Data Type Nullable Default Description
trigger_name varchar(80) not null
trigger_group varchar(80) not null
trigger_listener varchar(80) not null
Primary Key Columns
pk_qrtz_trigger_listeners trigger_name, trigger_group, trigger_listener
Foreign Key Column Referenced Column
qrtz_triggers (public) trigger_name trigger_name
qrtz_triggers (public)
Column Data Type Nullable Default Description
trigger_name varchar(80) not null
trigger_group varchar(80) not null
job_name varchar(80) not null
job_group varchar(80) not null
is_volatile boolean not null
description varchar(120) null
next_fire_time bigint null
prev_fire_time bigint null
trigger_state varchar(16) not null
trigger_type varchar(8) not null
start_time bigint not null
end_time bigint null
calendar_name varchar(80) null
misfire_instr smallint null
job_data bytea null
Primary Key Columns
pk_qrtz_triggers trigger_name, trigger_group
Foreign Key Column Referenced Column
qrtz_job_details (public) job_name job_name
Detail Table Column Referencing Column
qrtz_blob_triggers (public) trigger_name trigger_name
qrtz_blob_triggers (public) trigger_name trigger_name
qrtz_cron_triggers (public) trigger_name trigger_name
qrtz_cron_triggers (public) trigger_name trigger_name
qrtz_simple_triggers (public) trigger_name trigger_name
qrtz_simple_triggers (public) trigger_name trigger_name
qrtz_trigger_listeners (public) trigger_name trigger_name
qrtz_trigger_listeners (public) trigger_name trigger_name
reportlocator (public)
Column Data Type Nullable Default Description
reportid integer not null
reportcategory varchar(256) not null
reportdate timestamp with time zone not null
reportformat varchar(256) not null
reporttype varchar(256) not null
reportlocation varchar(256) not null
reportavailable boolean not null
resourcereference (public)
Column Data Type Nullable Default Description
id integer not null nextval('opennmsnxtid'::regclass)
resourceid varchar(255) not null
Primary Key Columns
pk_resourcereference_id id
Index Type Columns
resourcereference_resourceid Unique resourceid
Detail Table Column Referencing Column
statisticsreportdata (public) id resourceid
servermap (public)
Column Data Type Nullable Default Description
ipaddr varchar(16) not null
servername varchar(64) not null
Index Type Columns
server_name_idx servername
service (public)
Column Data Type Nullable Default Description
serviceid integer not null
servicename varchar(32) not null
Primary Key Columns
pk_serviceid serviceid
Detail Table Column Referencing Column
ifservices (public) serviceid serviceid
outages (public) serviceid serviceid
servicemap (public)
Column Data Type Nullable Default Description
ipaddr varchar(16) not null
servicemapname varchar(32) not null
Index Type Columns
servicemap_name_idx servicemapname
servicemap_ipaddr_idx ipaddr
snmpinterface (public)
Column Data Type Nullable Default Description
id integer not null nextval('opennmsnxtid'::regclass)
nodeid integer not null
ipaddr varchar(16) not null
snmpipadentnetmask varchar(16) null
snmpphysaddr char(12) null
snmpifindex integer not null
snmpifdescr varchar(256) null
snmpiftype integer null
snmpifname varchar(96) null
snmpifspeed bigint null
snmpifadminstatus integer null
snmpifoperstatus integer null
snmpifalias varchar(256) null
Primary Key Columns
snmpinterface_pkey id
Index Type Columns
snmpinterface_nodeid_ifindex_unique_idx Unique nodeid, snmpifindex
snmpinterface_ipaddr_idx ipaddr
snmpinterface_nodeid_idx nodeid
Foreign Key Column Referenced Column
node (public) nodeid nodeid
Detail Table Column Referencing Column
ipinterface (public) id snmpinterfaceid
statisticsreport (public)
Column Data Type Nullable Default Description
id integer not null nextval('opennmsnxtid'::regclass)
startdate timestamp with time zone not null
enddate timestamp with time zone not null
name varchar(63) not null
description varchar(255) not null
jobstarteddate timestamp with time zone not null
jobcompleteddate timestamp with time zone not null
purgedate timestamp with time zone not null
Primary Key Columns
pk_statisticsreport_id id
Index Type Columns
statisticsreport_name name
statisticsreport_startdate startdate
statisticsreport_purgedate purgedate
Detail Table Column Referencing Column
statisticsreportdata (public) id reportid
statisticsreportdata (public)
Column Data Type Nullable Default Description
id integer not null nextval('opennmsnxtid'::regclass)
reportid integer not null
resourceid integer not null
value double precision not null
Primary Key Columns
pk_statsdata_id id
Index Type Columns
statsdata_unique Unique reportid, resourceid
Foreign Key Column Referenced Column
statisticsreport (public) reportid id
resourcereference (public) resourceid id
stpinterface (public)
Column Data Type Nullable Default Description
nodeid integer not null
bridgeport integer not null
ifindex integer not null
stpportstate integer null
stpportpathcost integer null
stpportdesignatedroot varchar(16) null
stpportdesignatedcost integer null
stpportdesignatedbridge varchar(16) null
stpportdesignatedport varchar(4) null
status char(1) not null
lastpolltime timestamp without time zone not null
stpvlan integer not null
Primary Key Columns
pk_stpinterface nodeid, bridgeport, stpvlan
Index Type Columns
stpinterface_node_idx nodeid
stpinterface_node_ifindex_idx nodeid, ifindex
stpinterface_stpdesbridge_idx stpportdesignatedbridge
stpinterface_stpvlan_idx stpvlan
Foreign Key Column Referenced Column
node (public) nodeid nodeid
stpnode (public)
Column Data Type Nullable Default Description
nodeid integer not null
basebridgeaddress varchar(12) not null
basenumports integer null
basetype integer null
stpprotocolspecification integer null
stppriority integer null
stpdesignatedroot varchar(16) null
stprootcost integer null
stprootport integer null
status char(1) not null
lastpolltime timestamp without time zone not null
basevlan integer not null
basevlanname varchar(32) null
Primary Key Columns
pk_stpnode nodeid, basevlan
Index Type Columns
stpnode_basebridgeaddress_idx basebridgeaddress
stpnode_nodeid_idx nodeid
stpnode_stpdesignatedroot_idx stpdesignatedroot
Foreign Key Column Referenced Column
node (public) nodeid nodeid
testdatatypes (public)
autoinc
Column Data Type Nullable Default Description
id integer not null nextval('testdatatypes_id_seq'::regclass) autoinc
num52 numeric(5, 2) null
num63 numeric(6, 3) null
num84 numeric(8, 4) null
realvalue real null
dec52 numeric(5, 2) null
dec63 numeric(6, 3) null
dec84 numeric(8, 4) null
usersnotified (public)
Column Data Type Nullable Default Description
id integer not null
userid varchar(256) not null
notifyid integer null
notifytime timestamp with time zone null
media varchar(32) null
contactinfo varchar(64) null
autonotify char(1) null
Primary Key Columns
pk_usernotificationid id
Index Type Columns
userid_notifyid_idx userid, notifyid
Foreign Key Column Referenced Column
notifications (public) notifyid notifyid
vlan (public)
Column Data Type Nullable Default Description
nodeid integer not null
vlanid integer not null
vlanname varchar(64) not null
vlantype integer null
vlanstatus integer null
status char(1) not null
lastpolltime timestamp without time zone not null
Primary Key Columns
pk_vlan nodeid, vlanid
Index Type Columns
vlan_vlanname_idx vlanname
Foreign Key Column Referenced Column
node (public) nodeid nodeid
vulnerabilities (public)
Column Data Type Nullable Default Description
vulnerabilityid integer not null
nodeid integer null
ipaddr varchar(16) null
serviceid integer null
creationtime timestamp with time zone not null
lastattempttime timestamp with time zone not null
lastscantime timestamp with time zone not null
resolvedtime timestamp with time zone null
severity integer not null
pluginid integer not null
pluginsubid integer not null
logmsg varchar(256) null
descr text null
port integer null
protocol varchar(32) null
cveentry varchar(255) null
Primary Key Columns
pk_vulnerabilityid vulnerabilityid
Index Type Columns
vulnerabilities_ipaddr_idx ipaddr
vulnerabilities_nodeid_idx nodeid
vulnerabilities_port_idx port
vulnerabilities_severity_idx severity
vulnerabilities_protocol_idx protocol
vulnplugins (public)
Column Data Type Nullable Default Description
pluginid integer not null
pluginsubid integer not null
name varchar(128) null
category varchar(32) null
copyright varchar(128) null
descr text null
summary varchar(256) null
family varchar(32) null
version varchar(32) null
cveentry varchar(255) null
md5 varchar(32) null
Index Type Columns
vulnplugins_plugin_idx Unique pluginid, pluginsubid
Functions
getmanagedoutageforintfinwindow (public)
CREATE OR REPLACE FUNCTION public.getmanagedoutageforintfinwindow(integer, character varying, timestamp without time zone, timestamp without time zone)
 RETURNS double precision
 LANGUAGE plpgsql
AS $function$
   DECLARE
	nid ALIAS FOR $1;
	ipid ALIAS FOR $2;
	xtime ALIAS FOR $3;
	ytime ALIAS FOR $4;
	downtime float8 := 0.0;
	orec RECORD;
   BEGIN
	FOR orec IN SELECT distinct ifservices.nodeid, ifservices.ipaddr, ifservices.serviceid FROM ipinterface, ifservices where ifservices.nodeid = nid AND ifservices.ipaddr = ipid AND ipinterface.nodeid = nid AND ipinterface.ipaddr = ipid AND ipinterface.ismanaged = 'M' AND ifservices.status = 'A'
	LOOP
		BEGIN
			downtime := downtime + getOutageTimeInWindow( orec.nodeid, orec.ipaddr, orec.serviceid, xtime, ytime);
		END;
	END LOOP;
	RETURN downtime;
   END;
$function$
getmanagedoutagefornodeinwindow (public)
CREATE OR REPLACE FUNCTION public.getmanagedoutagefornodeinwindow(integer, timestamp without time zone, timestamp without time zone)
 RETURNS double precision
 LANGUAGE plpgsql
AS $function$
   DECLARE
	nid ALIAS FOR $1;
	xtime ALIAS FOR $2;
	ytime ALIAS FOR $3;
	downtime float8 := 0.0;
	orec RECORD;
   BEGIN
	FOR orec IN SELECT distinct ifservices.nodeid, ifservices.ipaddr, ifservices.serviceid FROM ipinterface, ifservices, node where ifservices.nodeid = nid AND ipinterface.nodeid = nid AND ipinterface.ismanaged = 'M' AND ifservices.ipaddr = ipinterface.ipaddr AND ifservices.status = 'A' AND node.nodeid = nid and node.nodetype = 'A'
	LOOP
		BEGIN
			downtime := downtime + getOutageTimeInWindow( orec.nodeid, orec.ipaddr, orec.serviceid, xtime, ytime);
		END;
	END LOOP;
	RETURN downtime;
   END;
$function$
getmanagedservicecountforintf (public)
CREATE OR REPLACE FUNCTION public.getmanagedservicecountforintf(integer, character varying)
 RETURNS double precision
 LANGUAGE plpgsql
AS $function$
   DECLARE
	nid ALIAS FOR $1;
	ipid ALIAS FOR $2;
	orec RECORD;
	counter float8;
   BEGIN
	counter = 0;
	FOR orec IN SELECT DISTINCT ifservices.nodeid, ifservices.ipaddr, ifservices.serviceid 
		FROM ipinterface, ifservices 
		WHERE ifservices.nodeid = nid 
			AND ifservices.ipaddr = ipid 
			AND ipinterface.nodeid = nid 
			AND ipinterface.ipaddr = ipid 
			AND ipinterface.ismanaged = 'M' 
			AND ifservices.status = 'A'
	LOOP
		BEGIN
			counter := counter + 1;
		END;
	END LOOP;
	RETURN counter;
   END;
$function$
getmanagedservicecountfornode (public)
CREATE OR REPLACE FUNCTION public.getmanagedservicecountfornode(integer)
 RETURNS double precision
 LANGUAGE plpgsql
AS $function$
   DECLARE
        nid ALIAS FOR $1;
        orec RECORD;
        counter float8;
   BEGIN
        counter = 0;
         FOR orec IN SELECT distinct ifservices.nodeid, ifservices.serviceid, ifservices.ipaddr
                FROM ipinterface, ifservices
                WHERE ifservices.nodeid = nid
                        AND ipinterface.nodeid = nid
                        AND ipinterface.ismanaged = 'M'
                        AND ifservices.ipaddr = ipinterface.ipaddr
                        AND ifservices.status = 'A'
        LOOP
                BEGIN
                         counter := counter + 1;
                END;
        END LOOP;
        RETURN counter;
   END;
$function$
getmanagepercentavailintfwindow (public)
CREATE OR REPLACE FUNCTION public.getmanagepercentavailintfwindow(integer, character varying, timestamp without time zone, timestamp without time zone)
 RETURNS double precision
 LANGUAGE plpgsql
AS $function$
   DECLARE
	nid ALIAS FOR $1;
	ipid ALIAS FOR $2;
	xtime ALIAS FOR $3;
	ytime ALIAS FOR $4;
	downtime float8 := 0.0;
	count integer := 0;
	rollingWindow float := 0;
	totalServiceTime float := 0;
   BEGIN
	IF xtime < ytime THEN
		rollingWindow := EXTRACT (EPOCH FROM (ytime - xtime));
		downtime := getManagedOutageForIntfInWindow(nid, ipid, ytime, xtime)/1000;
	ELSE
		rollingWindow := EXTRACT (EPOCH FROM (xtime - ytime));
		downtime := getManagedOutageForIntfInWindow(nid, ipid, xtime, ytime)/1000;
	END IF;
	count := getManagedServiceCountForIntf(nid, ipid);
	totalServiceTime := count * rollingWindow;

	IF totalServiceTime > 0 THEN
		RETURN	100 * (1 - (downtime / totalServiceTime));
	ELSE
                IF totalServiceTime = 0 THEN
                        RETURN 100;
                ELSE
                        RETURN -1;
                END IF;
	END IF;    
   END;
$function$
getmanagepercentavailnodewindow (public)
CREATE OR REPLACE FUNCTION public.getmanagepercentavailnodewindow(integer, timestamp without time zone, timestamp without time zone)
 RETURNS double precision
 LANGUAGE plpgsql
AS $function$
   DECLARE
	nid ALIAS FOR $1;
	xtime ALIAS FOR $2;
	ytime ALIAS FOR $3;
	downtime float8 := 0.0;
	count integer := 0;
	rollingWindow float := 0;
	totalServiceTime float := 0;
   BEGIN
	IF xtime < ytime THEN
		rollingWindow := EXTRACT (EPOCH FROM (ytime - xtime));
		downtime := getManagedOutageForNodeInWindow(nid, ytime, xtime)/1000;
	ELSE
		rollingWindow := EXTRACT (EPOCH FROM (xtime - ytime));
		downtime := getManagedOutageForNodeInWindow(nid, xtime, ytime)/1000;
	END IF;
	count := getManagedServiceCountForNode(nid);
	totalServiceTime := count * rollingWindow;

	IF totalServiceTime > 0 THEN
		RETURN 100 * (1 - (downtime / totalServiceTime));
	ELSE
		IF totalServiceTime = 0 THEN
                        RETURN 100;
                ELSE
                        RETURN -1;
                END IF;
	END IF;
   END;
$function$
getoutagetimeinwindow (public)
CREATE OR REPLACE FUNCTION public.getoutagetimeinwindow(integer, character varying, integer, timestamp without time zone, timestamp without time zone)
 RETURNS double precision
 LANGUAGE plpgsql
AS $function$
   DECLARE
	nid ALIAS FOR $1;
	ipid ALIAS FOR $2;
	sid ALIAS FOR $3;
	xtime ALIAS FOR $4;
	ytime ALIAS FOR $5;
	orec RECORD;
	lostTime timestamp without time zone;
	gainTime timestamp without time zone;
	downtime float8;
	zero CONSTANT float8 := 0.0;
	epochTime CONSTANT timestamp without time zone := to_timestamp('01 Jan 1970 00:00:00', 'DD Mon YYYY HH24:MI:SS');
   BEGIN
   	downtime = zero;
   	FOR orec IN SELECT ifLostService,ifRegainedService
		FROM outages WHERE (nodeID = nid AND ipAddr = ipid AND serviceID = sid AND
		                   ((ifRegainedService IS NULL AND ifLostService <= xtime)  OR
				    (ifRegainedService > ytime)))
	LOOP
	 BEGIN
		gainTime := epochTime;
		lostTime := orec.ifLostService;
		IF orec.ifRegainedService IS NOT NULL THEN
			gainTime := orec.ifRegainedService;
		END IF;
		--
		-- Find the appropriate records
		--
		IF xtime > lostTime THEN
		 --
		 -- for any outage to be in window of 
		 -- opportunity the lost time must ALWAYS be
		 -- less that the x time.
		 --
		 IF gainTime = epochTime THEN
		  --
		  -- if the gain time is epochTime then the outage
		  -- does not have an uptime.
		  --
		   IF ytime > lostTime THEN
		    downtime := downtime + EXTRACT(EPOCH FROM (xtime - ytime));
		   ELSE
		    downtime := downtime + EXTRACT(EPOCH FROM (xtime - lostTime));
		   END IF;
		 ELSE
		  IF xtime > gainTime AND gainTime > ytime THEN
		   --
		   -- regain time between x & y
		   --
		    IF ytime > lostTime THEN
		     downtime := downtime + EXTRACT (EPOCH FROM (gainTime - ytime));
		    ELSE
		     downtime := downtime + EXTRACT (EPOCH FROM (gainTime - lostTime));
		    END IF; 
		  ELSE
		   IF gainTime > xtime THEN
		   --
		   -- regain time greater than x, lost less that x
		   --
		    IF ytime > lostTime THEN
		     downtime := downtime + EXTRACT (EPOCH FROM (xtime - ytime));
		    ELSE
		     downtime := downtime + EXTRACT (EPOCH FROM (xtime - lostTime));
		    END IF;
		   -- end gainTime > xtime
		   END IF;
		  -- end xtime > gainTime AND gainTime > ytime
		  END IF;
		 -- end gaintime == epochTime
		 END IF;
		-- end xtime > lostTime
		END IF;
	 END;
	END LOOP;
	RETURN downtime*1000.0;
   END;
$function$
getpercentavailabilityinwindow (public)
CREATE OR REPLACE FUNCTION public.getpercentavailabilityinwindow(integer, character varying, integer, timestamp without time zone, timestamp without time zone)
 RETURNS double precision
 LANGUAGE plpgsql
AS $function$
   DECLARE
	nid ALIAS FOR $1;
	ipid ALIAS FOR $2;
	sid ALIAS FOR $3;
	xtime ALIAS FOR $4;
	ytime ALIAS FOR $5;
	downtime float8;
   BEGIN
	downtime := getOutageTimeInWindow(nid, ipid, sid, xtime, ytime);
	IF xtime > ytime THEN
		RETURN 100 * (1 - (downtime / (EXTRACT(EPOCH FROM (xtime - ytime))* 1000)));
	ELSE
		RETURN 100 * (1 - (downtime / (EXTRACT(EPOCH FROM (ytime - xtime))* 1000)));
	END IF;
   END;
$function$
Trigger Functions
setifservicekeysoninsert (public)
CREATE OR REPLACE FUNCTION public.setifservicekeysoninsert()
 RETURNS trigger
 LANGUAGE plpgsql
AS $function$
BEGIN

  --
  -- (Used with Trigger Insert with old style foreign key)
  -- This condition keeps the ifServiceID inSync with the composite foreign key of nodeid, ipaddr, serviceid
  -- This usually happens when a new record is written by our JDBC code (non-Hibernate DAO) for the old JDBC style
  -- code has no knowledge of the new keys
  --
  IF NEW.ifServiceId IS NULL 
  THEN
     SELECT ifsvc.id INTO NEW.ifserviceid
       FROM ifservices ifsvc
       WHERE (ifsvc.nodeid = NEW.nodeid AND ifsvc.ipAddr = NEW.ipAddr AND ifsvc.serviceid = NEW.serviceid);
       
     IF NOT FOUND 
     THEN
        RAISE EXCEPTION 'Outages Trigger Exception, Condition 1: No service found for... nodeid: %  ipaddr: %  serviceid: %', NEW.nodeid, NEW.ipAddr, NEW.serviceid;
     END IF;
  
  --
  -- (Used with Trigger Insert with new style foreign key)
  -- This condition keeps the composite foreign key of nodeid, ipaddr, serviceid inSync with the ifserviceid
  -- This usually happens when a new record is written by our Hibernate DAOs... these DAOs have no knowledge of
  -- the composite key columns
  --
  ELSIF NEW.ifServiceId IS NOT NULL AND (NEW.nodeId IS NULL OR NEW.ipAddr IS NULL OR NEW.serviceId IS NULL)
  THEN
     SELECT ifsvc.nodeId, ifsvc.ipAddr, ifsvc.serviceId INTO NEW.nodeId, NEW.ipAddr, NEW.serviceId
       FROM ifservices ifsvc
      WHERE (ifsvc.id = NEW.ifServiceId);
      
      IF NOT FOUND THEN
         RAISE EXCEPTION 'Outages Trigger Exception, Condition 2: No service found for serviceID: %', NEW.ifServiceId;
      END IF;

  END IF;
  
  RETURN NEW;
END;
$function$
setifservicekeysonupdate (public)
CREATE OR REPLACE FUNCTION public.setifservicekeysonupdate()
 RETURNS trigger
 LANGUAGE plpgsql
AS $function$
BEGIN

  --
  -- (Update with old style foreign key)
  -- This condition keeps ifserviceid inSync with the composite foreign key of nodeid, ipaddr, serviceid
  -- This usually happens when a record is being updated by old JDBC code (non-Hibernate DAOs) and has changed
  -- one or more of the composite key values, the ifServiceId needs to be updated
  --
  IF (NEW.ifserviceID = OLD.ifServiceId) AND (NEW.nodeId != OLD.nodeId OR NEW.ipAddr != OLD.ipAddr OR NEW.serviceId != OLD.serviceID) 
  THEN
     SELECT ifsvc.id INTO NEW.ifserviceid
       FROM ifservices ifsvc
       WHERE (ifsvc.nodeid = NEW.nodeid AND ifsvc.ipAddr = NEW.ipAddr AND ifsvc.serviceid = NEW.serviceid);
       
     IF NOT FOUND THEN
        RAISE EXCEPTION 'Outages Trigger Exception, Condition 3: No service found for... nodeid: %  ipaddr: %  serviceid: %', NEW.nodeid, NEW.ipAddr, NEW.serviceid;
     END IF;
  --
  -- (Update with new style foreign key)
  -- This condition keeps the composite foreign key of nodeid, ipaddr, serviceid inSync with the ifserviceid
  -- This usually happens with the Hibernate DAOs decide to change the ifserviceid (MonitoredService) represented
  -- by the outage.
  --
  ELSIF NEW.ifServiceId != OLD.ifServiceId
  THEN
     SELECT ifsvc.nodeId, ifsvc.ipAddr, ifsvc.serviceId INTO NEW.nodeId, NEW.ipAddr, NEW.serviceId
       FROM ifservices ifsvc
      WHERE (ifsvc.id = NEW.ifServiceId);
      
      IF NOT FOUND THEN
         RAISE EXCEPTION 'Outages Trigger Exception, Condition 4: No service found for serviceID: %', NEW.ifServiceId;
      END IF;
  END IF;

  RETURN NEW;
END;
$function$
setipinterfacekeysoninsert (public)
CREATE OR REPLACE FUNCTION public.setipinterfacekeysoninsert()
 RETURNS trigger
 LANGUAGE plpgsql
AS $function$
BEGIN

  -- ifServices must have an IP address that is *not* 0.0.0.0
  IF NEW.ipAddr IS NOT NULL AND NEW.ipAddr = '0.0.0.0'
  THEN
    RAISE EXCEPTION 'IfServices Trigger Exception, Condition 0: ipAddr of 0.0.0.0 is not allowed in ifServices table';
  END IF;
  
  --
  -- (Insert with old style foreign key)
  -- This condition keeps the ipInterfaceId inSync with the composite foreign key of nodeid, ipaddr, ifindex
  -- This usually happens when a new record is written by our JDBC code (non-Hibernate DAO) for the old JDBC style
  -- code has no knowledge of the new keys
  --
  IF NEW.ipInterfaceId IS NULL 
  THEN
     SELECT ipif.id INTO NEW.ipInterfaceId
       FROM ipinterface ipif
       WHERE (ipif.nodeid = NEW.nodeid AND ipif.ipAddr = NEW.ipAddr AND ipif.ipAddr != '0.0.0.0');
       
       IF NOT FOUND 
       THEN
          RAISE EXCEPTION 'IfServices Trigger Exception, Condition 1: No IpInterface found for... nodeid: %  ipaddr: %', NEW.nodeid, NEW.ipAddr;
       END IF;
       
  --
  -- (Insert with new style foreign key)
  -- This condition keeps the composite foreign key of nodeid, ipaddr, ifindex inSync with the ipInterfaceId
  -- This usually happens when a new record is written by our Hibernate DAOs... these DAOs have no knowledge of
  -- the composite key columns
  --

  ELSIF NEW.ipInterfaceId IS NOT NULL AND (NEW.nodeId IS NULL OR NEW.ipAddr IS NULL)
  THEN
     SELECT ipif.nodeid, ipif.ipAddr, ipif.ifIndex INTO NEW.nodeid, NEW.ipAddr, NEW.ifIndex
       FROM ipinterface ipif
      WHERE (ipif.id = NEW.ipInterfaceId);
      
      IF NOT FOUND
      THEN
         RAISE EXCEPTION 'IfServices Trigger Exception: No ipinterface found for ipInterfaceId: %', NEW.ipInterfaceId;
      END IF;
      
      IF NEW.ipAddr = '0.0.0.0'
      THEN
         RAISE EXCEPTION 'IfServices Trigger Exception, Condition 5: IpInterface found for ipInterfaceId: % has 0.0.0.0 ipAddr', NEW.ipInterfaceId;
      END IF;
  END IF;
  RETURN NEW;
END;
$function$
setipinterfacekeysonupdate (public)
CREATE OR REPLACE FUNCTION public.setipinterfacekeysonupdate()
 RETURNS trigger
 LANGUAGE plpgsql
AS $function$
BEGIN

  -- ifServices must have an IP address that is *not* 0.0.0.0
  IF NEW.ipAddr IS NOT NULL AND NEW.ipAddr = '0.0.0.0'
  THEN
    RAISE EXCEPTION 'IfServices Trigger Exception, Condition 0: ipAddr of 0.0.0.0 is not allowed in ifServices table';
  END IF;

  --
  -- (Used with Trigger Update with old style foreign key)
  -- This condition keeps ipinterfaceid inSync with the composite foreign key of nodeid, ipaddr, ifindex
  -- This usually happens when a record is being updated by old JDBC code (non-Hibernate DAOs) and has changed
  -- one or more of the composite key values, the ipInterfaceId needs to be updated
  --
  IF (NEW.ipInterfaceId = OLD.ipInterfaceId) AND (NEW.nodeId != OLD.nodeId OR NEW.ipAddr != OLD.ipAddr) 
  THEN
     SELECT ipif.id INTO NEW.ipInterfaceId
       FROM ipinterface ipif
       WHERE (ipif.nodeid = NEW.nodeid AND ipif.ipAddr = NEW.ipAddr AND ipif.ipAddr != '0.0.0.0');
       
     IF NOT FOUND THEN
        RAISE EXCEPTION 'IfServices Trigger Exception, Condition 3: No IpInterface found for... nodeid: %  ipaddr: % ', NEW.nodeid, NEW.ipAddr;
     END IF;
     
  --
  -- (Used with Trigger Update with new style foreign key)
  -- This condition keeps the composite foreign key of nodeid, ipaddr, ifindex inSync with the ipinterfaceid
  -- This usually happens with the Hibernate DAOs decide to change the ipinterfaceid represented
  -- by the ifservices.
  --
  ELSIF NEW.ipInterfaceId != OLD.ipInterfaceId
  THEN
     SELECT ipif.nodeId, ipif.ipAddr, ipif.ifIndex INTO NEW.nodeId, NEW.ipAddr, NEW.ifIndex
       FROM ipinterface ipif
      WHERE (ipif.id = NEW.ipInterfaceId);
      
      IF NOT FOUND THEN
         RAISE EXCEPTION 'IfServices Trigger Exception, Condition 4: No IpInterface found for ipInterfaceId: %', NEW.ipInterfaceId;
      END IF;
      
      IF NEW.ipAddr = '0.0.0.0'
      THEN
         RAISE EXCEPTION 'IfServices Trigger Exception, Condition 5: IpInterface found for ipInterfaceId: % has 0.0.0.0 ipAddr', NEW.ipInterfaceId;
      END IF;
  END IF;

  RETURN NEW;
END;
$function$
setsnmpinterfacekeysoninsert (public)
CREATE OR REPLACE FUNCTION public.setsnmpinterfacekeysoninsert()
 RETURNS trigger
 LANGUAGE plpgsql
AS $function$
BEGIN

  --
  -- (Used for Trigger insert with old style foreign key)
  -- This condition keeps the snmpInterfaceId inSync with the composite foreign key of nodeid, ipaddr, ifindex
  -- This usually happens when a new record is written by our JDBC code (non-Hibernate DAO) for the old JDBC style
  -- code has no knowledge of the new keys
  --
  IF NEW.snmpInterfaceId IS NULL 
  THEN
     IF NEW.ifIndex IS NOT NULL
     THEN
       SELECT snmpif.id INTO NEW.snmpInterfaceId
         FROM snmpinterface snmpif
         WHERE (snmpif.nodeid = NEW.nodeid AND snmpif.snmpIfIndex = NEW.ifIndex);
       
       IF NOT FOUND 
       THEN
         RAISE EXCEPTION 'IpInterface Trigger Notice, Condition 1: No SnmpInterface found for... nodeid: % ifindex: %', NEW.nodeid, NEW.ifIndex;
       END IF;
     END IF;
       
  --
  -- (Used for Insert with new style foreign key)
  -- This condition keeps the composite foreign key of nodeid, ipaddr, ifindex inSync with the SnmpInterfaceId
  -- This usually happens when a new record is written by our Hibernate DAOs... these DAOs have no knowledge of
  -- the composite key columns
  --

  ELSIF NEW.snmpInterfaceId IS NOT NULL AND (NEW.nodeId IS NULL OR NEW.ifIndex IS NULL)
  THEN
     SELECT snmpif.nodeid, snmpif.snmpIfIndex INTO NEW.nodeid, NEW.ifIndex
       FROM snmpinterface snmpif
      WHERE (snmpif.id = NEW.snmpInterfaceId);
      
      IF NOT FOUND
      THEN
         RAISE EXCEPTION 'IpInterface Trigger Notice: No SnmpInterface found for snmpInterfaceId: %', NEW.snmpInterfaceId;
      END IF;
  END IF;
  RETURN NEW;
END;
$function$
setsnmpinterfacekeysonupdate (public)
CREATE OR REPLACE FUNCTION public.setsnmpinterfacekeysonupdate()
 RETURNS trigger
 LANGUAGE plpgsql
AS $function$
BEGIN

  --
  -- (Used for Trigger update with old style foreign key)
  -- This condition keeps snmpinterfaceid inSync with the composite foreign key of nodeid, ipaddr, ifindex
  -- This usually happens when a record is being updated by old JDBC code (non-Hibernate DAOs) and has changed
  -- one or more of the composite key values, the snmpInterfaceId needs to be updated
  --
  IF ((NEW.snmpInterfaceId = OLD.snmpInterfaceId OR (NEW.snmpInterfaceId IS NULL AND OLD.snmpInterfaceId IS NULL)) AND 
      (NEW.nodeId != OLD.nodeId OR NEW.ifIndex != OLD.ifIndex OR (NEW.ifIndex IS NULL AND OLD.ifIndex IS NOT NULL) OR (NEW.ifIndex IS NOT NULL AND OLD.ifIndex IS NULL)))
  THEN
    IF NEW.ifIndex IS NULL AND NEW.snmpInterfaceId IS NOT NULL
    THEN
       SELECT NULL INTO NEW.snmpInterfaceId;
    ELSIF NEW.ifIndex IS NOT NULL
    THEN
     SELECT snmpif.id INTO NEW.snmpInterfaceId
       FROM snmpinterface snmpif
       WHERE (snmpif.nodeid = NEW.nodeid AND snmpif.snmpIfIndex = NEW.ifIndex);
       
     IF NOT FOUND THEN
       RAISE EXCEPTION 'IpInterface Trigger Notice, Condition 3: No SnmpInterface found for... nodeid: % ifindex: %', NEW.nodeid, NEW.ifIndex;
     END IF;
    END IF;
     
  --
  -- (Used for Trigger update with new style foreign key)
  -- This condition keeps the composite foreign key of nodeid, ipaddr, ifindex inSync with the snmpinterfaceid
  -- This usually happens with the Hibernate DAOs decide to change the snmpinterfaceid represented
  -- by the ipinterface.
  --
  -- We dont match on the case where NEW.snmpInterfaceId IS NULL, because we use it in the WHERE clause.
  --
  ELSIF (NEW.snmpInterfaceId != OLD.snmpInterfaceId OR (NEW.snmpInterfaceId IS NOT NULL AND OLD.snmpInterfaceId IS NULL))
  THEN
     SELECT snmpif.nodeId, snmpif.snmpIfIndex INTO NEW.nodeId, NEW.ifIndex
       FROM snmpinterface snmpif
      WHERE (snmpif.id = NEW.snmpInterfaceId);
      
      IF NOT FOUND THEN
         RAISE EXCEPTION 'IpInterface Trigger Notice, Condition 4: No SnmpInterface found for snmpInterfaceId: %', NEW.snmpInterfaceId;
      END IF;
  END IF;

  RETURN NEW;
END;
$function$
Sequences
alarmsnxtid (public)
CREATE SEQUENCE public.alarmsnxtid
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1 NO CYCLE
						
catnxtid (public)
CREATE SEQUENCE public.catnxtid
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1 NO CYCLE
						
demandpollnxtid (public)
CREATE SEQUENCE public.demandpollnxtid
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1 NO CYCLE
						
eventsnxtid (public)
CREATE SEQUENCE public.eventsnxtid
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1 NO CYCLE
						
mapnxtid (public)
CREATE SEQUENCE public.mapnxtid
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1 NO CYCLE
						
nodenxtid (public)
CREATE SEQUENCE public.nodenxtid
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1 NO CYCLE
						
notifynxtid (public)
CREATE SEQUENCE public.notifynxtid
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1 NO CYCLE
						
opennmsnxtid (public)
CREATE SEQUENCE public.opennmsnxtid
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1 NO CYCLE
						
outagenxtid (public)
CREATE SEQUENCE public.outagenxtid
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1 NO CYCLE
						
pollresultnxtid (public)
CREATE SEQUENCE public.pollresultnxtid
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1 NO CYCLE
						
reportnxtid (public)
CREATE SEQUENCE public.reportnxtid
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1 NO CYCLE
						
servicenxtid (public)
CREATE SEQUENCE public.servicenxtid
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1 NO CYCLE
						
testdatatypes_id_seq (public)
CREATE SEQUENCE public.testdatatypes_id_seq
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1 NO CYCLE
						
usernotifnxtid (public)
CREATE SEQUENCE public.usernotifnxtid
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1 NO CYCLE
						
vulnnxtid (public)
CREATE SEQUENCE public.vulnnxtid
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1 NO CYCLE
						

generated by dbscript