Giter Site home page Giter Site logo

tracer's Introduction

Fedora RedHat Python Emacs

I am a computer nerd (read software engineer) way too much interested in Emacs, RPM packaging ecosystem, and Free software (as in freedom) in general.


Fedora

Emacs

Other


FrostyX's GitHub stats

GitHub Streak


Latest YouTube Videos

Copr CLI - Submitting BuildsCopr CLI - Submitting Builds Copr CLI - Project ManagementCopr CLI - Project Management Copr CLI - AuthenticationCopr CLI - Authentication


If you like my work, feel free to buy me a coffee.

Buy Me A Coffee

tracer's People

Contributors

blueperil avatar conan-kudo avatar dcampano avatar elyscape avatar ferdnyc avatar frostyx avatar gholms avatar gsauthof avatar ignatenkobrain avatar jelly avatar jenskuehnel avatar jturel avatar marusak avatar pabs3 avatar sbernhard avatar sean797 avatar tingping avatar uniontech-lilinjie avatar xsuchy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tracer's Issues

Implement and document exit codes for use with scripts

I just started looking into using Tracer in conjunction with my update script. I noticed a shortcoming which I hope can be addressed in a future release ...

Tracer does not appear to have any documented exit codes which could be used by an update script for the purpose of informing the user when it is necessary to log-off or reboot a system. I would suggest something along the lines of the following ...
0 -- no logoff or reboot is necessary (returned if no software needs to be restarted)
1 -- logoff is necessary (returned if at least one piece of software needs to be restarted, and none require a reboot)
2 -- reboot is necessary (returned if at least one piece of software requires a reboot)

There could be a lot more exit codes if you wanted to be more specific, but I think these would cover most use cases.

tracer invocation fails with uid not found: 93

I get the same traceback from Tracer when its invoked from the command line as well as using the DNF plugin:

$ rpm -q tracer dnf-plugin-tracer
tracer-0.5.6-1.fc21.noarch
dnf-plugin-tracer-0.5.6-1.fc21.noarch

$ sudo tracer
[sudo] password for michel: 
Traceback (most recent call last):
  File "/bin/tracer", line 34, in <module>
    tracer.main.run()
  File "/usr/lib/python2.7/site-packages/tracer/main.py", line 42, in run
    return router.dispatch()
  File "/usr/lib/python2.7/site-packages/tracer/resources/router.py", line 54, in dispatch
    controller = DefaultController(self.args, self.packages)
  File "/usr/lib/python2.7/site-packages/tracer/controllers/default.py", line 45, in __init__
    self.applications = self.tracer.trace_affected(self._user(args.user))
  File "/usr/lib/python2.7/site-packages/tracer/resources/tracer.py", line 73, in trace_affected
    memory = Memory.dump_memory(user)
  File "/usr/lib/python2.7/site-packages/tracer/resources/memory.py", line 36, in dump_memory
    for process in Processes.all().owned_by(user).unique():
  File "/usr/lib/python2.7/site-packages/tracer/resources/collections.py", line 65, in owned_by
    return self.filtered(lambda process: process.username == user)
  File "/usr/lib/python2.7/site-packages/tracer/resources/collections.py", line 81, in filtered
    if function(process):
  File "/usr/lib/python2.7/site-packages/tracer/resources/collections.py", line 65, in <lambda>
    return self.filtered(lambda process: process.username == user)
  File "/usr/lib64/python2.7/site-packages/psutil/__init__.py", line 441, in username
    return pwd.getpwuid(self.uids.real).pw_name
KeyError: 'getpwuid(): uid not found: 93'

tracer doesn't recognize postfix

Running current tracer on CentOS 7 after a openssl update yields the following output:

# tracer -e
You should restart:
* Some applications using:
  systemctl restart NetworkManager
  systemctl restart cups
  systemctl restart firewalld
  systemctl restart libvirtd
  systemctl restart nginx
  systemctl restart sshd
  systemctl restart tuned

* These applications manually:
  master
  qmgr
  tlsmgr

The last 3 processes are part of postfix, thus my expectation is that tracer would just print

systemctl restart postfix

instead.

And indeed, after restarting all the mentioned services plus postfix another tracer -e reports nothing.

This is with the git head of tracer. Tracer from EPEL is currently at 0.6.12 and that version also misses cups.

TB when db is locked

  1. run dnf upgrade in one terminal
  2. while it runs, execute:
# tracer systemd

Traceback (most recent call last):
  File "/usr/bin/tracer", line 183, in <module>
    main()
  File "/usr/bin/tracer", line 56, in main
    processes = ProcessesList(tracer.trace_running(_user(args.user)))
  File "/usr/lib/python2.7/site-packages/tracer/resources/tracer.py", line 70, in trace_running
    packages = self.specified_packages if self.specified_packages and self._now else self._modified_packages()
  File "/usr/lib/python2.7/site-packages/tracer/resources/tracer.py", line 53, in _modified_packages
    packages = self._PACKAGE_MANAGER.packages_newer_than(psutil.BOOT_TIME)
  File "/usr/lib/python2.7/site-packages/tracer/packageManagers/rpm.py", line 57, in packages_newer_than
    for tran in self._transactions_newer_than(unix_time):
  File "/usr/lib/python2.7/site-packages/tracer/packageManagers/rpm.py", line 120, in _transactions_newer_than
    cursor.execute(sql, [unix_time])
sqlite3.OperationalError: database is locked

Tracer should print some user friendly error.

Tracer crashes with parsing error

/usr/lib/python2.7/site-packages/bs4/init.py:166: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

To get rid of this warning, change this:

BeautifulSoup([your markup])

to this:

BeautifulSoup([your markup], "lxml")

markup_type=markup_type))

Please visit https://github.com/FrostyX/tracer/issues and submit the issue. Thank you
We apologize for any inconvenience

TypeError: 'instancemethod' object has no attribute '__getitem__' when not correctly args

