org.freedesktop.Problems
org.freedesktop.Problems — The Problems Service manages all the crashes.
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); |
TestElementExists
( | IN String problem_dir, |
| IN String name, | |
OUT Boolean response); |
GetProblemData
( | IN String problem_dir, |
OUT Dict<String,Int32> problem_data); |
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); |
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.
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.
This field should contain a short human readable text describing the problem.
This field is filled automaticaly.
Only a user with root priviledges can pass this field. For all other users the field is filled by caller's uid.
This is mandatory field and must contain a valid path to an executable.
A name of package which a problematic application belongs to. If this field is provided, the executable field becomes optional.
Machine readable identifier of a kind of the problem. ABRT uses this field for local duplicates searching.
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.TestElementExists
TestElementExists
( | IN String problem_dir, |
| IN String name, | |
OUT Boolean response); |
Checks whether the element exists.
problem_dir
An identifier of problem.
name
A name of checked element.
response
True if the element exists; otherwise false.
org.freedesktop.Problems.GetProblemData
GetProblemData
( | IN String problem_dir, |
OUT Dict<String,Int32> problem_data); |
Returns problem's data.
problem_dir
An identifier of problem.
problem_data
A dictionary where keys are element names and values are triplets (element libreport flags, element size, element contents).
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.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.