org.freedesktop.Problems

org.freedesktop.Problems — The Problems Service manages all the crashes.

Synopsis

Methods

NewProblem (IN Dict<String,String> problem_data,
 OUT String problem_id);
 
GetProblems (OUT Array<String> response);
 
GetForeignProblems (OUT Array<String> response);
 
GetAllProblems (OUT Array<String> response);
 
GetInfo (IN String problem_dir,
 IN Array<String> element_names,
 OUT Dict<String,String> response);
 
SetElement (IN String problem_dir,
 IN String name,
 IN String value);
 
DeleteElement (IN String problem_dir,
 IN String name);
 
ChownProblemDir (IN String problem_dir);
 
DeleteProblem (IN Array<String> problem_dir);
 
FindProblemByElementInTimeRange (IN String element,
 IN String value,
 IN Int64 timestamp_from,
 IN Int64 timestamp_to,
 IN Boolean all_users,
 OUT Array<String> response);
 
Quit (void); 
 

Signals

Crash (OUT String package,
 OUT String problem_id,
 OUT String uid,
 OUT String uuid,
 OUT String duphash);
 

Methods

org.freedesktop.Problems.NewProblem

NewProblem (IN Dict<String,String> problem_data,
 OUT String problem_id);
 

Creates a new problem and returns it's identifier.

Example 2.1. How to create a new problems in Python


#!/usr/bin/env python
import dbus

bus = dbus.SystemBus()

proxy = bus.get_object("org.freedesktop.problems",
                                  '/org/freedesktop/problems')

problems = dbus.Interface(proxy, dbus_interface='org.freedesktop.problems')

description = {"analyzer"    : "libreport",
               "reason"      : "Application has been killed",
               "backtrace"   : "die()",
               "executable"  : "/usr/bin/foo"}

problems.NewProblem(description)

                        


Example 2.2. How to create a new problems in Bash


#!/usr/bin/bash
dbus-send --system --type=method_call --print-reply \
          --dest=org.freedesktop.problems /org/freedesktop/problems \
          org.freedesktop.problems.NewProblem \
          dict:string:string:analyzer,libreport,reason,"Application has been killed",backtrace,"die()",executable,"/usr/bin/true"

                        


problem_data

A dictionary describing problem. There are few commonly recognized fields but the dictionary can hold anything you need.

analyzer

This field should be always present. The field defines a type of problem. If the item is not provided, libreport string is used by default.

reason

This field should contain a short human readable text describing the problem.

time

This field is filled automaticaly.

uid

Only a user with root priviledges can pass this field. For all other users the field is filled by caller's uid.

executable

This is mandatory field and must contain a valid path to an executable.

component

A name of package which a problematic application belongs to. If this field is provided, the executable field becomes optional.

uuid

Machine readable identifier of a kind of the problem. ABRT uses this field for local duplicates searching.

duphash

Machine readable identifier of a kind of the problem. ABRT uses this field for global duplicates searching.

problem_id

An indentifier of the new problem

org.freedesktop.Problems.GetProblems

GetProblems (OUT Array<String> response);
 

Gets a list of problem identifiers for problems visible by the caller.

Example 2.3. How to get the list of problems in Python


#!/usr/bin/env python
import dbus

bus = dbus.SystemBus()

proxy = bus.get_object("org.freedesktop.problems",
                                  '/org/freedesktop/problems')

problems = dbus.Interface(proxy, dbus_interface='org.freedesktop.problems')
prblms = problems.GetProblems()

                        


response

List of problem identifiers

org.freedesktop.Problems.GetForeignProblems

GetForeignProblems (OUT Array<String> response);
 

Gets a list of problem identifiers for problems not directly accessible by the caller.

response

List of problem identifiers

org.freedesktop.Problems.GetAllProblems

GetAllProblems (OUT Array<String> response);
 

Gets a list of problems visible by the caller.

response

List of problem identifiers

org.freedesktop.Problems.GetInfo

GetInfo (IN String problem_dir,
 IN Array<String> element_names,
 OUT Dict<String,String> response);
 

Gets a value of problem's element.

Example 2.4. How to use GetInfo() method to print out a nice list of problems


#!/usr/bin/env python
from sys import stdout
import dbus
from datetime import datetime

bus = dbus.SystemBus()

proxy = bus.get_object("org.freedesktop.problems",
                          '/org/freedesktop/problems')

problems = dbus.Interface(proxy, dbus_interface='org.freedesktop.problems')

for prblmid in problems.GetProblems():
    kv = problems.GetInfo(prblmid, ["time", "count", "package", "reason"])

    date = datetime.fromtimestamp(float(kv["time"]))
    count = int(kv.get("count", 0))
    package = str(kv.get("package", ""))
    reason = str(kv.get("reason", ""))

    stdout.write("{0} {1:-3} {2:30} : {3}\n".format(date, count, package, reason))

                        


problem_dir

Identifier of problem from which we want to get info.

element_names

A list of names of required info.

response

A list of values of the requested elements.

org.freedesktop.Problems.SetElement

SetElement (IN String problem_dir,
 IN String name,
 IN String value);
 

Sets a value of problem's element.

problem_dir

An identifier of problem.

name

A name of set element.

value

A value of problem's element.

org.freedesktop.Problems.DeleteElement

DeleteElement (IN String problem_dir,
 IN String name);
 

Deletes problem's element.

problem_dir

An identifier of problem.

name

A name of deleted element.

org.freedesktop.Problems.ChownProblemDir

ChownProblemDir (IN String problem_dir);
 

Assures ownership of a specified problem for the caller.

problem_dir

An indetifier of the problem.

org.freedesktop.Problems.DeleteProblem

DeleteProblem (IN Array<String> problem_dir);
 

Deletes a specified problem.

problem_dir

An identifier of problem to be deleted.

org.freedesktop.Problems.FindProblemByElementInTimeRange

FindProblemByElementInTimeRange (IN String element,
 IN String value,
 IN Int64 timestamp_from,
 IN Int64 timestamp_to,
 IN Boolean all_users,
 OUT Array<String> response);
 

Finds an problem having an element's value and has been created in specified time range.

element

A name of searched element.

value

A value of the searched element.

timestamp_from

Beginnig of required time range.

timestamp_to

End of required time range.

all_users

Perform a look up in all system problems.

response

List of problem idnetifiers.

org.freedesktop.Problems.Quit

Quit (void); 
 

Kills the service.

Signals

org.freedesktop.Problems.Crash

Crash (OUT String package,
 OUT String problem_id,
 OUT String uid,
 OUT String uuid,
 OUT String duphash);
 

A new system problem has been detected. This is the second variant of the Crash signal with additional argument uid

package

List of problem idnetifiers.

problem_id

An identifier of the newly created problem.

uid

UID of user who reported this problem.

uuid

UUID - a weak problem identifier usuful for local duplicates look up.

duphash

DUPHASH - a strong problem identifier usuful for global duplicates look up.