$ sudo tracer -ea
Traceback (most recent call last):
  File "/bin/tracer", line 34, in <module>
    tracer.main.run()
  File "/usr/lib/python2.7/site-packages/tracer/main.py", line 42, in run
    return router.dispatch()
  File "/usr/lib/python2.7/site-packages/tracer/resources/router.py", line 54, in dispatch
    controller = DefaultController(self.args, self.packages)
  File "/usr/lib/python2.7/site-packages/tracer/controllers/default.py", line 45, in __init__
    self.applications = self.tracer.trace_affected(self._user(args.user))
  File "/usr/lib/python2.7/site-packages/tracer/resources/tracer.py", line 73, in trace_affected
    memory = Memory.dump_memory(user)
  File "/usr/lib/python2.7/site-packages/tracer/resources/memory.py", line 38, in dump_memory
    for file in process.files:
  File "/usr/lib/python2.7/site-packages/tracer/resources/processes.py", line 60, in files
    for arg in self.cmdline[1:]:
TypeError: 'instancemethod' object has no attribute '__getitem__'

Traceback due to missing process

I received this traceback during a dnf run. Thanks!

Traceback (most recent call last):
File "/bin/tracer", line 34, in
tracer.main.run()
File "/usr/lib/python2.7/site-packages/tracer/main.py", line 42, in run
return router.dispatch()
File "/usr/lib/python2.7/site-packages/tracer/resources/router.py", line 55, in dispatch
controller = DefaultController(self.args, self.packages)
File "/usr/lib/python2.7/site-packages/tracer/controllers/default.py", line 61, in init
self.applications = self.tracer.trace_affected(self._user(args.user))
File "/usr/lib/python2.7/site-packages/tracer/resources/tracer.py", line 107, in trace_affected
p = self._apply_rules(p)
File "/usr/lib/python2.7/site-packages/tracer/resources/tracer.py", line 120, in _apply_rules
parent = process.parent()
File "/usr/lib/python2.7/site-packages/tracer/resources/processes.py", line 142, in parent
if self.ppid():
File "/usr/lib/python2.7/site-packages/tracer/resources/processes.py", line 76, in ppid
return self._attr("ppid")
File "/usr/lib/python2.7/site-packages/tracer/resources/processes.py", line 93, in _attr
try: return attr()
File "/usr/lib64/python2.7/site-packages/psutil/init.py", line 480, in ppid
return self._proc.ppid()
File "/usr/lib64/python2.7/site-packages/psutil/_pslinux.py", line 706, in wrapper
raise NoSuchProcess(self.pid, self._name)
psutil.NoSuchProcess: process no longer exists (pid=24685)

Please visit https://github.com/FrostyX/tracer/issues and submit the issue. Thank you
We apologize for any inconvenience
Complete!

-r / --root option not working

[root@localhost ~]# tracer -r
[root@localhost ~]# tracer --root
[root@localhost ~]# tracer -u root
You should restart:

  • Some applications using:
    sudo service NetworkManager restart
    sudo service abrtd restart
    sudo service accounts-daemon restart
    sudo service lightdm restart
    sudo service systemd-journald restart
    sudo service systemd-logind restart
    sudo service systemd-udevd restart
  • These applications manually:
    Xorg
    cupsd
    lvmetad
    rsyslogd
    sd-pam
    systemd

Additionally to those process above, there are:

  • 3 processes requiring reboot

python-psutil-3.1.1-1.fc24.x86_64 breaks tracer

On upgrading to python-psutil-3.1.1-1.fc24.x86_64:

Tracer:
Program 'tracer' crashed with following error:

b'Traceback (most recent call last):\n File "/bin/tracer", line 34, in \n tracer.main.run()\n File "/usr/lib/python2.7/site-packages/tracer/main.py", line 42, in run\n return router.dispatch()\n File "/usr/lib/python2.7/site-packages/tracer/resources/router.py", line 54, in dispatch\n from tracer.controllers.default import DefaultController\n File "/usr/lib/python2.7/site-packages/tracer/controllers/default.py", line 20, in \n from tracer.views.default import DefaultView\n File "/usr/lib/python2.7/site-packages/tracer/views/default.py", line 6, in \n from tracer.resources.applications import Applications\n File "/usr/lib/python2.7/site-packages/tracer/resources/applications.py", line 24, in \n from tracer.resources.collections import ApplicationsCollection\n File "/usr/lib/python2.7/site-packages/tracer/resources/collections.py", line 22, in \n from psutil import NoSuchProcess\n File "/usr/lib64/python2.7/site-packages/psutil/init.py", line 62, in \n from . import _pslinux as _psplatform\n File "/usr/lib64/python2.7/site-packages/psutil/_pslinux.py", line 23, in \n from . import _psutil_linux as cext\nImportError: cannot import name _psutil_linux\n'
Please visit https://github.com/FrostyX/tracer/issues and submit the issue. Thank you
We apologize for any inconvenience
Complete!

some files use path;number

tracer -n kde-plasma-nm.x86_64
shows nothing for me. Even when I am using this applet.

Can it be because:

# lsof |grep /usr/lib64/kde4/kded_networkmanagement.so
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/501/gvfs
      Output information may be incomplete.
kded4     1868        msuchy  DEL       REG              253,1                197306 /usr/lib64/kde4/kded_networkmanagement.so;53c7cd86
QProcessM 1868 1882   msuchy  DEL       REG              253,1                197306 /usr/lib64/kde4/kded_networkmanagement.so;53c7cd86
gdbus     1868 1917   msuchy  DEL       REG              253,1                197306 /usr/lib64/kde4/kded_networkmanagement.so;53c7cd86
QInotifyF 1868 1921   msuchy  DEL       REG              253,1                197306 /usr/lib64/kde4/kded_networkmanagement.so;53c7cd86

? I'm not sure what the number after semicolon means.

$PID variable in helpers

I have process:

konqueror --preload

