hourglass for hp-ux - allegro.com filehourglass for hp-ux reference manual 6 introduction hourglass...

39
HourGlass for HP-UX Reference Manual

Upload: dodieu

Post on 04-Jun-2018

231 views

Category:

Documents


0 download

TRANSCRIPT

HourGlass

for HP-UX

Reference Manual

HourGlass for HP-UX Reference Manual

3

Copyright © 1997-2012 Allegro Consultants, Inc.

ALLEGRO CONSULTANTS, INC. MAKES NO WARRANTY OF ANY KIND WITH REGARD

TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES

OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Allegro

Consultants, Inc. shall not be liable for errors contained herein or for incidental or consequential

damages in connection with the furnishing, performance or use of this material.

HP-UX is a trademark of Hewlett-Packard Company.

HourGlass is a trademark of Princeton Softech, Inc.

HourGlass Support

Allegro Consultants, Inc.

4675 Stevens Creek Blvd., Suite 121

Santa Clara, CA 95051

(408) 252-2330 voice

http://www.allegro.com/

Revision Date: February 13, 2012

HourGlass for HP-UX Reference Manual

4

Table of Contents

TABLE OF CONTENTS 4

INTRODUCTION 6

OVERVIEW 7

HOW TO INSTALL HOURGLASS FOR HP-UX 8

STARTING AND STOPPING HOURGLASS FOR HP-UX 11

QUICK START GUIDE TO HOURGLASS FOR HP-UX 12

DEFINITIONS 14

Private clock 14

Altered date/time 14

Real date/time 14

hgconfig rules file 14

hourglass -setdate 14

Date calculation method 14

DATE AND TIME FORMATS 16

EXECUTING HOURGLASS FOR HP-UX COMMANDS 17

PRIVATE CLOCKS 18

Order of Precedence 18

THE $HOURGLASS -SETDATE COMMAND: CREATING PRIVATE CLOCKS FOR

ENTIRE SESSIONS 20

THE HGCONFIG FILE: CREATING PRIVATE CLOCKS AUTOMATICALLY 21

LOGGING DATE/TIME SYSTEM CALLS 24

Starting and stopping logging 24

Controlling what gets written to log files 25

Rebuilding the log files 26

Viewing the log files 26

ADDITIONAL HOURGLASS COMMANDS 27

Controlling Who Can Use Certain HourGlass Commands 27

Displaying Current Date/Time Information 27

Display Private Clock Information 27

Displaying HourGlass Status Information 28

HourGlass for HP-UX Reference Manual

5

Reading HourGlass Commands From A File 29

Contacting Allegro Consultants, Inc. 29

Configuration rules vs. “setdate” 29

RUNNING HOURGLASS FOR HP-UX INTERACTIVELY 31

CUMULATIVE CHANGES TO HOURGLASS FOR HP-UX 33

HourGlass for HP-UX Reference Manual

6

Introduction

HourGlass for HP-UX is an essential testing tool in the quest for Year 2000 compliance of all your in-

house and third-party applications, utilities, and system software.

HourGlass for HP-UX allows you to create “private clocks”, which may be set to any HP-UX-supported

date and time (past, present, or future). You may then attach any processes you chose to these “private

clocks”.

Whenever any process attached to a private clock asks for the system date/time, it will get whatever

date/time its private clock currently says.

Private clocks are created and attached to processes in one of two ways:

1) Via a set of rules, permitting you to automatically attach private clocks to all processes that match a

selection rule (i.e. by program name, UID, GID, eUID, or eGID); or

2) By executing a command within your session, which creates a private clock that will be attached to

all programs you run in that session.

HourGlass for HP-UX is simple to use (much simpler than it may sound at this point), safe, and

thorough.

Some of the uses of HourGlass for HP-UX include:

Discovering which applications call system date functions

Testing in-house software

Testing third-party applications and utilities

Running non-year-2000-compliant applications after 2000-01-01

Re-running month- or year-end jobs at other times

Testing modified month- or year-end jobs in advance

HourGlass for HP-UX Reference Manual

7

Overview

HourGlass for HP-UX consists of the following components:

The hourglass control program, used to enable/disable the HourGlass intercept routine, create

private clocks, start/stop logging, and issue other commands to HourGlass.

The hgconfig rules file, used to create rule-based automatic private clocks.

The hourglass_call.log and hourglass_event.log log files in /var/adm.

A cgi-bin program for optional use with a web server.

HourGlass for HP-UX Reference Manual

8

How to Install HourGlass for HP-UX

HourGlass for HP-UX can either be downloaded from our web site

