Zum Ende der Metadaten springen
Zum Anfang der Metadaten

Notifications are stored in an SQLite database and should only be accessed by the provided notification functions. 

Set test notifications

Use these simple code snippets in a Perl (.pl) script to use notify and notify_ext. Place the script in your plugin directory.

notify
#!/usr/bin/perl
use LoxBerry::Log;
$LoxBerry::Log::DEBUG = 1; # Outputs more info

my $package = $lbpplugindir;
my $group = "test";
my $message = "This is a test notification";
my $severity = 'err'; # comment out to set an info notification

notify ( $package, $group, $message, $severity);
notify_ext
#!/usr/bin/perl
use LoxBerry::Log;
$LoxBerry::Log::DEBUG = 1; # Outputs more info

my $package = $lbpplugindir;
my $group = "test";
my $message = "This is a test notification";
my $severity = 3; # 3 is error, 6 is info

my %notification = (
            PACKAGE => $package,
            NAME => $name,
            MESSAGE => $message,
            SEVERITY => $severity,
            someproperty => "Something",
            LOGFILE => "$lbpplugindir/system_tmpfs/apache2/error.log"
    );
my $status = LoxBerry::Log::notify_ext( \%notification );

View all notifications

There are two web tools integrated in LoxBerry to show current notifications:

showallnotifications

This will display notifications as users would see it on the screen, but without filters for package and name.

http://loxberry/admin/system/tools/showallnotifications.cgi

As the function get_notifications_html only returns notifications with severity 3 = error and 6 = info, no other severities are shown.

showrawnotifications

The RAW tool will show all notifications, without any filters for package, name and severity. It also displays notifications other than severity 3 = error and 6 = info, and shows all known attributes.

http://loxberry/admin/system/tools/showrawnotifications.cgi

Database

The database is located in $lbsdatadir/notifications_sqlite.dat

If you delete the file, it will be recreated on the next notification with it's initial settings. Additional to the notifications, you may loose notification settings or helper notifications (e.g. the last notified LoxBerry Update version).


  • Keine Stichwörter