Which can be easily killed and does not need to be restarted again, it would be nice if I can write rule:

<app name="konqueror --preload" helper="kill $PID">

where $PID would be substituted by real PID before printing.

Postfix services arent reconised

The output below shows applications master, pickup & qmgr these are all recognised as "Package: postfix". https://github.com/FrostyX/tracer/blob/master/tracer/resources/applications.py#L196 checks for a service file named my the app 'name'. If this fails we chould also check for a service named the same as the package. In this case /usr/lib/systemd/system/postfix.service
I guess we could also define them these in applications.xml but the above seems like a better solution to me?

[root@centos7-katello-client tracer]# tracer -ei
You should restart:
[1] NetworkManager
[2] goferd
[3] master
[4] pickup
[5] qmgr
[6] sshd
[7] tuned

Press application number for help or 'q' to quit
--> 3
* master
    Package:     postfix
    Description: Postfix Mail Transport Agent
    Type:        Application
    State:       master has been started by root 1 hours ago. PID - 1258
--> 4
* pickup
    Package:     postfix
    Description: Postfix Mail Transport Agent
    Type:        Application
    State:       pickup has been started by postfix 1 hours ago. PID - 1275
--> 5
* qmgr
    Package:     postfix
    Description: Postfix Mail Transport Agent
    Type:        Application
    State:       qmgr has been started by postfix 1 hours ago. PID - 1276

ProcessWrapper's `name` property doesn't work with old psutil

Its because psutil.Process's name calls redefined cmdline method instead of original property.

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "tracer/resources/processes.py", line 51, in name
    return self._attr("name")
  File "tracer/resources/processes.py", line 69, in _attr
    attr = getattr(super(ProcessWrapper, self), name)
  File "/usr/lib/python2.7/site-packages/psutil/_common.py", line 84, in __get__
    ret = self.func(instance)
  File "/usr/lib/python2.7/site-packages/psutil/__init__.py", line 356, in name
    extended_name = os.path.basename(cmdline[0])
TypeError: 'instancemethod' object has no attribute '__getitem__'

One-off `dnf erase tracer` traceback

After erasing tracer there is one-off traceback

Traceback (most recent call last):
  File "/bin/dnf", line 36, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 200, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 83, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 140, in _main
    ret = resolving(cli, base)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 184, in resolving
    base.plugins.run_transaction()
  File "/usr/lib/python2.7/site-packages/dnf/plugin.py", line 82, in fn
    dnf.util.mapall(operator.methodcaller(method), self.plugins)
  File "/usr/lib/python2.7/site-packages/dnf/util.py", line 139, in mapall
    return list(map(fn, *seq))
  File "/usr/lib/python2.7/site-packages/dnf-plugins/tracer.py", line 52, in transaction
  File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Unknown or unsupported linux distribution: rhel (v0.6.8)

This is on a Scientific Linux 7.2 box:

# tracer
You are running unsupported linux distribution

Please visit https://github.com/FrostyX/tracer/issues
and create new issue called 'Unknown or unsupported linux distribution: rhel (v0.6.8)' if there isn't such.

I tried to setup "rhel" -> yum, but now I just get:

PYTHONPATH=build/lib/ build/scripts-2.7/tracer
Traceback (most recent call last):
  File "build/scripts-2.7/tracer", line 34, in <module>
    tracer.main.run()
  File "/export/home/orion/fedora/tracer/tracer/build/lib/tracer/main.py", line 42, in run
    return router.dispatch()
  File "/export/home/orion/fedora/tracer/tracer/build/lib/tracer/resources/router.py", line 52, in dispatch
    controller = DefaultController(self.args, self.packages)
  File "/export/home/orion/fedora/tracer/tracer/build/lib/tracer/controllers/default.py", line 50, in __init__
    System.package_manager(erased=args.erased),
  File "/export/home/orion/fedora/tracer/tracer/build/lib/tracer/resources/system.py", line 81, in package_manager
    return PackageManager(*list(map(get_instance, managers[distro])))
  File "/export/home/orion/fedora/tracer/tracer/build/lib/tracer/resources/system.py", line 62, in get_instance
    return getattr(module, name)(**kwargs)
AttributeError: 'module' object has no attribute 'Yum'

Tracer confused by deleted file

Tracer suggest me to manually restart plugin-container (which is flash-plugin to Firefox), which according the rule should transition to Firefox.

When I manualy started tracer -iat 1413404315.07 and select plugin-container option. I got:

--> 39
error: file /usr/lib64/firefox/plugin-container.#prelink#.N3n7Rk: No such file or directory
* plugin-container
    Package:     plugin-container is not provided by any package
    State:       plugin-container has been started by mirek 11 hours ago. PID - 5237

and

$ lsof | grep lugin-container
plugin-co  5237          mirek  txt       REG                8,1      96480    2108839 /usr/lib64/firefox/plugin-container.#prelink#.N3n7Rk (deleted)
Chrome_Ch  5237  5238    mirek  txt       REG                8,1      96480    2108839 /usr/lib64/firefox/plugin-container.#prelink#.N3n7Rk (deleted)
plugin-co  5237  5242    mirek  txt       REG                8,1      96480    2108839 /usr/lib64/firefox/plugin-container.#prelink#.N3n7Rk (deleted)
plugin-co  5237  5243    mirek  txt       REG                8,1      96480    2108839 /usr/lib64/firefox/plugin-container.#prelink#.N3n7Rk (deleted)
plugin-co  5237  5244    mirek  txt       REG                8,1      96480    2108839 /usr/lib64/firefox/plugin-container.#prelink#.N3n7Rk (deleted)
plugin-co  5237  5245    mirek  txt       REG                8,1      96480    2108839 /usr/lib64/firefox/plugin-container.#prelink#.N3n7Rk (deleted)
plugin-co  5237  5247    mirek  txt       REG                8,1      96480    2108839 /usr/lib64/firefox/plugin-container.#prelink#.N3n7Rk (deleted)
plugin-co  5237  6728    mirek  txt       REG                8,1      96480    2108839 /usr/lib64/firefox/plugin-container.#prelink#.N3n7Rk (deleted)

