[INUG-Users] Tally field value populated as 0

Alex Greenbank agreenbank at uk.ibm.com
Mon Jan 4 08:08:39 EST 2010


Hello,

users-bounces at netcoolusers.org wrote on 04/01/2010 10:39:40:
> Hi All,
> 
> It is observed that for some of the alarms, the tally field is 
> getting populated as 0 instead of 1.
> 
> I generated the alarm manually to confirm the value of tally field:
> 
> insert into alerts.status(Node,NodeAlias,Class,Grade,Severity,
> Summary,Identifier)
> values 
('TestNode','TestNodeAlias',6150,5,5,'Test1','TestNodeTestNodeAlias');
> 
> It was observed that the Tally field automatically gets populated by
> 1, which is the normal behaviour.
> 
> Please let me know how can the Tally be populated as 0 and any 
> solutions to fix this issue.

It's probably an event being generated by Impact which connects as
a GATEWAY and, therefore, the Tally field is accepted as is.

The 'new row' trigger looks like this:-

create or replace trigger new_row
group default_triggers
priority 1
comment 'Set default values for new alerts in ALERTS.STATUS'
before insert on alerts.status
for each row
begin
        if ( %user.is_gateway = false )
        then
              set new.Tally = 1;
              set new.ServerName = getservername();
        end if;
        set new.StateChange = getdate();
        set new.InternalLast = getdate();

        if( new.ServerSerial = 0 )
        then
                set new.ServerSerial = new.Serial;
        end if;

end;
go

Notice the Tally setting code is within a check for a Gateway. If
it's inserted as a Gateway then the Tally field is not modified at
all, if it's not provided with the insert then it'll default to 0.

The easiest fix is to make sure the Tally is set to 1 when inserted
by Impact. A trickier fix is to make Impact connect as something
other than a GATEWAY to avoid this, but I'm not up to date on Impact
setup.

You could also add a clause to the new_row trigger to do:-

        if ( %user.is_gateway = false )
        then
              set new.Tally = 1;
              set new.ServerName = getservername();
        end if;
        -- new bit start
        if ( new.Tally = 0 )
        then
              set new.Tally = 1;
        end if;
        -- new bit end
        set new.StateChange = getdate();

To force Tally to be 1 if it has not been set.

Ta,

-Alex 





Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU








More information about the Users mailing list