File: README.adoc

package info (click to toggle)
nut 2.8.4%2Breally-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,720 kB
  • sloc: ansic: 132,030; sh: 17,256; cpp: 12,566; makefile: 5,646; python: 1,114; perl: 856; xml: 47
file content (66 lines) | stat: -rw-r--r-- 2,801 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Python NUT Client files
-----------------------

This directory contains various NUT Client related Python scripts, written
by David Goncalves, and released under GPL v3.

module
~~~~~~

This directory contains `PyNUT.py`, which is a Python abstraction class to
access NUT data server(s). You can use it in Python programs to access NUT's
`upsd` data server in a simple way, without having to know the NUT protocol.

The same module should work for Python 2 and Python 3.

To import it into Python programs you have to use the following line (case
sensitive):

    import PyNUT

This module provides a `(PyNUT.)PyNUTClient` class that can be used to connect
and get data from an `upsd` data server.

To install the `PyNUT` module on Debian/Ubuntu, copy it to:
`/usr/share/python-support/python-pynut/`

For quick tests, just make sure its directory is exported in `PYTHONPATH`
environment variable.

This directory also contains `test_nutclient.py`, which is a `PyNUT` test program
and it also serves as a code example. For this to be fully functional, you will
need to adapt the login, password and upsname to fit your configuration.
A NUT data server should be running for the test program to verify connection
and protocol support.

For one practical example, you can research `tests/NIT/nit.sh` in NUT sources.

app
~~~

This directory contains the `NUT-Monitor` UI application, which uses the
`PyNUT` class, along with its own resources.

NOTE: Do not mistake it for `nut-monitor` service for the `upsmon` client in
some distributions' NUT packaging.

There are three closely related separate implementations, for Python 2 with GTK2
and for Python 3 with Qt5 and Qt6. Either can be installed at the same time, if 
your distribution has not yet outlawed the obsolete Python 2 interpreters.

To install it, you will either need to keep the files together, or to install:

- Depending on the Python version(s) your system has, put `NUT-Monitor-py2gtk2`
  and/or `NUT-Monitor-py3qt5` and/or `NUT-Monitor-py3qt6` to `/usr/bin/`, 
  `/usr/X11R6/bin/` or something like that (optionally making a simple `NUT-Monitor`
  symlink the preferred implementation version or using the provided wrapper script),
- `ui/*.glade` (for `NUT-Monitor-py2gtk2`) or `ui/*.ui` (for `NUT-Monitor-py3qt5` or
  `NUT-Monitor-py3qt6`) files to `/usr/share/nut-monitor/`,
- `nut-monitor.png` to something like `/usr/share/pixmaps/`,
- finally, `nut-monitor-py2gtk2.desktop` and/or `nut-monitor-py3qt5.desktop`
  and/or `nut-monitor-py3qt6.desktop` (optionally symlinked as `nut-monitor.desktop`)
  to `/usr/share/applications/`

The `PyNUT` module can be kept nearby, or must be installed as a "site" or
"vendor" provided script into your Python modules location. See the wrapper
scripts of the app for more technical details.