Next Topic

Previous Topic

Book Contents

[InsertMessage]

$return_value = $obj->[InsertMessage](
[severity   => <"ok"|"warning"|"critical">,]
);

or,

$return_value = $obj->[InsertMessage]("free-form text to insert");

The first form of the method inserts a message specific for the specified device into the system for further processing. The second method forces the system to match the message against all configured regular expression patterns (ruleset). If there is a match, appropriate severity is set and actions are triggered.

See the the Message Handler for Traps and Logs chapter in the Traverse User Guide for explanations of the parameters and valid values for the first method.

Example: Connect, Log In, Insert Message, Log Out

The following example creates a connection to localhost (default port), logs in, inserts a message for the device with IP address 192.168.200.50 into the DGE database, and logs out.

use Zyrion qw(Message);
my $obj = new Zyrion::Message(Host=>"localhost");
my $return_value = $obj->
Login(User=>"ismuser",Password=>"fixme") \|\|
die "ERROR: ", $obj->[GetErrorMsg], "\n";
$obj->[InsertMessage](deviceName=>"my_server",
deviceAddr=>"192.168.200.50",
dateTime=>time,
severity=>'warning',
Message=>"this is a test") \|\|
print "ERROR: ", $obj->[GetErrorMsg], "\n";
$obj->Logout;