Where PID 5237 is:

$ ps axf |grep 5237
 5237 ?        Sl     8:17  |   \_ /usr/lib64/firefox/plugin-container /usr/lib64/flash-plugin/libflashplayer.so -greomni /usr/lib64/firefox/omni.ja -appomni /usr/lib64/firefox/browser/omni.ja -appdir /usr/lib64/firefox/browser 4801 true plugin

So you should identify that it belong to firefox either from that pid, or by removing .#prelink#.<randomstuff> from file name before querying package manager or quering roles rules.

Error during documentation generation at build

After fixing the build-time dependencies in #47, I got the following errors on the documentation generation (note that the build succeeds despite this, but it would be really good if it didn't fail anymore).

[  406s] sphinx-build -b man -d build/doctrees   source build/man
[  408s] Running Sphinx v1.3.1
[  408s] making output directory...
[  408s] loading pickled environment... not yet created
[  408s] building [mo]: targets for 0 po files that are out of date
[  408s] building [man]: all manpages
[  408s] updating environment: 6 added, 0 changed, 0 removed
[  408s] reading sources... [ 16%] api
[  408s] reading sources... [ 33%] developer-guide
[  408s] reading sources... [ 50%] get-tracer
[  408s] reading sources... [ 66%] index
[  408s] reading sources... [ 83%] manpage
[  408s] reading sources... [100%] user-guide
[  408s] 
[  408s] /home/abuild/rpmbuild/BUILD/tracer-git/doc/source/api.rst:13: WARNING: autodoc: failed to import class u'Query' from module u'tracer.query'; the following exception was raised:
[  408s] Traceback (most recent call last):
[  408s]   File "/usr/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 385, in import_object
[  408s]     __import__(self.modname)
[  408s]   File "/home/abuild/rpmbuild/BUILD/tracer-git/tracer/query.py", line 19, in <module>
[  408s]     from tracer.resources.tracer import Tracer
[  408s]   File "/home/abuild/rpmbuild/BUILD/tracer-git/tracer/resources/tracer.py", line 27, in <module>
[  408s]     from tracer.resources.applications import Applications
[  408s]   File "/home/abuild/rpmbuild/BUILD/tracer-git/tracer/resources/applications.py", line 21, in <module>
[  408s]     from bs4 import BeautifulSoup, element
[  408s]   File "/usr/lib/python2.7/site-packages/bs4/__init__.py", line 30, in <module>
[  408s]     from .builder import builder_registry, ParserRejectedMarkup
[  408s]   File "/usr/lib/python2.7/site-packages/bs4/builder/__init__.py", line 4, in <module>
[  408s]     from bs4.element import (
[  408s]   File "/usr/lib/python2.7/site-packages/bs4/element.py", line 8, in <module>
[  408s]     from bs4.dammit import EntitySubstitution
[  408s]   File "/usr/lib/python2.7/site-packages/bs4/dammit.py", line 13, in <module>
[  408s]     from html.entities import codepoint2name
[  408s] ImportError: No module named html.entities
[  408s] /home/abuild/rpmbuild/BUILD/tracer-git/doc/source/api.rst:46: WARNING: autodoc: failed to import class u'Application' from module u'tracer.resources.applications'; the following exception was raised:
[  408s] Traceback (most recent call last):
[  408s]   File "/usr/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 385, in import_object
[  408s]     __import__(self.modname)
[  408s]   File "/home/abuild/rpmbuild/BUILD/tracer-git/tracer/resources/applications.py", line 21, in <module>
[  408s]     from bs4 import BeautifulSoup, element
[  408s]   File "/usr/lib/python2.7/site-packages/bs4/__init__.py", line 30, in <module>
[  408s]     from .builder import builder_registry, ParserRejectedMarkup
[  408s]   File "/usr/lib/python2.7/site-packages/bs4/builder/__init__.py", line 4, in <module>
[  408s]     from bs4.element import (
[  408s]   File "/usr/lib/python2.7/site-packages/bs4/element.py", line 8, in <module>
[  408s]     from bs4.dammit import EntitySubstitution
[  408s]   File "/usr/lib/python2.7/site-packages/bs4/dammit.py", line 13, in <module>
[  408s]     from html.entities import codepoint2name
[  408s] ImportError: No module named html.entities
[  408s] looking for now-outdated files... none found
[  408s] pickling environment... done
[  408s] checking consistency... done
[  408s] writing... tracer.8 { } 
[  408s] build succeeded, 2 warnings.
[  409s] 
[  409s] Build finished. The manual pages are in build/man.

However, if I switch tracer to build with Python 3 (and thus switch all the BuildRequires and Requires to their Python 3 counterparts), this goes away and everything generates cleanly. Now this is great if you're using Python 3, but tracer currently is set up as a Python 2 application.

It would be great if this worked properly even on Python 2, if it was within your power.

Unknown or unsupported linux distribution: ol (v0.6.12)

This is on Oracle Linux 7.3 -- it is Redhat-based using Yum so I'm sure it can be supported.

[root@fplab-util-02 ~]# grep . /etc/*release
/etc/oracle-release:Oracle Linux Server release 7.3
/etc/os-release:NAME="Oracle Linux Server"
/etc/os-release:VERSION="7.3"
/etc/os-release:ID="ol"
/etc/os-release:VERSION_ID="7.3"
/etc/os-release:PRETTY_NAME="Oracle Linux Server 7.3"
/etc/os-release:ANSI_COLOR="0;31"
/etc/os-release:CPE_NAME="cpe:/o:oracle:linux:7:3:server"
/etc/os-release:HOME_URL="https://linux.oracle.com/"
/etc/os-release:BUG_REPORT_URL="https://bugzilla.oracle.com/"
/etc/os-release:ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"
/etc/os-release:ORACLE_BUGZILLA_PRODUCT_VERSION=7.3
/etc/os-release:ORACLE_SUPPORT_PRODUCT="Oracle Linux"
/etc/os-release:ORACLE_SUPPORT_PRODUCT_VERSION=7.3
/etc/redhat-release:Red Hat Enterprise Linux Server release 7.3 (Maipo)
/etc/system-release:Oracle Linux Server release 7.3
[root@fplab-util-02 ~]# /sbin/katello-tracer-upload
Traceback (most recent call last):
File "/sbin/katello-tracer-upload", line 13, in
main()
File "/sbin/katello-tracer-upload", line 10, in main
tracer_upload.upload_tracer_profile()
File "/usr/lib/yum-plugins/tracer_upload.py", line 56, in upload_tracer_profile
data = json.dumps({ "traces": get_apps(conduit) })
File "/usr/lib/yum-plugins/tracer_upload.py", line 47, in get_apps
for app in query_apps(conduit):
File "/usr/lib/yum-plugins/tracer_upload.py", line 22, in query_apps
query = Query()
File "/usr/lib/python2.7/site-packages/tracer/query.py", line 44, in init
self._tracer = tracer(System.package_manager(), Rules, Applications, dump_memory)
File "/usr/lib/python2.7/site-packages/tracer/resources/tracer.py", line 65, in init
raise UnsupportedDistribution(System.distribution())
tracer.resources.exceptions.UnsupportedDistribution: You are running unsupported linux distribution

Please visit https://github.com/FrostyX/tracer/issues
and create new issue called 'Unknown or unsupported linux distribution: ol (v0.6.12)' if there isn't such.

Don't you have an GitHub account? Please report this issue on [email protected]

Do not automatically assume 'sudo'

I got after upgrade:

  * Some applications using:
      sudo kdeinit4
      sudo akonadictl restart
      sudo dropbox stop; dropbox start

This is incorrect. This must be run as user who owns that process. I would suggest to change it to:

  * User "mirek" can restart some application using:
      kdeinit4
      akonadictl restart
      dropbox stop; dropbox start

tracer -s firefox fails with traceback: AttributeError: 'NoneType' object has no attribute 'files'

╔═[rsaw@xala 15:43 ~]
╚═══{1} $ sudo tracer -s terminator
* terminator
    Package:     terminator
    Description: Store and run multiple GNOME terminals in one window
    Type:        Application
    State:       terminator has been started by rsaw 5 minutes ago. PID - 21192
╔═[rsaw@xala 15:43 ~]
╚═══{0} $ sudo tracer -s firefox
Traceback (most recent call last):
  File "/bin/tracer", line 34, in <module>
    tracer.main.run()
  File "/usr/lib/python2.7/site-packages/tracer/main.py", line 42, in run
    return router.dispatch()
  File "/usr/lib/python2.7/site-packages/tracer/resources/router.py", line 40, in dispatch
    controller.render()
  File "/usr/lib/python2.7/site-packages/tracer/controllers/helper.py", line 39, in render
    self.print_helper(app_name, self.args)
  File "/usr/lib/python2.7/site-packages/tracer/controllers/helper.py", line 54, in print_helper
    try: affected_by = tr.trace_application(app_name)
  File "/usr/lib/python2.7/site-packages/tracer/resources/tracer.py", line 130, in trace_application
    processes.update(self._affecting_children(process, packages))
  File "/usr/lib/python2.7/site-packages/tracer/resources/tracer.py", line 162, in _affecting_children
    processes.update(self._affecting_processes(child, packages))
  File "/usr/lib/python2.7/site-packages/tracer/resources/tracer.py", line 135, in _affecting_processes
    process_files = process.files
  File "/usr/lib/python2.7/site-packages/tracer/resources/processes.py", line 83, in __getattr__
    return getattr(self._process, item)
AttributeError: 'NoneType' object has no attribute 'files'

Affected by - duplicated package names

There should be unique packages at the top level of Affected by section

sudo tracer -vs chrome
* chrome
    Package:     www-client/chromium
    ...

    Affected by:
        chromium
        chrome-sandbox (3512)
            chromium
        chromium
        chromium
        chromium

Tracer sometimes throws NoSuchProcess

Tracer sometimes throws psutil._error.NoSuchProcess: process no longer exists (pid=27186). Its random and very infrequently.

$[FrostyX  ~]-> sudo tracer -ae --helpers
Traceback (most recent call last):
  File "/usr/local/bin/tracer", line 34, in <module>
    tracer.main.run()
  File "/home/frostyx/Dropbox/bakalarka/git/tracer/tracer/main.py", line 42, in run
    return router.dispatch()
  File "/home/frostyx/Dropbox/bakalarka/git/tracer/tracer/resources/router.py", line 54, in dispatch
    controller = DefaultController(self.args, self.packages)
  File "/home/frostyx/Dropbox/bakalarka/git/tracer/tracer/controllers/default.py", line 41, in __init__
    self.applications = self.tracer.trace_affected(self._user(args.user))
  File "/home/frostyx/Dropbox/bakalarka/git/tracer/tracer/resources/tracer.py", line 73, in trace_affected
    memory = Memory.dump_memory(user)
  File "/home/frostyx/Dropbox/bakalarka/git/tracer/tracer/resources/memory.py", line 36, in dump_memory
    for process in Processes.all().owned_by(user).unique():
  File "/home/frostyx/Dropbox/bakalarka/git/tracer/tracer/resources/collections.py", line 71, in unique
    return ProcessesCollection(set(self))
  File "/home/frostyx/Dropbox/bakalarka/git/tracer/tracer/resources/processes.py", line 49, in __hash__
    return hash(self.name)
  File "/usr/lib/python2.7/site-packages/psutil/_common.py", line 85, in __get__
    ret = self.func(instance)
  File "/usr/lib/python2.7/site-packages/psutil/__init__.py", line 345, in name
    name = self._platform_impl.get_process_name()
  File "/usr/lib/python2.7/site-packages/psutil/_pslinux.py", line 470, in wrapper
    raise NoSuchProcess(self.pid, self._process_name)
psutil._error.NoSuchProcess: process no longer exists (pid=27186)

Broken indentation in -vvs <app_name>

There is broken indentation of processes in tracer -vvs <app_name> command. See

 Affected by:
    trayer (3420)
        dev-libs/glib
        /usr/lib/libgio.so
        /usr/lib/libgmodule.so
        dev-libs/atk
        /usr/lib/libatk.so
        dunst (3426)                           <-- Here
        dev-libs/glib
            /usr/lib/libgio.so
            /usr/lib/libgmodule.so
        dev-libs/libxdg-basedir
            /usr/lib/libxdg-basedir.so
        dolphin (7713)                         <-- And here, ...

sort name of apps

After upgrade I got:

  * These applications manually:
      seapplet
      korgac
      firefox
      akonadi_agent_launcher
      kwalletmanager
      bluedevil-monolithic
      akonadi_mailfilter_agent
      polkit-kde-authentication-agent-1
      akonadi_archivemail_agent
      systemd
      pulseaudio
      kgpg
      konversation
      akonadi_followupreminder_agent
      tracker-store
      sd-pam
      kmix
      akonadi_newmailnotifier_agent
      klipper
      akonadi_migration_agent
      krunner
      ksmserver
      konsole
      akonadi_notes_agent
      tracker-miner-user-guides
      tracker-miner-apps
      ssh-agent
      abrt-applet
      tracker-extract
      konqueror
      plugin-container
      akonadi_maildispatcher_agent
      thunderbird
      akonadi_sendlater_agent
      su
      akonadi_baloo_indexer

It would be nice if those apps are sorted alphabetically.

When re-run modified application - tracer finds it again

There is an example with mpd package on Gentoo

$[FrostyX  ~]-> emerge mpd
>>> ...
>>> Emerging (1 of 1) media-sound/mpd-0.17.6
>>> Installing (1 of 1) media-sound/mpd-0.17.6
>>> ...

$[FrostyX  ~]-> tracer
media-sound/mpd

$[FrostyX  ~]-> /etc/init.d/mpd stop
 * Caching service dependencies ...                     [ ok ]
 * Stopping Music Player Daemon ...                     [ ok ]

$[FrostyX  ~]-> tracer
dev-lang/php

$[FrostyX  ~]-> /etc/init.d/mpd start
 * Starting Music Player Daemon ...                     [ ok ]

$[FrostyX  ~]-> tracer
media-sound/mpd                                  # It shouldn't be there

$[FrostyX  ~]-> 

Wording

I still find the first sentence in this paragraph confusing:

Please note that:
  - 7 processes requires restarting your session (i.e. Logging out & Logging in again)
  - 2 processes requires reboot

I would suggest to change it to:

Additionally to those process above, there are:

TypeError: a float is required

$ sudo tracer --show-resource=processes
Swipe your right index finger across the fingerprint reader
PID       Time running        User                Process   
----------------------------------------------------------------------------------------------------
sudoTraceback (most recent call last):
  File "/bin/tracer", line 34, in <module>
    tracer.main.run()
  File "/usr/lib/python2.7/site-packages/tracer/main.py", line 42, in run
    return router.dispatch()
  File "/usr/lib/python2.7/site-packages/tracer/resources/router.py", line 51, in dispatch
    controller.render()
  File "/usr/lib/python2.7/site-packages/tracer/controllers/resource.py", line 47, in render
    if   r == 'processes':    self.render_processes()
  File "/usr/lib/python2.7/site-packages/tracer/controllers/resource.py", line 56, in render_processes
    view.render()
  File "/usr/lib/python2.7/site-packages/tracer/views/resource/processes.py", line 10, in render
    print line.format(process.pid, process.str_started_ago, process.username, process.name)
  File "/usr/lib/python2.7/site-packages/tracer/resources/processes.py", line 96, in str_started_ago
    started = datetime.datetime.fromtimestamp(self.create_time)
TypeError: a float is required

Open SSH sessions are recognised incorrectly

Open SSH sessions are recognised as requiring restart sshd. Open sessions should be recongnised as "session" type imo

[root@centos7-katello-client tracer]# tracer -e
You should restart:
  * Some applications using:
      sudo systemctl restart sshd

  * These applications manually:
      dhclient
      master
      pickup
      qmgr
[root@centos7-katello-client tracer]# sudo systemctl restart sshd
[root@centos7-katello-client tracer]# tracer -e
You should restart:
  * Some applications using:
      sudo systemctl restart sshd

  * These applications manually:
      dhclient
      master
      pickup
      qmgr
[root@centos7-katello-client tracer]# ps -ef | grep 3149
root      3149     1  0 04:48 ?        00:00:00 sshd: vagrant [priv]
vagrant   3152  3149  0 04:48 ?        00:00:00 sshd: vagrant@pts/0
root      4332  3465  0 07:35 pts/0    00:00:00 grep --color=auto 3149
[root@centos7-katello-client tracer]# 

ValueError: substring not found

# tracer systemd-libs
Traceback (most recent call last):
  File "/usr/local/bin/tracer", line 183, in <module>
    main()
  File "/usr/local/bin/tracer", line 56, in main
    processes = ProcessesList(tracer.trace_running(_user(args.user)))
  File "/home/msuchy/projects/tracer/tracer/resources/tracer.py", line 77, in trace_running
    file = Memory._filename_without_version(file)
  File "/home/msuchy/projects/tracer/tracer/resources/memory.py", line 147, in _filename_without_version
    slash = file.rindex('/')
ValueError: substring not found

goferd service not recognised

Gofer service doesn't seem to be recognised as a service.

[root@centos7-katello-client tracer]# tracer -ie
You should restart:
[1] dhclient
[2] master
[3] python
[4] qmgr
[5] rhsmd
[6] sshd
[7] tuned

Press application number for help or 'q' to quit
--> 3
* python
    Package:     gofer
    Description: A lightweight, extensible python agent
    Type:        Application
    State:       python has been started by root 4 hours ago. PID - 728

-- Press <enter> to get list of applications --^C
[root@centos7-katello-client tracer]# ps -ef | grep 728
root       728     1  0 05:12 ?        00:00:16 python /usr/bin/goferd --foreground
root      3826  3501  0 09:44 pts/0    00:00:00 grep --color=auto 728
[root@centos7-katello-client tracer]# rpm -ql gofer| grep service
/usr/lib/systemd/system/goferd.service
[root@centos7-katello-client tracer]#

Steps to reproduce on el7:

yum update -y http://fedorapeople.org/groups/katello/releases/yum/3.1/client/RHEL/7Server/x86_64/katello-client-repos-latest.rpm
yum install katello-agent -y
systemctl start goferd
yum downgrade openssl openssl-libs -y

Helpers of session or static apps in default view with `-a`

Tracer prints default helper for session and static applications in default view. See You will have to log out & log in again in the output. It should be printed just application name instead.

$[FrostyX  ~]-> sudo tracer -a
You should restart:
  * Some applications using:
      sudo service mpd restart
      ...
      You will have to log out & log in again

  * These applications manually:
      ...

Formating of process detail in Tracer

In Tracer, when I hit detail of process I get:

Press application number for help or 'q' to quit
--> 1
* seapplet
    Package:     setroubleshoot
    Description: Helps troubleshoot SELinux problems
    Type:        Application
    State:       seapplet has been started by mirek 11 hours ago. PID - 5021

-- Press enter to get list of applications --

I am little confused. What is the actuall process? I would suggest to change it to:

Press application number for help or 'q' to quit
--> 1
* Process: /usr/bin/seapplet
    Package:     setroubleshoot
    Description: Helps troubleshoot SELinux problems
    Type:        Application
    State:       seapplet has been started by mirek 11 hours ago. PID - 5021

-- Press enter to get list of applications --

Dnf raises `LockedDatabase` even if it's not

No package manager is running

[frostyx@localhost tracer]$ ps ax |grep yum
 1458 pts/1    S+     0:00 grep --color=auto yum

[frostyx@localhost tracer]$ ps ax |grep dnf
 1460 pts/1    S+     0:00 grep --color=auto dnf

but package_newer_than(...) from Dnf module prints that database is locked

>>> from tracer.packageManagers.dnf import Dnf
>>> dnf = Dnf()
>>> dnf.packages_newer_than(0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "tracer/packageManagers/rpm.py", line 72, in packages_newer_than
    raise LockedDatabase()
tracer.resources.exceptions.LockedDatabase: Package database is locked by another process

Even through this fail, tracer works.

Option to restart applications if method known

For machines that run automatic security updates, it would be useful if tracer were configurable to execute service restarts for daemons it knows about. This could be enabled by a command line switch, or a configuration file for the dnf-plugin (with white listing of particular packages).

Not sure if this is a function you see tracer fulfilling, but I might hack on it a bit if I find some time.

Different application uses modified files

Theorem

Let A and B are packages. Suppose A is running and uses files from B. B is stopped. When B is updated, tracer prints B needs restarting. That is wrong, cause A needs restarting (not B).

Proof

$[FrostyX  bin]-> sudo tracer

$[FrostyX  bin]-> sudo /etc/init.d/apache2 start
 * Starting apache2 ...                                                 [ ok ]

$[FrostyX  bin]-> sudo /etc/init.d/postgresql-9.3 start
 * Starting PostgreSQL ...                                              [ ok ]

$[FrostyX  bin]-> sudo emerge dev-db/postgresql-base
...
Calculating dependencies... done!
[ebuild   R    ] dev-db/postgresql-base-9.3.2:9.3 ... 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

>>> Verifying ebuild manifests
>>> Emerging (1 of 1) dev-db/postgresql-base-9.3.2
>>> Installing (1 of 1) dev-db/postgresql-base-9.3.2
>>> Jobs: 1 of 1 complete                           Load avg: 3.51, 2.73, 2.02
>>> Auto-cleaning packages...


$[FrostyX  bin]-> sudo /etc/init.d/postgresql-9.3 stop
 * Stopping PostgreSQL (this can take up to 92 seconds) ...
 * RUDE_QUIT enabled.                                                   [ ok ]

$[FrostyX  bin]-> sudo tracer
dev-db/postgresql-base

$[FrostyX  bin]-> sudo /etc/init.d/apache2 stop
 * Stopping apache2 ...                                                 [ ok ]

$[FrostyX  bin]-> sudo tracer
$[FrostyX  bin]-> 

In this example, www-servers/apache2 should be printed instead of dev-db/postgresql-base.

Ctrl+C invoke traceback

Run

tracer -i

and select some number (get detail about application). And hit Ctrl+C. Traceback will appear.

-- Press enter to get list of applications --^CTraceback (most recent call last):
  File "/usr/bin/tracer", line 34, in <module>
    tracer.main.run()
  File "/usr/lib/python2.7/site-packages/tracer/main.py", line 43, in run
    return router.dispatch()
  File "/usr/lib/python2.7/site-packages/tracer/resources/router.py", line 54, in dispatch
    controller.render_interactive()
  File "/usr/lib/python2.7/site-packages/tracer/controllers/default.py", line 82, in render_interactive
    raw_input("\n" + _("press_enter"))
KeyboardInterrupt

It would be nice if KeyboardInterrupt can be silently passed at top level.

`tracer -s mpd` prints that mpd is from media-libs/libmpdclient

On Gentoo, there is in helper for mpd

* mpd   
    Package:     media-libs/libmpdclient
    Description: A library for interfacing Music Player Daemon (media-sound/mpd)
    Type:        Daemon
    ...

tracer prints that mpd is from media-libs/libmpdclient instead of media-sound/mpd.

should report that reboot is necessary for new kernels

Tracer does not report that a reboot is necessary after updating only kernel packages. This is presumably because kernel packages are marked installonly -- perhaps a special condition should be triggered for kernel packages to indicate that a reboot is needed, or perhaps users should be warned if any installonly package is installed (I don't know if any others exist besides for kernel).

polkitd not mentioned and doesn't really require reboot

Recently, a tracer -e yielded the following output on a CentOS 7 system (after a yum update):

# tracer -e
You should restart:
There are:
  - 1 processes requiring reboot

There is arguably room for improvement:

  • The You should restart: part could be left out, because it is empty
  • the 1 processes message could dynamically change singular/plural such that it is grammatically correct
  • the most important information is missing: the name of the process that requires the reboot!

Calling repeatedly tracer -u user for all active users shows that the above message is causes by polkitd:

# tracer -u polkitd
You should restart:
There are:
  - 1 processes requiring reboot
# systemctl restart polkit.service 
PolicyKit daemon disconnected from the bus.
We are no longer a registered authentication agent.
PolicyKit daemon reconnected to bus.
Attempting to re-register as an authentication agent.
# tracer -u polkitd               
# tracer -e
# 

This also shows that a reboot isn't really necessary.

Expected behavior: tracer explicitly lists policykitd and the corresponding systemctl restart command; if tracer identifies a process as requiring a reboot then it also includes its name

DNF plugin recommends something even when `Nothing to do`

DNF plugin recommends to restart some applications even when

[jkadlcik]$ sudo dnf upgrade
Last metadata expiration check performed 0:35:18 ago on Wed Jul  1 17:05:11 2015.
Dependencies resolved.
Nothing to do.

The reason is that no transaction is created when nothing to do, so tracer probably uses packages from the previous transaction.

Solution: Do not run tracer at all when nothing to do

PS: It may be bug in DNF API which provides info about actual transaction (that, it gives info about previous transaction when nothing to do).

Traceback report: list index out of range

I encountered a traceback with the dnf tracer plugin, here's the error message

b'Traceback (most recent call last):
  File "/bin/tracer", line 34, in <module>
    tracer.main.run()
  File "/usr/lib/python3.5/site-packages/tracer/main.py", line 45, in run
    return router.dispatch()
  File "/usr/lib/python3.5/site-packages/tracer/resources/router.py", line 58, in dispatch
    controller.render()
  File "/usr/lib/python3.5/site-packages/tracer/controllers/default.py", line 71, in render
    view.render()
  File "/usr/lib/python3.5/site-packages/tracer/views/default.py", line 60, in render
    {"title": "  * " + _("These applications manually:"), "content": without_helpers_content()},
  File "/usr/lib/python3.5/site-packages/tracer/views/default.py", line 30, in without_helpers_content
    apps = self.args.applications.exclude_types(Applications.TYPES["ERASED"]).without_helpers().sorted("name")
  File "/usr/lib/python3.5/site-packages/tracer/resources/collections.py", line 42, in without_helpers
    return ApplicationsCollection(applications)
  File "/usr/lib/python3.5/site-packages/tracer/resources/collections.py", line 41, in <lambda>
    applications = filter(lambda app: not app.helper, self)
  File "/usr/lib/python3.5/site-packages/tracer/resources/applications.py", line 201, in helper
    helper = self._attributes["helper"] if self._attributes["helper"] else Applications._helper(self)
  File "/usr/lib/python3.5/site-packages/tracer/resources/applications.py", line 118, in _helper
    if app.type == Applications.TYPES["DAEMON"]:
  File "/usr/lib/python3.5/site-packages/tracer/resources/applications.py", line 192, in type
    return Applications.TYPES["DAEMON"] if self.has_service_file else self._attributes["type"]
  File "/usr/lib/python3.5/site-packages/tracer/resources/applications.py", line 196, in has_service_file
    return os.path.isfile("/usr/lib/systemd/system/{0}.service".format(self.name))
  File "/usr/lib/python3.5/site-packages/tracer/resources/applications.py", line 252, in name
    if self.is_interpreted:
  File "/usr/lib/python3.5/site-packages/tracer/resources/applications.py", line 188, in is_interpreted
    return self.instances and self.instances[0].is_interpreted
IndexError: list index out of range
'
Bitte besuchen Siehttps://github.com/FrostyX/tracer/issues and submit the issue. Thank you
Wir bitten, die Unannehmlichkeiten zu entschuldigen

(\n -> line break replaced)

Unfortunately, I cannot track down the cause of this.

Application called httpd is not running

# tracer -s httpd
Application called httpd is not running

but

# ps axf |grep httpd
 1097 ?        Ss     0:00 /usr/sbin/httpd -DFOREGROUND
 1426 ?        S      0:00  \_ /usr/sbin/httpd -DFOREGROUND
 1427 ?        S      0:00  \_ /usr/sbin/httpd -DFOREGROUND
 1428 ?        S      0:00  \_ /usr/sbin/httpd -DFOREGROUND
 1429 ?        S      0:00  \_ /usr/sbin/httpd -DFOREGROUND
 1430 ?        S      0:00  \_ /usr/sbin/httpd -DFOREGROUND

why?

Interactive mode doesn't work on python3

Interactive mode doesn't work on python3 because there is no raw_input.

Possible solution:

try:
    input = raw_input
except NameError:
    pass

and use input in the code`.

tracer's `Process` has no attribute files on psutil-3.1

>>> from tracer.resources.processes import Process
>>> x = Process(1)
>>> x.name
<bound method Process.name of <tracer.resources.processes.Process object at 0x7efc647f88d0>>
>>> x.files
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "tracer/resources/processes.py", line 89, in __getattr__
    return getattr(self._process, item)
AttributeError: 'Process' object has no attribute 'files'

This example works fine on psutil-2.x

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.