HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- HPE ProLiant
- >
- Server Management - Systems Insight Manager
- >
- Need new SQL query for Events that occurred since ...
Server Management - Systems Insight Manager
1833465
Members
2791
Online
110052
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2004 01:43 AM
11-03-2004 01:43 AM
Need new SQL query for Events that occurred since 18:30 the prior day
Help wanted my current SQL query for inaccessible devices no longer works after the SIM 4 upgrade.
Description of what and why:
My helpdesk leaves at 6:30 pm and needs to generate a report each morning listing the servers that experienced issues during the night hours when no one is here to actively monitor it. Under CIM 7 I was able to use the following SQL query:
______________________________________________
declare @YesterdayDate varchar(20)
declare @TempDate datetime
set @TempDate = getdate() - 1
set @TempDate = cast(@TempDate as varchar(11))
set @YesterdayDate = cast(@TempDate as varchar(11)) + ' 18:30:00'
SELECT Cast (devices.Name as varchar(20)) as 'Server Name',
Max(Cast(Generated as varchar(23))) as 'Alarm Date',
Cast(stringTableLarge.largeValue as varchar(60)) as 'Alarm Description'
FROM INSIGHT_V1_0_143944718.dbo.devices devices, INSIGHT_V1_0_143944718.dbo.notices notices,
INSIGHT_V1_0_143944718.dbo.stringTableLarge stringTableLarge,INSIGHT_V1_0_143944718.dbo.noticeType noticeType,
INSIGHT_V1_0_143944718.dbo.stringResource stringResource
WHERE devices.DeviceKey = notices.DeviceKey AND notices.NoticeType = noticeType.NoticeType
AND Cast(noticeType.NoticeType as varchar(10)) = stringResource.subClass
AND stringResource.id = stringTableLarge.id
AND stringResource.resourceName='label' AND stringResource.resourceClassName='NoticeType'
AND ((notices.NoticeSeverity = '5' OR notices.NoticeSeverity = '4')
AND stringTableLarge.largeValue = 'Device Status Change')
-- The line above states to grab the alarms where the Device Status changed to Critical (5) or Major (4)
-- This is the equivalent of device inaccessible in previous CIM
AND Cast(Generated as varchar(11)) > @YesterdayDate
GROUP BY devices.Name,stringTableLarge.largeValue
ORDER BY Max(notices.Generated) asc
_______________________________________________
We run the SQL script using ISQL form the command line saving the output in a text file that we parse and automatically email to all who wish to recieve it. The new SIM 4 database changed the datatype time of the event to a java sql timestamp which is millieseconds since 01/01/1970 00:00:01
Sample of previous and desired output:
______________________________________________
psnva211 Oct 20 2004 10:23PM Device Status Change
csnva280 Oct 20 2004 10:44PM Device Status Change
psnva222 Oct 20 2004 11:26PM Device Status Change
psnva101 Oct 21 2004 12:34AM Device Status Change
ntprt28 Oct 21 2004 12:47AM Device Status Change
Description of what and why:
My helpdesk leaves at 6:30 pm and needs to generate a report each morning listing the servers that experienced issues during the night hours when no one is here to actively monitor it. Under CIM 7 I was able to use the following SQL query:
______________________________________________
declare @YesterdayDate varchar(20)
declare @TempDate datetime
set @TempDate = getdate() - 1
set @TempDate = cast(@TempDate as varchar(11))
set @YesterdayDate = cast(@TempDate as varchar(11)) + ' 18:30:00'
SELECT Cast (devices.Name as varchar(20)) as 'Server Name',
Max(Cast(Generated as varchar(23))) as 'Alarm Date',
Cast(stringTableLarge.largeValue as varchar(60)) as 'Alarm Description'
FROM INSIGHT_V1_0_143944718.dbo.devices devices, INSIGHT_V1_0_143944718.dbo.notices notices,
INSIGHT_V1_0_143944718.dbo.stringTableLarge stringTableLarge,INSIGHT_V1_0_143944718.dbo.noticeType noticeType,
INSIGHT_V1_0_143944718.dbo.stringResource stringResource
WHERE devices.DeviceKey = notices.DeviceKey AND notices.NoticeType = noticeType.NoticeType
AND Cast(noticeType.NoticeType as varchar(10)) = stringResource.subClass
AND stringResource.id = stringTableLarge.id
AND stringResource.resourceName='label' AND stringResource.resourceClassName='NoticeType'
AND ((notices.NoticeSeverity = '5' OR notices.NoticeSeverity = '4')
AND stringTableLarge.largeValue = 'Device Status Change')
-- The line above states to grab the alarms where the Device Status changed to Critical (5) or Major (4)
-- This is the equivalent of device inaccessible in previous CIM
AND Cast(Generated as varchar(11)) > @YesterdayDate
GROUP BY devices.Name,stringTableLarge.largeValue
ORDER BY Max(notices.Generated) asc
_______________________________________________
We run the SQL script using ISQL form the command line saving the output in a text file that we parse and automatically email to all who wish to recieve it. The new SIM 4 database changed the datatype time of the event to a java sql timestamp which is millieseconds since 01/01/1970 00:00:01
Sample of previous and desired output:
______________________________________________
psnva211 Oct 20 2004 10:23PM Device Status Change
csnva280 Oct 20 2004 10:44PM Device Status Change
psnva222 Oct 20 2004 11:26PM Device Status Change
psnva101 Oct 21 2004 12:34AM Device Status Change
ntprt28 Oct 21 2004 12:47AM Device Status Change
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2004 03:14 AM
11-03-2004 03:14 AM
Re: Need new SQL query for Events that occurred since 18:30 the prior day
Based on the info u have given,
select dateadd(day,(/86400000),'1970-01-01')
will give you the date associated with the timestamp. Hope you can carry on further.
select dateadd(day,(
will give you the date associated with the timestamp. Hope you can carry on further.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP