Operating System - HP-UX
1833047 Members
2400 Online
110049 Solutions
New Discussion

Re: Server shutdown time in hpux 11.0, 10.20

 
vaman
Frequent Advisor

Server shutdown time in hpux 11.0, 10.20

I need to find the server shutdown time (server uptime) for last month. How can i find out that, I get information from uptime if server is up for one month but if it is down for one or two occessions , then need to find out the exact time server is down. from syslog time I am getting the last server boot time.
vaman kulkarni
10 REPLIES 10
Pete Randall
Outstanding Contributor

Re: Server shutdown time in hpux 11.0, 10.20

How about looking at /var/adm/syslog/OLDsyslog.log? The timestamps on the first entry should be from the previous boot. You could also look the shutdown log.


Pete

Pete
Dave Hutton
Honored Contributor

Re: Server shutdown time in hpux 11.0, 10.20

You can look in the /etc/shutdownlog to see when the server was rebooted. But it doesn't show how long the server was down.

I'm not sure if you can estimate from that.
harry d brown jr
Honored Contributor

Re: Server shutdown time in hpux 11.0, 10.20

for future practice, use:

[root@vpart1 /sbin/init.d]# cat /sbin/init.d/notifyme
#!/sbin/sh
#
unset UNIX95
PATH=/sbin:/usr/sbin:/usr/bin
export PATH

NOTIFYLIST="USERNAMEGOESHERE@YOURDOMAIN.com"

case $1 in

start_msg)
echo "Send an email to notifyme that system is being broght backup"
;;

stop_msg)
echo "Send an email to notifyme that system is being shutdown"
;;

start)

echo "System (`hostname`) coming back up @ (`date`)"|mailx -s"System `hostname` booting" ${NOTIFYLIST}
;;

stop)
echo "System (`hostname`) going down @ (`date`)"|mailx -s"System `hostname` shutting down" ${NOTIFYLIST}
;;

*)
echo "usage: $0 {start|stop}"
;;
esac

exit

-----------------------------------------------

Then make some symbolic links as shown below:

[root@vpart1 /sbin/init.d]# ls -l /sbin/rc*/* | grep notify
lrwxrwxrwx 1 root sys 21 Jun 15 09:55 /sbin/rc2.d/K090notifyme -> /sbin/init.d/notifyme
lrwxrwxrwx 1 root sys 21 Jun 15 09:55 /sbin/rc2.d/S090notifyme -> /sbin/init.d/notifyme
[root@vpart1 /sbin/init.d]#


Look at ALL of your syslog's and look to see when processes like syslogd where stopped.

live free or die
harry d brown jr
Live Free or Die
HGN
Honored Contributor

Re: Server shutdown time in hpux 11.0, 10.20

Hi

You can check the /var/adm/syslog/OLDsyslog.log files which gets created every time a rebot happens.The other place to look is shutdown.log but it will not give the duration.

Rgds

HGN
Doug Burton
Respected Contributor

Re: Server shutdown time in hpux 11.0, 10.20

Something to think about. If you want to keep your syslogs you could change the line in /sbin/init.d/syslogd from:

mv /var/adm/syslog/syslog.log /var/adm/syslog/OLDsyslog.log

to

mv /var/adm/syslog/syslog.log /var/adm/syslog/OLDsyslog.'date +%Y%m%d`

You could gzip it after it's created or better yet, send the syslog data to a log server.

Remember that if you use the "date" line above it'll move the syslog and add the date to the end of it. If you reboot the box more than once in 24hrs then it will get over written. If you think that may happen then add the hour and min to the "date" line.
Florian Heigl (new acc)
Honored Contributor

Re: Server shutdown time in hpux 11.0, 10.20

The information You seek could best be obtained from lastlog - just like this:

root@host:/>last | grep -i reboo
reboot system boot Sun Nov 28 23:59 still logged in
reboot system boot Sun Nov 21 23:59 - 23:59 (7+00:00)
reboot system boot Sun Nov 14 23:59 - 23:59 (7+00:00)

The other part is the shutdownlog already mentioned.
yesterday I stood at the edge. Today I'm one step ahead.
Victor BERRIDGE
Honored Contributor

Re: Server shutdown time in hpux 11.0, 10.20

Hi,
Unless you save the information by customization, all you will have is the last downtime:
tail /etc/rc.log.old
and head /etc/rc.log
e.g.
testbox:/etc tail rc.log.old
**************************************************
HP-UX run-level transition completed
Wed Nov 17 18:33:50 MET 2004
**************************************************
testbox:/etc $ head -5 rc.log
Old /etc/rc.log moved to /etc/rc.log.old

**************************************************
HP-UX Start-up in progress
Wed Nov 17 18:40:21 MET 2004
#
Difference 18:33:40 till 18:40:21 which is reboot starting
but I would consider the following time:
testbox:/etc $ tail -5 rc.log

**************************************************
HP-UX run-level transition completed
Wed Nov 17 18:42:18 MET 2004
**************************************************

So downtime between reboot is almost 10 minutes...


All the best
Victor
testbox:/etc $
Geoff Wild
Honored Contributor

Re: Server shutdown time in hpux 11.0, 10.20

Florian has it with last | grep -i reboot

But that tells you the reboot time - if you want uptime, you will have to approximate the time it took server to boot plus how long it was down (IE for maintenance).

If you really want to track uptime, why not install something like Big Brother (or Big Sister).

http://www.bb4.org/

http://bigsister.graeff.com/

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Kent Ostby
Honored Contributor

Re: Server shutdown time in hpux 11.0, 10.20

There a couple of things but I would check the last timestamp of /var/adm/syslog/OLDsyslog.log and compare it to the first line of /var/adm/syslog/syslog.log and that gives you your downtime.

Of course you need to check it each day to see if you went down overnight and see how long you were down.

Best regards,

Oz
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
vaman
Frequent Advisor

Re: Server shutdown time in hpux 11.0, 10.20

Is it possible to use perfview to see the system down time? Whst factors need to be monitored for calculating system down time?
vaman kulkarni