While running a report, what is the value for last system restart?
I have been using the report wizard to run a report on users who have not restarted in over 7 days. When I choose the criteria "Last system reboot > X" is the X in hours, days, minutes, etc? I keep getting no results shown then i try to view it.
i only want to see users who have not rebooted in over 7 days, no one else. Any help would be greatly appreciated!
0 Comments
[ + ] Show comments
Answers (1)
Answer Summary:
SELECT NAME, USER_LOGGED, LAST_REBOOT FROM MACHINE M WHERE LAST_REBOOT < DATE_SUB(NOW(), INTERVAL 7 DAY) ORDER BY M.NAME
SELECT NAME, USER_LOGGED, LAST_REBOOT FROM MACHINE M WHERE LAST_REBOOT < DATE_SUB(NOW(), INTERVAL 7 DAY) ORDER BY M.NAME
Please log in to answer
Posted by:
dugullett
11 years ago
This will work. I'm not sure what all other info you need?
SELECT NAME, USER_LOGGED, LAST_REBOOT FROM MACHINE M WHERE LAST_REBOOT < DATE_SUB(NOW(), INTERVAL 7 DAY) ORDER BY M.NAME
Comments:
-
I'd love their log in username! - areiner 11 years ago
-
You can change USER_LOGGED, to USER_NAME. As long as they are logged in at time of check in that field will be populated. I've gotten used to USER_LOGGED just because it has DOMAIN\user. Since we have multiple domains. - dugullett 11 years ago
-
fantastic! I will need to try this tomorrow first thing in the morning and i will get back to you. - areiner 11 years ago
-
You can also change it to this if you want the date to be a little more friendly.
SELECT NAME, USER_LOGGED, DATE_FORMAT(LAST_REBOOT, '%r %M %D, %Y' ) as 'Last Reboot'
FROM MACHINE M
WHERE LAST_REBOOT < DATE_SUB(NOW(), INTERVAL 7 DAY)
ORDER BY M.NAME - dugullett 11 years ago
-
This works great. Is there anywhere you can point me in the direction of the syntax needed to work in K1000 reports? It's been a looong time since i;ve done SQL - areiner 11 years ago
-
This question has some good info http://itninja.com/question/looking-for-some-good-mysql-information . Start here. Get the MSQL browser and start testing some things out. Starting out make sure to add LIMIT 5 to the end of your scripts. I've brought down my Kbox a time or two with some crazy queries. This will at least limit the results.
http://www.mysql.com/downloads/workbench/ - dugullett 11 years ago-
did you just add your k1000 box under a "new connection" on here? - areiner 11 years ago
-
lol...thank goodness for the reboot button. Thanks so much for all this, checking it out now. - areiner 11 years ago
-
did you just add your k1000 box under a "new connection" on here? - areiner 11 years ago
-
Yes. By default the password is box747. I would suggest changing that since it's pretty well known. - dugullett 11 years ago
-
I am logged in to it but every time i run a query it says:
Error Code: 1046. No database selected Select the default DB to be used by double-clicking its name in the SCHEMAS list in the sidebar. 0.000 sec
What schema do i need to choose? My options are KBSYS ORG1 REPORT_TEMP - areiner 11 years ago-
Usually everything will come from ORG1. KBSYS is usually used for warranty type reports. - dugullett 11 years ago
-
Book org 1 worked! Thank you so much for you help. I will post back here with any more questions if that is ok. - areiner 11 years ago
-
Works for me. If you do get stuck on a query I would post a new question. Usually if people have a starting point it's usually a few minor tweaks. It would probably get answered faster. - dugullett 11 years ago
-
Great, thanks again. - areiner 11 years ago
-
If you dont want to write your tables with org1 or kbsys on the table name just double click the db you are going to query and it will set it as the default then you can code the same way you would in kace. Its the equivalent of starting a sql script with
USE ORG1
GO - jdornan 11 years ago