(http://www.allegro.com/hourglass2000), or loaded from tape. If you download the software, the

installation instructions are on the web page. If you received a tape, the installation instructions are

included with the tape.

Regardless of how you received HourGlass, once you have put the files on your machine, the installation

is the same:

1. Uncompress and restore the HourGlass files.

uncompress /tmp/hourglass.tar.Z

tar xvf /tmp/hourglass.tar (presuming the .tar file is in /tmp)

2. Do this step for both new installation and upgrades.

a. If your release of HP-UX is 11.11 or older, run the HourGlass for HP-UX install script:

cd /opt/allegro/hourglass

./Install

The script will generate a new kernel (/stand/vmunix), and will ask for permission to reboot.

Once the reboot is done, HourGlass for HP-UX will be installed and nearly ready to run.

b. If your release of HP-UX is 11.23 or newer, run HourGlass for HP-UX startup command:

cd /opt/allegro/hourglass/bin

./hourglass startup

3. Logon as root.

4. For new installations, obtain a license string.

HourGlass for HP-UX needs a license string to enable it to run. To request a license, email the

output of:

uname –a; model

to [email protected], along with your name, company, address, and phone number. We will

email you a license string as soon as possible. When you receive our reply, there will be one line

with a long string of hex numbers similar to the following:

INSTALL $a0987eed $219ae0ba ... $fecae09b $e22e1eaa $de651f45

Run /opt/allegro/hourglass/bin/hourglass and enter that string. That installs the license, and

HourGlass for HP-UX Reference Manual

9

HourGlass for HP-UX will be fully functional.

5. Enable HourGlass for HP-UX.

By default, HourGlass does not start in the "enabled" state. Enable HourGlass by doing:

/opt/allegro/hourglass/bin/hourglass enable

This would typically be done only once per bootup.

6. Test HourGlass for HP-UX.

Try giving your session a private clock with the date 1/1/2000:

/opt/allegro/hourglass/bin/hourglass setdate 1/1/2000

date

Restore the date:

/opt/allegro/hourglass/bin/hourglass setdate original

date

7. Consider testing the rule-based dates.

The file /opt/allegro/hourglass/hgconfig contains the rules HourGlass for HP-UX uses to

determine whether or not a new process should be given a private clock (with an altered date/time).

If you edit the rules, they must be "loaded" before they will take effect. The load is done via:

/opt/allegro/hourglass/bin/hourglass config load

8. Test web-based status.

If you have a web server running on your HP 9000, you can get HourGlass for HP-UX status by

moving (or copying) the files in /opt/allegro/hourglass/cgi-bin/* to your web server's CGI

BIN directory. Then, you can check HourGlass for HP-UX status from a web browser. Assuming

your CGI BIN directory is called "cgi-bin" (from the browser viewpoint), you can look at:

http://<your-machine>/cgi-bin/hourglass

9. CGI versus security.

Normally, HourGlass will not allow a non-superuser to see information about a process other than

their own (or their session leader). However, some system managers wish to be able to use a web

browser to report on all processes with private clocks.

So, we provide two CGI-BIN scripts and two associated programs (cgiwhoall and cgiwhoalt) to

report this information. The two programs are setuid'd to root, so they run as root. This allows them

HourGlass for HP-UX Reference Manual

10

to display information about all processes on the system.

If you do not want non-superusers to be able to see the clock information of all processes in the

system, then either do not put the files /opt/allegro/hourglass/cgi-bin/hourglass-who-all

and /opt/allegro/hourglass/cgi-bin/hourglass-who-alt into your CGI directory or put the

scripts in a password-protected CGI-BIN directory, or remove the "setuid" bit from the two

programs:

chmod -s /opt/allegro/hourglass/bin/cgi*

The script /opt/allegro/hourglass/cgi-bin/hourglass-who-all uses

/opt/allegro/hourglass/bin/cgiwhoall, and the script /opt/allegro/hourglass/cgi-

bin/hourglass-who-alt uses /opt/allegro/hourglass/bin/cgiwhoalt.

HourGlass for HP-UX Reference Manual

11

Starting and Stopping HourGlass for HP-UX

After you have installed HourGlass for HP-UX, you must enable the HourGlass for HP-UX intercept

routine before any private clocks can be created and attached to processes:

1. Log on as root (if you haven't already)

2. Start the HourGlass for HP-UX intercept routine by typing:

/opt/allegro/bin/hourglass enable

HourGlass for HP-UX will now intercept all system date/time calls, from all processes, until you disable

it or re-boot the system; however, it won't attach private clocks to any processes (i.e. it won’t change any

dates/times) until you tell it to using the hourglass command and/or the hgconfig rules file, described

later.

The enable command is needed once per bootup of HP-UX.

To disable the HourGlass for HP-UX intercept routine, just type:

/opt/allegro/bin/hourglass disable

HourGlass will be disabled until an enable command is done.

To check the status of HourGlass for HP-UX, type:

/opt/allegro/hourglass/bin/hourglass status

If there are issues enabling or getting status from HourGlass for HP-UX please check that hgconfig and

hplicens are both in /opt/allegro/hourglass.

HourGlass for HP-UX Reference Manual

12

Quick Start Guide to HourGlass for HP-UX

This section is intended to give you a quick demonstration of some of the features of HourGlass for HP-

UX. More information, details, complete syntax, etc. can be found in the rest of this manual.

After you have installed and started HourGlass for HP-UX, type in the commands shown below (you

can, of course, leave out the explanatory comments).

Check the current "real date/time":

$ date

Mon Apr 6 13:21:01 PDT 1998

First, a demonstration of a "Relative Constant Time" private clock (this is the default date calculation

method). This tells HourGlass to set the private clock for my session to a specified date/time, and then

let it advance normally.

$ hourglass -setdate 2002-05-14

HourGlass for HP-UX : version 98I

Date/time prior to alter: 1998-04-06 @ 13:21:15.0 (GMT: 1998-04-06 @ 20:21:15.0)

Date/time after alter: 2002-05-14 @ 13:21:15.0 (GMT: 2002-05-14 @ 20:21:15.0)

$ date

Tue May 14 13:21:16 PDT 2002

Wait one minute, and see what time it is:

$ date

Tue May 14 13:22:23 PDT 2002

Alternatively, "ACT" stands for "Absolute Constant Time". This tells HourGlass to set a private clock

to a specified date/time, and then stop the clock.

$ date Mon Apr 6 13:24:34 PDT 1998

$ hourglass -setdate act 05/14/2002 10:30

HourGlass for HP-UX : version 98I

Date/time prior to alter: 1998-04-06 @ 13:24:54.0 (GMT: 1998-04-06 @ 20:24:54.0)

Date/time after alter: 2002-05-14 @ 10:30:00.0 (GMT: 2002-05-14 @ 17:30:00.0)

$ date

Tue May 14 10:30:00 PDT 2002

HourGlass for HP-UX Reference Manual

13

Wait one minute, and see what time it is:

$ date

Tue May 14 10:30:00 PDT 2002

To switch your session back to the system clock (so that it gets the "original" or "real" date/time), use

this command:

$ hourglass -setdate orig

HourGlass for HP-UX : version 98I

Date/time prior to alter: 2002-05-14 @ 10:30:00.0 (GMT: 2002-05-14 @ 17:30:00.0)

Date/time after alter: 1998-04-06 @ 13:29:41.0 (GMT: 1998-04-06 @ 20:29:41.0)

$ date

Thu Apr 6 13:29:41 PDT 1998

Now a quick demonstration of "Delta Time". This tells HourGlass to set the private clock to the "real"

date/time plus or minus a fixed offset:

$ date

Mon Apr 6 13:31:05 PDT 1998

$ hourglass -setdate delta 2 years

HourGlass for HP-UX : version 98I

Date/time prior to alter: 1998-04-06 @ 13:31:12.0 (GMT: 1998-04-06 @ 20:31:12.0)

Date/time after alter: 2000-04-07 @ 13:31:12.0 (GMT: 2000-04-07 @ 20:31:12.0)

$ date

Thu Apr 6 13:31:16 PDT 2000

Now that we’re done testing, let’s switch back to the system clock:

$ hourglass -setdate orig

HourGlass for HP-UX : version 98I

Date/time prior to alter: 2000-04-07 @ 13:34:46.0 (GMT: 2000-04-07 @ 20:34:46.0)

Date/time after alter: 1998-04-06 @ 13:34:46.0 (GMT: 1998-04-06 @ 20:34:46.0)

$ date

Mon Apr 6 13:34:47 PDT 1998

HourGlass for HP-UX Reference Manual

14

Definitions

Before we go any further, a few definitions are necessary:

Private clock

A “private clock” has a date and/or time distinct from the system clock.

Private clock are created two ways:

1. By a rule in the hgconfig file, which will attach it to all processes that match the criteria in the

rule;

2. By the hourglass -setdate command. This will attach the private clock to all processes

created by the session that issued the command.

Altered date/time

The date/time a process gets from a “private clock”. It may be (and usually is) different from the real

date/time of the “system clock”.

Real date/time

The system clock’s current date/time, also known as the "original" date/time.

hgconfig rules file

The HourGlass configuration file, used to create private clocks and associate them with processes

based on logon (jobname, userid, account, and/or group), program name.

hourglass -setdate

Used to create a private clock for an entire session.

Date calculation method

When you create a private clock, you need a way to tell HourGlass for HP-UX what date/time to set

the private clock to, and whether that clock should be "running" or "frozen". HourGlass for HP-UX

provides four methods for calculating what date/time to set a private clock to, and how that clock

will keep running:

A. Relative Constant: Start a private clock at a specific date/time, and let it run normally.

B. Absolute Constant: Set a private clock to a specific date/time, and freeze it.

C. Delta: Start a private clock at the current “real” or “altered” date/time plus or minus any number

of years, hours, etc., and let it run normally.

HourGlass for HP-UX Reference Manual

15

D. Original: use the system clock instead of a private clock.

HourGlass for HP-UX Reference Manual

16

Date and Time Formats

Many HourGlass for HP-UX commands require you to enter a date and/or a time (referred to throughout

this manual as a "date/time", for simplicity). HourGlass for HP-UX can accept the date/time in any of

several different formats (in all formats, the separator may be either a "-" or "/"):

Format Example 1 Example 2 Example 3

yyyymmdd[hhmm[ss]] 20010514 19991022 19991231235959

mm/dd/[yy]yy [timespec] 05/14/2001 10-22-99 12/31/99 23:59:59

[yy]yy/mm/dd [timespec] 2001/05/14 99-10-22 99-12-31 23:59

dd/mm/[yy]yy [timespec] 14/05/2001 22-10-99 31-12-99 2359

The [timespec] is: hh:mm[:ss] or hhmm[ss]. If you don't specify a time, the current time is assumed.

Only dates from 1970-01-01 through 2037-12-31 are valid. Because of this, HourGlass assumes 2-

digit years from 00 through 37 are 21st century (2000-2037), and 2-digit years from 38 through 69

are invalid.

If the date is ambiguous, "mm/dd/yy" is assumed; e.g. 01/02/03 is January 02, 2003.

The "Delta" method requires an offset, which may be entered in the following format:

[*] [nn YEARS] [nn WEEKS] [nn DAYS] [nn HOURS]

For example:

DELTA 5 YEARS

means "add 5 years to the current private clock date/time"

DELTA -7 YEARS

means "subtract 7 years from the current private clock date/time"

DELTA * 4 YEARS

means "set the private clock to the system clock date/time plus 4 years"

DELTA * 5 YEARS 2 HOURS

means "set the private clock to the system clock plus 5 years and 2 hours"

As you can see from the examples, the "*" means set the private clock to the system clock +/- the

offset; without the "*", the offset is added to the current private clock date/time.

HourGlass for HP-UX Reference Manual

17

Executing HourGlass for HP-UX Commands

Throughout the rest of this manual, you will see references to the hourglass command. HourGlass for

HP-UX commands may be entered as command line parameters, or by running hourglass and typing the

commands at the HourGlass: prompt.

The hourglass program resides in /opt/allegro/hourglass/bin. We recommend adding this

directory to your path by modifying the file /etc/path. Throughout the remainder of this manual, we

will assume you have done so, and will give examples like "hourglass –status" rather than

"/opt/allegro/hourglass/bin/hourglass –status".

The following are two different ways to do exactly the same thing (attach a private clock to my session

set to January 1st, 2000):

Using the hourglass command:

hourglass -setdate 2000-01-01

Running the hourglass program interactively

$ hourglass

HourGlass: setdate 2000-1-1

HourGlass: exit

Rather than showing all of the different ways to execute every command, the rest of the manual will use

the hourglass command.

HourGlass for HP-UX Reference Manual

18

Private Clocks

As we mentioned before, there are two ways to create private clocks:

1. The /opt/allegro/hourglass/hgconfig configuration file; and

2. The hourglass -setdate command.

The /opt/allegro/hourglass/hgconfig file is used to associate private clocks with processes based

on rules. These rules allow you to specify what processes an automatic private clock should be created

for and attached to. You might use this to

1. test scripts without having to modify each individual script file;

2. set up a year2000 test userid so that anyone who logs in with that userid automatically gets a private

clock;

3. force certain programs to always use a private clock (or, if desired, the system clock). One example:

if you have a program that you know won't work properly after 2000-01-01, but you want to test

scripts that run that program, you can tell HourGlass for HP-UX to always return the "real" time to

that particular program.

The hourglass -setdate command is used create a private clock attached to all process in your

session. When you enter the hourglass -setdate command, a new private clock is created and starts

running. From then on, all programs you run in your session will use that same private clock.

Order of Precedence

With the possibility that a given process may qualify for multiple private clocks, it's important to know

how HourGlass for HP-UX will decide which clock to attach to it. HourGlass for HP-UX follows these

four steps in order, and stops as soon as a qualifying private clock is found:

1. Search the config file for a matching rule with ALWAYS flag matching the new process. Note that

HourGlass will use the first rule found.

Note: this step can be disabled via: CRITERIA NOALWAYS

If none is found…

2. Check for an ancestor process with an INHERIT ALWAYS rule and se the closest one we find. For

example, if the parent process has an ALWAYS rule, and the grandparent has an INHERIT

ALWAYS rule, and the great-grandparent has an INHERIT ALWAYS rule, then the private clock

for the new process will be inherited from the grandparent because it's the closest ancestor with a

clock that was from a rule with both the INHERIT and ALWAYS flags.

Note: this step can be disabled via: CRITERIA NOIALWAYS

HourGlass for HP-UX Reference Manual

19

If none is found…

3. Check for an ancestor with a SETDATE and use the closest one we find.

Note: this step can be disabled via: CRITERIA NOANCESTOR

If none is found…

4. Use the session leader’s private clock if it has one.

Note: this step can be disabled via: CRITERIA NOSID

If none is found…

5. check for matching rule without an ALWAYS flag and use the first one we find.

Note: this step can be disabled via: CRITERIA NORULE

If none is found…

6. Check for an ancestor process with an INHERIT rule without the ALWAYS flag. Use the closest

one we find. For example, if the parent process has an INHERIT rule, and the grandparent has an

ALWAYS rule, then the private clock for the new process will be inherited from the parent because

it's the closest ancestor with a clock that was from a rule with the INHERIT flag.

Note: this step can be disabled via: CRITERIA NOIRULE

If none is found…

7. Use the system clock.

HourGlass for HP-UX Reference Manual

20

The $hourglass -setdate Command:

Creating Private Clocks for Entire Sessions

The hourglass -setdate command tells HourGlass for HP-UX to create and set a private clock, and

then attach that private clock to your session leader process (usually your top-level shell), and to all new

processes created by your session. It doesn't affect any other jobs or sessions on the system.

There are four versions of the hourglass -setdate command, one for each of the four "date

modification methods" (see "Definitions" and "Date and Time Formats" for details on what each method

does, and how to enter the date/time). The method name may be abbreviated to the portion in capitals

(e.g., "ABS" instead of "ABSOLUTE"). If no method is specified, "RELative" is assumed.

hourglass -setdate ORIGinal

hourglass -setdate [*] <DELTA nnn YEARS>

hourglass -setdate <ABSolute date>

hourglass -setdate <RELative date>

(DT is a synonym for DELTA, ACT for ABSOLUTE and RCT for RELATIVE)

Examples:

hourglass -setdate original

hourglass -setdate delta 5 years

hourglass -setdate absolute 2000/1/1

hourglass -setdate rct 2025/05/14

hourglass -setdate 2025/05/14

After entering the hourglass -setdate command, any process within your session that asks for the

current date/time will get the date/time for your private clock1.

To change your session back to the system clock (the "real" date/time), simply type:

hourglass -setdate original

1 Unless that process qualified for a private clock in the hgconfig file which has the "ALWAYS" flag set (see the section "The

hgconfig File: Creating Private Clocks Automatically", and "Order of Precedence" in the "Private Clocks" section).

HourGlass for HP-UX Reference Manual

21

The hgconfig File:

Creating Private Clocks Automatically

Whenever you enable HourGlass for HP-UX (via the hourglass -enable command), it looks for a file

named /opt/allegro/hourglass/hgconfig. Each line of this file is a “rule” describing automatic

private clocks, and specifying what processes will be attached to them. When a new process is created,

HourGlass checks the rules that were loaded from this file to decide whether a private clock should be

automatically created for (and attached to) the new process.

The hgconfig file also has rules to create "ALWAYS" private clocks. Private clocks created via the

hourglass -setdate command take precedence over rules in the hgconfig file, unless the hgconfig

file rule has the "ALWAYS" option (see “Order of Precedence”, above).

Private clocks may be created for, and attached to, particular processes based on:

1. The program filename (without the path), up to 14 characters

2. The real user id (UID) or effective user id (eUID), numeric or name

3. The real group id (GID) or effective group id (eGID), numeric or name

Although regular expressions aren't supported, you may use a single "*" wildcard in place of any of the

above.

For each rule, you specify:

1. The Date Calculation Method,

2. The Date/Time (for ACT and RCT rules) or Offset (for DT rules), and

3. If that rule should be an "ALWAYS" rule, overriding private clocks created via hourglass –

setdate commands.

Since "an example is worth a thousand syntax diagrams", here is the syntax diagram for the rules in the

HGCONFIG file, followed by some examples and a discussion of what they mean.

Syntax:

Progname UID GID eUID eGID Date [Time] [ALWAYS|INHERIT]

Notes on syntax:

"ALWAYS", “INHERIT” and "Time" are optional; everything else is required.

Lines beginning with "#" are ignored.

HourGlass for HP-UX Reference Manual

22

The "*" wildcard may be used in place of the program name, UID, GID, eUID or eGID. (Regular

Expressions are not supported.)

The "ALWAYS" option means: "use the automatic private clock created by this rule instead of any

session private clock created by an hourglass -setdate command".

“INHERIT” means that the rule's private clock will be inherited by any process it creates. Normally

(without "INHERIT"), a private clock created by a rule won't be inherited by child processes.

Some example rules:

## Progname UID GID eUID eGID Date [Time] [ALWAYS]

# * * 104 * * act 1/1/2000 12:34

# * root 105 * * rct 1/1/2000

# * * john * * rcd 1/1/2000

# * * 107 * * delta 1 year

# virct * * * * rct 1/1/2000

# vircta jill * * * rct 1/1/2000 always

# foo jill * * * rct 1/1/2000 19:45 always

# vi1year * * * * delta 1 year

The /opt/allegro/hourglass/hgconfig file is read when you start HourGlass for HP-UX via the

hourglass -enable command. If you make changes to hgconfig after you start HourGlass for HP-UX,

you can use the following command to load your changed rules immediately:

hourglass -config load [configfilename]

For example,

hourglass –config load

will load rules from /opt/allegro/hourglass/hgconfig

The new rules will only be applied to processes created after the new rules are loaded. To have the new

rules immediately applied to processes which already exist, type:

hourglass -config reevaluate

To see what rules are currently in effect:

hourglass -config show

To read and syntax-check (but not load) a new config file:

hourglass -config read newconfigfilename

To read and display (but not load) a new config file:

hourglass -config readshow newconfigfilename

To "load" a new config file (i.e. replace the current rules with your new rules):

hourglass -config load newconfigfilename

HourGlass for HP-UX Reference Manual

23

or, interactively:

$ hourglass

HourGlass: config read newconfigfilename

HourGlass: config replace

HourGlass: exit

HourGlass for HP-UX Reference Manual

24

Logging Date/Time System Calls

The HourGlass for HP-UX logging facility gives you the ability to determine what programs use the

standard date/time system calls (e.g. time(), gettimeofday()). A record can be written to the log file

for each system call, or a single summary record can be written at process termination time, or both.

There are two hourglass commands used to control logging:

The –logdaemon command and

The –logging command.

The –logdaemon command is used to start and stop the logging daemon; the –logging command is

used to control what gets logged.

Starting and stopping logging

The syntax of the –logdaemon command is:

LOGDaemon [STATus]

LOGDaemon CLEAR

LOGDaemon KILL

LOGDaemon [ <FORCE | KILL> ] START [#seconds] [LINES #lines] [FormFeed]

The logging daemon is not started by default. To start the logging daemon, use the command:

hourglass –logdaemon start

If a logging daemon is already running, the command will be rejected. To kill the currently running

logdaemon and start a new one, type:

hourglass –logdaemon kill start

To just kill the current logdaemon, simply:

hourglass –logdaemon kill

To check the current status of the logdaemon, type:

hourglass –logdaemon status

The –logdaemon clear and –logdaemon –force options are only needed if something goes wrong.

Use clear to tell HourGlass to "forget" that a logdaemon is running; use force to tell HourGlass to start

a new logdaemon, even if there is already one running.

When you start the logdaemon, you may also specify how frequently it updates the logfile (every 20

seconds, by default). If date/time calls are being made faster than the logdaemon can update the log file,

logging information may be lost.

HourGlass for HP-UX Reference Manual

25

Normally, the logdaemon writes a page heading to the logfile every 55 lines. You can change the page

size via the lines #lines option. You can tell the logdaemon to insert formfeeds (^L) between pages

via the formfeed option.

Controlling what gets written to log files

The hourglass –logging command is used to control what gets written to the logging file by the

logdaemon. (Note: only clock_gettime(), ftime(), gettimeofday(), and time() can be

individually logged.) The syntax is:

LOGGING [ <NOne | ALL | ALTered | UNALTered | EXIT | EXITALT> ]

The log file used by the logging daemon is /var/adm/hourglass_call.log

To see the current logging status, just type:

hourglass -logging

There are four options controlling what to log.

To write a record to the log file for each date/time system call that uses a private clock, type:

hourglass –logging altered

To write a record to the log file for each date/time system call that uses the system clock, type:

hourglass –logging unaltered

To write a summary record, at process termination, of date/time system calls that use a private clock,

type:

hourglass –logging exitalt

To write a summary record, at process termination, of date/time system calls that use the system

clock, type:

hourglass –logging exit

To turn on all four logging options, type:

hourglass –logging all

To turn off all logging options, type:

hourglass –logging none

Note: hourglass –logging exitalt is probably the most useful logging option.

HourGlass for HP-UX Reference Manual

26

Rebuilding the log files

In addition to the date/time system calls logging, HourGlass for HP-UX keeps a log file of control and

logging commands it executes; the log file names is /var/adm/hourglass_event.log.

Should you need to rebuild the two log files, the command is:

hourglass –buildlog

Viewing the log files

To view the log files, you can use the commands:

hourglass –showlog calls

hourglass –showlog events

HourGlass for HP-UX Reference Manual

27

Additional HOURGLASS Commands

The section contains brief notes on a number of less-commonly-used (but still useful) HourGlass for HP-

UX commands.

Controlling Who Can Use Certain HourGlass Commands

Normally, only a superuser can use the config, enable, disable, logdaemon and logging HourGlass

for HP-UX commands. The following command gives you the ability to allow other users to do so:

hourglass -[dis]allow [ <control| logging | all> ]

If you would like to allow any user to be able to config, enable, and disable HourGlass for HP-UX, type

(as superuser):

hourglass –allow control

To allow any users to use the logdaemon and logging HourGlass for HP-UX commands, type (as

superuser):

hourglass –allow logging

The command hourglass –allow all is short for hourglass –allow control,logging

To disallow control or logging commands (after you've previously allowed them), type:

hourglass –allow control

hourglass –disallow logging

To see the current status:

hourglass -allow

Displaying Current Date/Time Information

HourGlass for HP-UX can display information about the current system date and time, in several

different formats:

hourglass –calendar

hourglass –clock

hourglass –date [GMT | LOCal]

hourglass –dateline

Display Private Clock Information

HourGlass for HP-UX can show you what processes are currently attached to private clocks:

hourglass -who [me | all | private] [active] [calls]

The hourglass -who command reports the clock status of your process (me); all processes with a

private clock (private); or all processes (all). The keyword active tells HourGlass to only report

HourGlass for HP-UX Reference Manual

28

those processes that have used at least one time routine since they started. The keyword calls tells

HourGlass to report the number of calls made to the various time routines instead of displaying program

name and user name for each process.

With the exception of the “me” keyword, only a superuser can use this command.

The default (hourglass -who with no options) is treated like hourglass -who private.

Examples:

To report private clock information about your session:

hourglass -who me

To report clock information for all processes that have a private clock:

hourglass -who priv

or

hourglass -who

To report clock information for all processes:

hourglass -who all

To report clock information for all processes that have a private clock and have made at least one

time call:

hourglass -who alt active

Displaying HourGlass Status Information

The status command reports information about HourGlass configuration, and/or logging, and/or global

usage statistics. The syntax is:

hourglass -status <ZERO | ALL | CONFIG | EVENTS | STATS>

The command:

hourglass –status stats

displays global usage statistics, including:

number of calls to clock_gettime(), and how many were altered;

number of calls to ftime(), and how many were altered;

number of calls to gettimeofday(), and how many were altered;

number of calls to time(), and how many were altered;

HourGlass for HP-UX Reference Manual

29

when the global counters were last set to zero (by STATUS ZERO);

number of configuration rules.

The command:

hourglass -status config

is a synonym for CONFIG. It reports the current configuration rules (if any).

The command:

hourglass status events

is a synonym for hourglass showlog events. It shows the HourGlass control events that have been

logged.

The command:

hourglass -status all

is a synonym for hourglass -status stats config event.

The command:

hourglass -status zero

resets the global call counters to 0.

Reading HourGlass Commands From A File

The command:

hourglass -use[q] filename

Reads hourglass commands from a file.

Contacting Allegro Consultants, Inc.

The command:

hourglass-contact

simply prints information on how to contact us. (This is the same information that is on the third page of

this manual.)

Configuration rules vs. “setdate”

CRITERIA [ [NO]<flag> [...]] <flag> ::= ALWAYS | IALWAYS | ANCestor | SID | RULE | IRULE

HourGlass for HP-UX Reference Manual

30

The CRITERIA command with no options shows the current criteria governing the interaction between

"rules" and SETDATE.

The various options allow the current criteria to be changed.

Flag Action Hint

ALWAYS enables precedence rule #1 look for rule with ALWAYS flag

IALWAYS enables precedence rule #2 look for ancestor with INHERIT ALWAYS rule

ANCESTOR enables precedence rule #3 look for ancestor with SETDATE clock

SID enables precedence rule #4 inherit clock from session leader, if it has a private clock

RULE enables precedence rule #5 look for rule without ALWAYS flag

IRULE enables precedence rule #6 look for ancestor with INHERIT noALWAYS rule

For a longer description of these criteria, do: HELP CONFIG

Note: if all criteria are disabled, then HourGlass is effectively disabled.

HourGlass for HP-UX Reference Manual

31

Running HourGlass for HP-UX Interactively

There are several commands that are only useful if you run HourGlass for HP-UX interactively by typing

hourglass

This will give you the "HourGlass:" prompt. You can then enter any of the commands described in this

manual, as well as a few others designed to make interactive use easier. Here are the additional

commands available in interactive mode:

HourGlass: exit

HourGlass: quit

HourGlass: //

All three commands terminate the current interactive run of HourGlass for HP-UX; they have no effect

on any private clocks currently in use (by your session or anyone else's).

HourGlass: help

provides interactive help on the various HourGlass commands.

HourGlass: [re]set [ <80 | 132 | COLumns # | LINES # | PAGING> ]

HourGlass: [re]set COPYLP

HourGlass: [re]set <GMT | LOCaltime>

The SET/RESET commands allow you to change the setting of various HourGlass options that, for the

most part, affect output formatting during this run of HourGlass.

HourGlass: set columns ###

The COLUMNS option tells HourGlass that your terminal is ### columns wide. Normally, HourGlass

uses the value from the COLUMNS environmental variable (and defaults to 80 if there is none).

HourGlass: set 80

set 80 is short for set columns 80

HourGlass: set 132

set 132 is short for set columns 132

HourGlass: set paging

HourGlass: reset paging

This enables/disables the "Hit <return> to continue, / to stop: " prompt (default: enabled).

HourGlass: set copylp

set copylp causes all subsequent output from this run of HourGlass to be copied to the printer (via

/dev/lp).

HourGlass: reset copylp

HourGlass for HP-UX Reference Manual

32

closes the printer file (if it was open).

HourGlass: set gmt

HourGlass: set localtime

HourGlass: reset gmt

HourGlass: reset localtime

set localtime (or reset gmt) tells HourGlass that you prefer to see date/time in local time (TZ

relative), not GMT.

set gmt (or reset localtime) tells HourGlass that you prefer to see date/time in GMT, not localtime.

(Default: set localtime)

HourGlass: set lines ###

The lines option tells HourGlass that your terminal is ### lines (or rows) long. Normally, HourGlass

uses the value from the lines environmental variable (and defaults to 24 if there is none).

HourGlass for HP-UX Reference Manual

33

Cumulative Changes to HourGlass for HP-UX Kernel:

2012-02-10

Repaired a situation where the startup process would fail if /dev/hourglass

didn’t already exist.

2010-08-27

Added 4 proc_cred_* externs for 11.31

2010-06-09

Updated hourglass UI

2009-09-07

New release, updated some structures for older OS's,

not compatible with prior versions.

(I.e.: for DLKM systems (all IPF, and any PA 11.23 or later),

user should do an "hourglass STOP" before installing new

release. For other PA systems, the normal "Install" script

should work fine.)

2009-06-19

Added max version for hourglass.p

2009-06-10

New build (no known change)

2008-06-02

Fixed parsing bug in hourglass ui

2008-04-10

Re-merged some IA stuff

2007-10-03

Rebuilt & released to remove any confusion about version.

2007-05-23

Changed to fix possible uninit variable in some hgint routines.

2006-08-09 A6F

Debugging some cmdline / cmdname stuff.

2006-08-06 A6E

Added hgcr_cmdline

2006-08-05 A6D

Removed ucomm/cmd and replaced with cmdline and cmdname.

2006-08-04 A6C

Removed all code for pre-11i and for 32-bit kernel

2006-08-04 A6B

Changes to hourglass.p

2006-07-28 A6A

Commented out hgdrive_ioctl tracing message for DEBUG_DEVELOPMENT.

2005-10-28 A5J

HourGlass for HP-UX Reference Manual

34

Recompiled with ALLOW_CAEXIT_INTERCEPT = 0

2005-10-20 A5H

Added CAEXIT enable/disable flag, and global (compile-time)

ALLOW_CAEXIT_INTERCEPT

2005-10-18 A5G

Enabled debugging at startup

2005-07-25 A4F

Version update

2004-09-26 A4D

Removed indirection for PLABEL() ...

result is first working +ES1.Xindirect version!

2004-09-18 A4C

Switched to using HP specified compiler options, hoping to

solve vPars problem.

2004-09-17 A4B

Added +ES1.Xindirect_calls and +ESdbgasm

2004-09-16 A4A

Moved into separate directory from other versions.

2003-06-24

Changed hgu_get_ucomm to accept a procp, not a pid.

2003-06-19

Changed hgu_get_ucomm to not doubly lock a proc

(avoid spinunlock panic at Rich T's company)

2003-05-21

Removed some default trace output at startup

(work on trying to solve Inland problem)

2003-05-11

Added debug_only_pid

Added SYSAUX debug for 11i

(work on trying to solve vPars problem)

2003-05-01 A3A

new security module (incompat with prior)

(work on trying to solve vPars problem)

2002-12-10 A2J

Fixed set_susan to allow values > 2**31-1.

Added set_susan_chars.

(work on trying to solve vPars problem)

2002-10-30 A2G

Worked on 2038 oddities in UI

2002-10-24

Added hgfc_show_sizes

2002-07-15

Added PSTARTTIME, did more 11i stuff

2002-06-26

HourGlass for HP-UX Reference Manual

35

merged 64-bit stuff

2002-06-20

Added debug_skip_pid (usually set to syslogd's pid)

2002-06-19

Minor change in hourglass.p

Rebuilt 64-bit version.

2002-03-22

Changed name of license file slightly

2001-11-30 A1E

Removed want_info = 1

Added hgunk_@ stuff for mirp_offset (for hg_unknown)

2001-11-15 A1D

Added want_info = 1 (for testing something)

2001-06-28 A1C

11i stuff

2001-06-18 A1B

Added 11i stuff (first pass)

2001-05-09 A1A

Recompile, change int version to 20010509

User Interface:

2011-09-27

Recompiled.

Made SHUTDOWN comment and then do DISABLE.

2011-09-16

Changed to make STARTUP syn for ENABLE on non-DLKM systems.

2011-03-15

Recompiled.

2011-02-27

Added PARSE command (for HG/Linux testing)

2010-09-29

Workaround using kctune for lw gtod patch (solve problem caused by HP change)

2010-09-07

Major merge with other versions.

Changed "who" output to have a "CommandLine" column header.

2010-08-27

Fixed problem with "nbsp;" appearing in "WHO ALL" output.

Merged 32-bit and 64-bit, so 11i_32 now uses hourglass_common/hourglass.p

Fixed problem with HELP command.

Minor mod to START command output.

Made STOP be a synonym for SHUTDOWN.

2010-07-28

Expanded 'test' command (to try to detect 11.31 systems with

HourGlass for HP-UX Reference Manual

36

'new' clock_gettime() and gettimeofday() that fail with HG).

2010-06-09

Added WHAT as synonym for VERSION

2009-06-24

Added check/report of architecture

2009-06-19

Changed to add max product version

2009-06-10

Rebuilt.

Fixed syntax for system() and close().

2009-03-12

Minor cleanup of parse_delta

2008-06-02

Fixed hourglass parsing bug that disallowed: SETDATE DELTA -5 YEARS

due to problem with passtep.

Fixed hourglass bug that disallowed delta times that would

put us back in time before "orig" time.

2008-05-27

updated hgdrive.

2008-05-12

revised pid setup in IA driver

2008-04-10

Enabled locking in hgdrive.

2007-10-16

Fixed daylight savings problem (bug in intrinsix).

Added code to detect if older version still loaded.

2007-10-05

Added save/restore private clock around security_stuff

------------------ first combined IA/PA version above here ----------

2007-09-20

Fixed "error writing to $stdlist" for cgi

Fixed lack of column heading in cgi-bin hourglass-who-all

Fixed lack of underline in blank private clocks for hourglass-who-all

2007-06-18

Increased cmdline to 256 bytes (in hgdrive, decl file)

2007-06-14

Fixed enable/disable

2007-06-12

Fixed: pids sid

2007-05-29

Added code to chmod /dev/hourglass

2007-05-21

Added code to report CMDLINE for HTML output

HourGlass for HP-UX Reference Manual

37

2007-05-10

Logging working again

Released for internal testing.

2007-05-07

Itanium version, cloned from 64-bit PA version.

------------------ first IA version above here --------------

2007-04-03 A7A

Fresh compile

2006-08-09 A6F

Debugging some cmdline & cmdname stuff.

2006-08-08 A6E

Added hgcr_cmdline.

2006-08-05 A6D

Revised ucomm/cmd. Not compatible with prior versions.

2006-08-04 A6C

Removed all pre-64 bit support.

2006-08-04 A6B

Changed to use si_hg_maxpid instead of si_maxpid.

2006-07-28 A6A

Fixed hgdrive to not trace hgdrive_ioctl

2005-10-28 A5J

Fixed hgdrive to not use ca_exitfunc

2005-10-20 A5H

Added caexit to flags for enable/disable

2005-10-18 A5G

Enabled debugging at startup in hgdrive.

2005-07-25 A4F

Changed to quietly allow 2005-05-25 (and 2005-07-25)

2005-05-25 A4E

Recompiled with non-expiring INTRINS/iX package

2004-09-26 A4D

First +ES1.Xindirect working version

2004-09-18 A4C

Fixed int overflow for too-big hpsusan

2004-09-17 A4B

New hgdrive

2004-09-14 A4A

Moved into separate directory from other versions

2003-09-06

ldba, stba added to driver

HourGlass for HP-UX Reference Manual

38

2003-06-19

Fixed panic in hgdrive for multi-CPU 11i systems

2003-06-07

Dummy for vPars testing (all code, but no wsio_install call)

2003-05-21 A3B

Deleted some startup tracing in hgdrive

2003-05-01 A3A

New security module (allegro "standard")

Added "SET DEMO"

2002-12-04 A2J

Minor change to security file stuff (to avoid "/private/" when

doing install) and to report expired date.

2002-11-01 A2H

2002-10-30 A2G

Fixed overflow in outer block when private clock is 12-31-2038.

Changed all internal use of seconds from int32/bit32 to longint.

2002-07-23 A2F

Minor change to help file pagination

2002-07-15 A2E

2002-07-14 ???

Minor changes to "TEST SIMPLE".

2002-06-26 A2D

Merged 64-bit stuff

*** not compatible with prior versions of kernel drive ***

2002-06-20 A2C

Minor change to WHO output to clean up summary report.

Added /opt/allegro/private/hglicens check.

Hopefully fixed "hit return to continue" prompt loop.

2002-03-22 A2B

Changed to allow license filename without a ".".

2002-03-10 A2A

Change to driver (for ldwa)

2001-11-26 A1E

Change to driver (to disable debug output)

Added info about why a process had hg_unknown.

2001-11-15 A1D

LOCKUNLOCK command (test)

Fixed problem where many commands thought maxpid was 0

2001-06-28 A1C

11i

2001-05-09 A1A

Recompiled.

HourGlass for HP-UX Reference Manual

39

2000-10-05 A0A

Fixed bounds violation when HPSUSAN is negative.