Changeset 152

Show
Ignore:
Timestamp:
04/15/08 02:15:37 (5 years ago)
Author:
divagater
Message:

Updated query samples with npc_ prefix for table names

Location:
trunk/queries
Files:
18 modified

Legend:

Unmodified
Added
Removed
  • trunk/queries/comment_history.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_commenthistory.object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_commenthistory.object_id 
    55,obj1.objecttype_id 
    66,obj1.name1 AS host_name 
    77,obj1.name2 AS service_description 
    8 ,nagios_commenthistory.* 
    9 FROM `nagios_commenthistory` 
    10 LEFT JOIN nagios_objects as obj1 ON nagios_commenthistory.object_id=obj1.object_id 
    11 LEFT JOIN nagios_instances ON nagios_commenthistory.instance_id=nagios_instances.instance_id 
     8,npc_commenthistory.* 
     9FROM `npc_commenthistory` 
     10LEFT JOIN npc_objects as obj1 ON npc_commenthistory.object_id=obj1.object_id 
     11LEFT JOIN npc_instances ON npc_commenthistory.instance_id=npc_instances.instance_id 
    1212ORDER BY entry_time DESC, entry_time_usec DESC, commenthistory_id DESC 
    1313 
  • trunk/queries/comments.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_comments.object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_comments.object_id 
    55,obj1.objecttype_id 
    66,obj1.name1 AS host_name 
    77,obj1.name2 AS service_description 
    8 ,nagios_comments.* 
    9 FROM `nagios_comments` 
    10 LEFT JOIN nagios_objects as obj1 ON nagios_comments.object_id=obj1.object_id 
    11 LEFT JOIN nagios_instances ON nagios_comments.instance_id=nagios_instances.instance_id 
     8,npc_comments.* 
     9FROM `npc_comments` 
     10LEFT JOIN npc_objects as obj1 ON npc_comments.object_id=obj1.object_id 
     11LEFT JOIN npc_instances ON npc_comments.instance_id=npc_instances.instance_id 
    1212ORDER BY entry_time DESC, entry_time_usec DESC, comment_id DESC 
    1313 
  • trunk/queries/contact_notification_methods.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_notifications.object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_notifications.object_id 
    55,obj1.objecttype_id 
    66,obj1.name1 AS host_name 
    77,obj1.name2 AS service_description 
    88,obj2.name1 AS contact_name 
    9 ,nagios_contactnotifications.start_time AS notification_start_time 
    10 ,nagios_contactnotifications.start_time_usec AS notification_start_time_usec 
    11 ,nagios_contactnotifications.end_time AS notification_end_time 
    12 ,nagios_contactnotifications.end_time_usec AS notification_end_time_usec 
     9,npc_contactnotifications.start_time AS notification_start_time 
     10,npc_contactnotifications.start_time_usec AS notification_start_time_usec 
     11,npc_contactnotifications.end_time AS notification_end_time 
     12,npc_contactnotifications.end_time_usec AS notification_end_time_usec 
    1313,obj3.name1 AS notification_command_name 
    14 ,nagios_contactnotificationmethods.* 
    15 FROM `nagios_contactnotificationmethods` 
    16 JOIN nagios_contactnotifications ON nagios_contactnotificationmethods.contactnotification_id=nagios_contactnotifications.contactnotification_id 
    17 JOIN nagios_notifications ON nagios_contactnotifications.notification_id=nagios_notifications.notification_id 
    18 LEFT JOIN nagios_objects as obj1 ON nagios_notifications.object_id=obj1.object_id 
    19 LEFT JOIN nagios_objects as obj2 ON nagios_contactnotifications.contact_object_id=obj2.object_id 
    20 LEFT JOIN nagios_objects as obj3 ON nagios_contactnotificationmethods.command_object_id=obj3.object_id 
    21 LEFT JOIN nagios_instances ON nagios_notifications.instance_id=nagios_instances.instance_id 
     14,npc_contactnotificationmethods.* 
     15FROM `npc_contactnotificationmethods` 
     16JOIN npc_contactnotifications ON npc_contactnotificationmethods.contactnotification_id=npc_contactnotifications.contactnotification_id 
     17JOIN npc_notifications ON npc_contactnotifications.notification_id=npc_notifications.notification_id 
     18LEFT JOIN npc_objects as obj1 ON npc_notifications.object_id=obj1.object_id 
     19LEFT JOIN npc_objects as obj2 ON npc_contactnotifications.contact_object_id=obj2.object_id 
     20LEFT JOIN npc_objects as obj3 ON npc_contactnotificationmethods.command_object_id=obj3.object_id 
     21LEFT JOIN npc_instances ON npc_notifications.instance_id=npc_instances.instance_id 
    2222ORDER BY start_time DESC, start_time_usec DESC 
    2323 
  • trunk/queries/contact_notifications.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_notifications.object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_notifications.object_id 
    55,obj1.objecttype_id 
    66,obj1.name1 AS host_name 
    77,obj1.name2 AS service_description 
    88,obj2.name1 AS contact_name 
    9 ,nagios_contactnotifications.* 
    10 FROM `nagios_contactnotifications` 
    11 JOIN nagios_notifications ON nagios_contactnotifications.notification_id=nagios_notifications.notification_id 
    12 LEFT JOIN nagios_objects as obj1 ON nagios_notifications.object_id=obj1.object_id 
    13 LEFT JOIN nagios_objects as obj2 ON nagios_contactnotifications.contact_object_id=obj2.object_id 
    14 LEFT JOIN nagios_instances ON nagios_notifications.instance_id=nagios_instances.instance_id 
     9,npc_contactnotifications.* 
     10FROM `npc_contactnotifications` 
     11JOIN npc_notifications ON npc_contactnotifications.notification_id=npc_notifications.notification_id 
     12LEFT JOIN npc_objects as obj1 ON npc_notifications.object_id=obj1.object_id 
     13LEFT JOIN npc_objects as obj2 ON npc_contactnotifications.contact_object_id=obj2.object_id 
     14LEFT JOIN npc_instances ON npc_notifications.instance_id=npc_instances.instance_id 
    1515ORDER BY start_time DESC, start_time_usec DESC 
    1616 
  • trunk/queries/contact_status.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_contacts.contact_object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_contacts.contact_object_id 
    55,obj1.name1 AS contact_name 
    6 ,nagios_contactstatus.* 
    7 FROM `nagios_contactstatus` 
    8 LEFT JOIN nagios_objects as obj1 ON nagios_contactstatus.contact_object_id=obj1.object_id 
    9 LEFT JOIN nagios_contacts ON nagios_contactstatus.contact_object_id=nagios_contacts.contact_object_id 
    10 LEFT JOIN nagios_instances ON nagios_contacts.instance_id=nagios_instances.instance_id 
    11 WHERE nagios_contacts.config_type='1' 
     6,npc_contactstatus.* 
     7FROM `npc_contactstatus` 
     8LEFT JOIN npc_objects as obj1 ON npc_contactstatus.contact_object_id=obj1.object_id 
     9LEFT JOIN npc_contacts ON npc_contactstatus.contact_object_id=npc_contacts.contact_object_id 
     10LEFT JOIN npc_instances ON npc_contacts.instance_id=npc_instances.instance_id 
     11WHERE npc_contacts.config_type='1' 
    1212ORDER BY instance_name ASC, contact_name ASC 
  • trunk/queries/contactgroup_membership.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_contactgroups.contactgroup_id 
    5 ,nagios_contactgroups.contactgroup_object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_contactgroups.contactgroup_id 
     5,npc_contactgroups.contactgroup_object_id 
    66,obj1.name1 AS contactgroup_name 
    7 ,nagios_contactgroups.alias AS contactgroup_alias 
    8 ,nagios_contacts.contact_object_id  
     7,npc_contactgroups.alias AS contactgroup_alias 
     8,npc_contacts.contact_object_id  
    99,obj2.name1 AS contact_name 
    10 FROM `nagios_contactgroups`  
    11 INNER JOIN nagios_contactgroup_members ON nagios_contactgroups.contactgroup_id=nagios_contactgroup_members.contactgroup_id  
    12 INNER JOIN nagios_contacts ON nagios_contactgroup_members.contact_object_id=nagios_contacts.contact_object_id 
    13 INNER JOIN nagios_objects as obj1 ON nagios_contactgroups.contactgroup_object_id=obj1.object_id 
    14 INNER JOIN nagios_objects as obj2 ON nagios_contactgroup_members.contact_object_id=obj2.object_id 
    15 INNER JOIN nagios_instances ON nagios_contactgroups.instance_id=nagios_instances.instance_id 
     10FROM `npc_contactgroups`  
     11INNER JOIN npc_contactgroup_members ON npc_contactgroups.contactgroup_id=npc_contactgroup_members.contactgroup_id  
     12INNER JOIN npc_contacts ON npc_contactgroup_members.contact_object_id=npc_contacts.contact_object_id 
     13INNER JOIN npc_objects as obj1 ON npc_contactgroups.contactgroup_object_id=obj1.object_id 
     14INNER JOIN npc_objects as obj2 ON npc_contactgroup_members.contact_object_id=obj2.object_id 
     15INNER JOIN npc_instances ON npc_contactgroups.instance_id=npc_instances.instance_id 
  • trunk/queries/contacts.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_contacts.contact_object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_contacts.contact_object_id 
    55,obj1.name1 AS contact_name 
    6 FROM `nagios_contacts` 
    7 LEFT JOIN nagios_objects as obj1 ON nagios_contacts.contact_object_id=obj1.object_id 
    8 LEFT JOIN nagios_instances ON nagios_contacts.instance_id=nagios_instances.instance_id 
    9 WHERE nagios_contacts.config_type='1' 
     6FROM `npc_contacts` 
     7LEFT JOIN npc_objects as obj1 ON npc_contacts.contact_object_id=obj1.object_id 
     8LEFT JOIN npc_instances ON npc_contacts.instance_id=npc_instances.instance_id 
     9WHERE npc_contacts.config_type='1' 
    1010ORDER BY instance_name ASC, contact_name ASC 
    1111 
  • trunk/queries/downtime_history.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_downtimehistory.object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_downtimehistory.object_id 
    55,obj1.objecttype_id 
    66,obj1.name1 AS host_name 
    77,obj1.name2 AS service_description 
    8 ,nagios_downtimehistory.* 
    9 FROM `nagios_downtimehistory` 
    10 LEFT JOIN nagios_objects as obj1 ON nagios_downtimehistory.object_id=obj1.object_id 
    11 LEFT JOIN nagios_instances ON nagios_downtimehistory.instance_id=nagios_instances.instance_id 
     8,npc_downtimehistory.* 
     9FROM `npc_downtimehistory` 
     10LEFT JOIN npc_objects as obj1 ON npc_downtimehistory.object_id=obj1.object_id 
     11LEFT JOIN npc_instances ON npc_downtimehistory.instance_id=npc_instances.instance_id 
    1212ORDER BY scheduled_start_time DESC, actual_start_time DESC, actual_start_time_usec DESC, downtimehistory_id DESC 
    1313 
  • trunk/queries/event_handlers.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_eventhandlers.object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_eventhandlers.object_id 
    55,obj1.objecttype_id 
    66,obj1.name1 AS host_name 
    77,obj1.name2 AS service_description 
    8 ,nagios_eventhandlers.* 
    9 FROM `nagios_eventhandlers` 
    10 LEFT JOIN nagios_objects as obj1 ON nagios_eventhandlers.object_id=obj1.object_id 
    11 LEFT JOIN nagios_instances ON nagios_eventhandlers.instance_id=nagios_instances.instance_id 
     8,npc_eventhandlers.* 
     9FROM `npc_eventhandlers` 
     10LEFT JOIN npc_objects as obj1 ON npc_eventhandlers.object_id=obj1.object_id 
     11LEFT JOIN npc_instances ON npc_eventhandlers.instance_id=npc_instances.instance_id 
    1212ORDER BY start_time DESC, start_time_usec DESC, eventhandler_id DESC 
    1313 
  • trunk/queries/flapping_history.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_flappinghistory.object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_flappinghistory.object_id 
    55,obj1.objecttype_id 
    66,obj1.name1 AS host_name 
    77,obj1.name2 AS service_description 
    8 ,nagios_flappinghistory.* 
    9 FROM `nagios_flappinghistory` 
    10 LEFT JOIN nagios_objects as obj1 ON nagios_flappinghistory.object_id=obj1.object_id 
    11 LEFT JOIN nagios_instances ON nagios_flappinghistory.instance_id=nagios_instances.instance_id 
     8,npc_flappinghistory.* 
     9FROM `npc_flappinghistory` 
     10LEFT JOIN npc_objects as obj1 ON npc_flappinghistory.object_id=obj1.object_id 
     11LEFT JOIN npc_instances ON npc_flappinghistory.instance_id=npc_instances.instance_id 
    1212ORDER BY event_time DESC, event_time_usec DESC, flappinghistory_id DESC 
    1313 
  • trunk/queries/host_comments.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_comments.object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_comments.object_id 
    55,obj1.name1 AS host_name 
    6 ,nagios_comments.* 
    7 FROM `nagios_comments` 
    8 LEFT JOIN nagios_objects as obj1 ON nagios_comments.object_id=obj1.object_id 
    9 LEFT JOIN nagios_instances ON nagios_comments.instance_id=nagios_instances.instance_id 
     6,npc_comments.* 
     7FROM `npc_comments` 
     8LEFT JOIN npc_objects as obj1 ON npc_comments.object_id=obj1.object_id 
     9LEFT JOIN npc_instances ON npc_comments.instance_id=npc_instances.instance_id 
    1010WHERE obj1.objecttype_id='1' 
    1111ORDER BY entry_time DESC, entry_time_usec DESC, comment_id DESC 
  • trunk/queries/host_downtime_history.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_downtimehistory.object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_downtimehistory.object_id 
    55,obj1.name1 AS host_name 
    6 ,nagios_downtimehistory.* 
    7 FROM `nagios_downtimehistory` 
    8 LEFT JOIN nagios_objects as obj1 ON nagios_downtimehistory.object_id=obj1.object_id 
    9 LEFT JOIN nagios_instances ON nagios_downtimehistory.instance_id=nagios_instances.instance_id 
     6,npc_downtimehistory.* 
     7FROM `npc_downtimehistory` 
     8LEFT JOIN npc_objects as obj1 ON npc_downtimehistory.object_id=obj1.object_id 
     9LEFT JOIN npc_instances ON npc_downtimehistory.instance_id=npc_instances.instance_id 
    1010WHERE obj1.objecttype_id='1' 
    1111ORDER BY scheduled_start_time DESC, actual_start_time DESC, actual_start_time_usec DESC, downtimehistory_id DESC 
  • trunk/queries/host_event_handlers.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_eventhandlers.object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_eventhandlers.object_id 
    55,obj1.name1 AS host_name 
    6 ,nagios_eventhandlers.* 
    7 FROM `nagios_eventhandlers` 
    8 LEFT JOIN nagios_objects as obj1 ON nagios_eventhandlers.object_id=obj1.object_id 
    9 LEFT JOIN nagios_instances ON nagios_eventhandlers.instance_id=nagios_instances.instance_id 
     6,npc_eventhandlers.* 
     7FROM `npc_eventhandlers` 
     8LEFT JOIN npc_objects as obj1 ON npc_eventhandlers.object_id=obj1.object_id 
     9LEFT JOIN npc_instances ON npc_eventhandlers.instance_id=npc_instances.instance_id 
    1010WHERE obj1.objecttype_id='1' 
    1111ORDER BY start_time DESC, start_time_usec DESC, eventhandler_id DESC 
  • trunk/queries/host_flapping_history.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_flappinghistory.object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_flappinghistory.object_id 
    55,obj1.name1 AS host_name 
    6 ,nagios_flappinghistory.* 
    7 FROM `nagios_flappinghistory` 
    8 LEFT JOIN nagios_objects as obj1 ON nagios_flappinghistory.object_id=obj1.object_id 
    9 LEFT JOIN nagios_instances ON nagios_flappinghistory.instance_id=nagios_instances.instance_id 
     6,npc_flappinghistory.* 
     7FROM `npc_flappinghistory` 
     8LEFT JOIN npc_objects as obj1 ON npc_flappinghistory.object_id=obj1.object_id 
     9LEFT JOIN npc_instances ON npc_flappinghistory.instance_id=npc_instances.instance_id 
    1010WHERE obj1.objecttype_id='1' 
    1111ORDER BY event_time DESC, event_time_usec DESC, flappinghistory_id DESC 
  • trunk/queries/notifications.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_notifications.object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_notifications.object_id 
    55,obj1.objecttype_id 
    66,obj1.name1 AS host_name 
    77,obj1.name2 AS service_description 
    8 ,nagios_notifications.* 
    9 FROM `nagios_notifications` 
    10 LEFT JOIN nagios_objects as obj1 ON nagios_notifications.object_id=obj1.object_id 
    11 LEFT JOIN nagios_instances ON nagios_notifications.instance_id=nagios_instances.instance_id 
     8,npc_notifications.* 
     9FROM `npc_notifications` 
     10LEFT JOIN npc_objects as obj1 ON npc_notifications.object_id=obj1.object_id 
     11LEFT JOIN npc_instances ON npc_notifications.instance_id=npc_instances.instance_id 
    1212ORDER BY start_time DESC, start_time_usec DESC 
    1313 
  • trunk/queries/service_event_handlers.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_eventhandlers.object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_eventhandlers.object_id 
    55,obj1.name1 AS host_name 
    66,obj1.name2 AS service_description 
    7 ,nagios_eventhandlers.* 
    8 FROM `nagios_eventhandlers` 
    9 LEFT JOIN nagios_objects as obj1 ON nagios_eventhandlers.object_id=obj1.object_id 
    10 LEFT JOIN nagios_instances ON nagios_eventhandlers.instance_id=nagios_instances.instance_id 
     7,npc_eventhandlers.* 
     8FROM `npc_eventhandlers` 
     9LEFT JOIN npc_objects as obj1 ON npc_eventhandlers.object_id=obj1.object_id 
     10LEFT JOIN npc_instances ON npc_eventhandlers.instance_id=npc_instances.instance_id 
    1111WHERE obj1.objecttype_id='2' 
    1212ORDER BY start_time DESC, start_time_usec DESC, eventhandler_id DESC 
  • trunk/queries/service_flapping_history.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_flappinghistory.object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_flappinghistory.object_id 
    55,obj1.name1 AS host_name 
    66,obj1.name2 AS service_description 
    7 ,nagios_flappinghistory.* 
    8 FROM `nagios_flappinghistory` 
    9 LEFT JOIN nagios_objects as obj1 ON nagios_flappinghistory.object_id=obj1.object_id 
    10 LEFT JOIN nagios_instances ON nagios_flappinghistory.instance_id=nagios_instances.instance_id 
     7,npc_flappinghistory.* 
     8FROM `npc_flappinghistory` 
     9LEFT JOIN npc_objects as obj1 ON npc_flappinghistory.object_id=obj1.object_id 
     10LEFT JOIN npc_instances ON npc_flappinghistory.instance_id=npc_instances.instance_id 
    1111WHERE obj1.objecttype_id='2' 
    1212ORDER BY event_time DESC, event_time_usec DESC, flappinghistory_id DESC 
  • trunk/queries/state_history.sql

    r97 r152  
    11SELECT  
    2 nagios_instances.instance_id 
    3 ,nagios_instances.instance_name 
    4 ,nagios_statehistory.object_id 
     2npc_instances.instance_id 
     3,npc_instances.instance_name 
     4,npc_statehistory.object_id 
    55,obj1.objecttype_id 
    66,obj1.name1 AS host_name 
    77,obj1.name2 AS service_description 
    8 ,nagios_statehistory.* 
    9 FROM `nagios_statehistory` 
    10 LEFT JOIN nagios_objects as obj1 ON nagios_statehistory.object_id=obj1.object_id 
    11 LEFT JOIN nagios_instances ON nagios_statehistory.instance_id=nagios_instances.instance_id 
     8,npc_statehistory.* 
     9FROM `npc_statehistory` 
     10LEFT JOIN npc_objects as obj1 ON npc_statehistory.object_id=obj1.object_id 
     11LEFT JOIN npc_instances ON npc_statehistory.instance_id=npc_instances.instance_id 
    1212ORDER BY state_time DESC, state_time_usec DESC 
    1313