Hi,
I am running this script in pre-processing to change the field (source) of the alarm (net_connect) with existing IPs in the table (CM_COMPUTER_SYSTEM).
However, it presents this error:
Apr 20 17: 26: 11: 496 [6904] in: PREPROCESSOR ERROR: scripts / company \ db: 5: attempt to index global 'database' (a nil value)
Script:
hostname = event.hostname
database.open ("provider = nis, driver = none; database = none")
rs = database.query ("SELECT [name], [ip] FROM [CA_UIM]. [dbo]. [CM_COMPUTER_SYSTEM] WHERE [name] = '" ..hostname .. "'")
for i = 1, # rs
ip = (rs [i] .IP)
event.source = ip
return event
end
database.Close ()
If I run the script it makes the query perfectly. But when used in pre-processing does not work.
NOTE: Using profile AO, I can only add IP in custom's field. The hostname field or source, can not be changed.
What am I doing wrong?
Thank you.