Welcome to Alignak-App’s documentation!¶
Documentation content:
Introduction¶
About Alignak¶
Alignak is an open source monitoring framework written in Python under the terms of the GNU Affero General Public License . It is a fork of the Shinken project.
More information about Alignak is available in the Alignak documentation.
About Alignak-App¶
The Alignak-App is an open source Applet in system tray, written in Python. It is available under the terms of the GNU Affero General Public License .
This application is intended to be used within the Alignak project, it connects to the Alignak backend and allows you to be notified directly on your workstation. You will be able to view the states of the hosts and the services that you have defined in your installation.
Features¶
Alignak-App has many features:
- Multi-platfom: Linux / Windows
- Receive Alignak notifications inside application
- Spy host: choose to monitor multiple hosts and receive their states
- Search Hosts and Services, acknowledge problems, schedule downtimes and more
- Many configurations
- Links to your Alignak WebUI from the menus
Release cycle¶
“App” has no strict schedule for releasing.
Other features will come in the next versions and you can propose new features through project issues. Each feature is discussed in a separate issue.
Alignak-app Installers¶
Requirements¶
Alignak Suite¶
You must have Alignak Suite installed before using this app :
Alignak-app need at least a functionnal and available alignak-backend to connect with it !
Python 3¶
You must have Python 3 installed on your system. Only the Windows installer does not need to install Python 3.
Installation (Windows)¶
An installer is available in repository of Alignak-app on releases page. It is recommended that you use this installer to run Alignak-app on Windows.
You have nothing else to install if you are using the installer !
IMPORTANT: To keep it free, installer is not signed, so Windows Defender SmartScreen will warn you about that. Just click on “More Informations” and on “Execute anyway” to run installer.
IMPORTANT: This installer is currently only compatible with x64 architecture !
You can also buid your own Windows installer (on develop branch for example), see Alignak-app Installers for more information.
However, you can install the application in the same way as under Linux, but this will require you to keep a window open for Python.
Installation (Linux)¶
You can install Alignak-app like other python libraries, with pip3
:
pip3 install alignak_app
The required Python modules are automatically installed, if not present on your system.
Installation (From Sources)¶
Clone and install¶
To install from source, clone repos and install with pip
git clone https://github.com/Alignak-monitoring-contrib/alignak-app
cd alignak-app
# If you're under Windows, use "pip" instead "pip3"
pip3 install .
External Libraries¶
You need to install Python modules that are listed in requirements.txt
file with pip:
requests pyqt5 configparser future alignak_backend_client python-gettext docopt
Under Windows¶
If you’ve installed Alignak-app with pip
under Windows, you must link install directory with your Program Files
folder. Otherwise, App won’t start.
Open a command Windows console as admin and type the following line:
mklink /J "%ProgramFiles%\Alignak-app" c:\Users\<USERNAME>\AppData\Roaming\Python\alignak_app
Replace <USERNAME>
by your username.
Be sure also that you’ve install Python3 on your device.
Windows Setup¶
For releases, a setup is generated for Windows and is available for download. For the version under development, you have to do it yourself.
Requirements¶
Obviously, you must clone the Alignak-app repository, on the develop branch before.
Like that you’ll have the last fixes. Normally, we try to have a branch develop
as stable as possible.
Python and requirements¶
You have to install Python 3.5 in any case.
Then the requirements of Alignak-app . Otherwize, pyinstaller will not have the required .dll for compilation. All is available on Pypi:
# In repository folder
pip install -r requirements.txt --user
Once done, you’ll normally have your python modules installed in:
"%APPDATA%\Python\Python35\"
Then install pyinstaller.
Pyinstaller¶
The module pyinstaller
is also available on Pypi. So just run the following command:
pip install pyinstaller --user
Normally, pyinstaller.exe command will be available under:
"%APPDATA%\Python\Python35\Scripts\"
And will be added to your PATH variable. If it is not the case, you can add this folder to your PATH without problem, you will definitely need it for other python libraries.
Inno Setup¶
Inno Setup is a free installer for Windows. It is very powerful and allows to create and customize installers quite easily.
To install Inno Setup, just download the last unicode version on Official download page.
Be sure to choose unicode version !
And simply run it with values as default.
Create Setup¶
To create your own setup, you’ll find scripts in bin\win
folder of repository.
There is also images, a redistribuable for Windows (needed for old versions of Windows) and 2 script files.
The first one is pyinstaller_app.bat
.
Before running it, check the --paths
arguments.
Normally, you’ll have just to change the repository folder (line 13).
Be sure to put absolute paths !
The others are normally the sames on your device. If pyinstaller does not find the PyQt dll, check these paths.
Then run the .bat. This script will generate an alignak-app.exe
in dist folder. Don’t move it !
After, simply open the Inno Setup file alignak-app-win-setup.iss
. You can change ShortVersion if you want, but normally these digits are same as current develop.
And then, compile the file with CTRL+F9
or from menu Build->Compile
.
This will generate an installer inside the dist\setup
folder.
Your installer is ready !
You can then uninstall the python libraries if necessary, your Setup will no longer use them. All the libraries you need are compressed into the executable.
Configuration¶
Environment Variables¶
During installation, Alignak-app creates some folders that contains all the files application need to run. Then she will keep them in environment variables.
The application will normally automatically detect the folders used by the application and use environment variables for this purpose.
ALIGNAKAPP_USR_DIR
: this folder is used by application for read thesettings.cfg
file . By default, Alignak-app will log also in this directory.ALIGNAKAPP_APP_DIR
: this folder is used by application for readimages.ini
file,style.css
and get images. This variable is normally equal to the ROOT folder described above. Be careful if you define this variable yourself!ALIGNAKAPP_LOG_DIR
: this folder is used to create the log file of Alignak-app.
During Windows installation, if you used Installer, these variables are automatically filled.
On Linux¶
Alignak-app will try to create ALIGNAKAPP_USR_DIR
for later configurations. By default this folder should be:
/$HOME/.local/alignak_app/
The ALIGNAKAPP_APP_DIR
should be under one of the following folders and is create by pip during installation:
/$HOME/.local/alignak_app/
/usr/local/alignak_app/
On Windows¶
On Windows, use Installer is recommended (see Alignak-app Installers) to respect Windows conventions.
ALIGNAKAPP_USR_DIR
and ALIGNAKAPP_APP_DIR
variables are by default set to:
C:\Program Files\Alignak-app\
If you install by pip
under Windows, you may need to define these variables yourself !
And ALIGNAKAPP_USR_DIR
and ALIGNAKAPP_APP_DIR
variables should be by default set to:
C:\Users\user\AppData\Roaming\Python\alignak_app\
Settings File¶
Before running application, you must configure it.
You will find a settings.cfg
file located in the ALIGNAKAPP_USR_DIR
folder cited above.
This file contains Sections who are introduced by a [section_name]
header. Then, it contains name = value
entries.
All parameters are also explained in file. For the boolean parameters, you can use the following values: on/off, true/false or 1/0.
The most significant Section is [Alignak]. You’ll need set your backend url and ports. Otherwise, Alignak-app proposes to define your server Alignak and its port via the window login.
To Know: Without connection on Backend of Alignak, App won’t start !
Proxy Settings¶
If you have a proxy on your network, you can set it in settings.cfg
file, as well as the name and password of the proxy.
In case you use the login window, you will have a button dedicated to the proxy settings.
You can also set proxy in environment variables. Alignak backend client will manage these variables alone when connecting to the backend.
- For HTTP proxies, set
HTTP_PROXY
variable. - For HTTPS proxies, set
HTTPS_PROXY
variable.
For more informations, please read Requests documentation.
Connection to Backend¶
Alignak-app have a login form by default, who let you to connect with the username and password define in backend.
You can also set connection information in the settings.cfg
file:
- Recommended: leave empty “username” and “password”. Alignak-app will display a login Window.
- Recommended: set your token in “username” field and leave “password” empty (See below).
- Not recommended: set your “username” and your “password”. This method is less secure.
To obtain a token, open a python terminal and type the following commands:
import requests
backend_url = 'http://alignak.com:5000'
r = requests.post(
backend_url + '/login',
data={
'username': 'admin',
'password': 'admin'
}
)
print(r.text)
You can also visit: Alignak-backend : Get Token
File Example¶
Here is the full settings.cfg
file. This file contains comments for each setting.
[Alignak] ; Backend authentication ; ------------------------------------------------------------------------------------------ ; Credentials for your backend. ; 1/ Recommended: leave "username" and "password" empty. App will display a login Window. ; 2/ Recommended: set your token in "username" option and leave "password" empty. ; 3/ Not recommended: set your "username" and your "password". ; Read the alignak-app docs for more details on token and authentication, ; Or visit http://docs.alignak.net/projects/alignak-backend/en/latest/api.html#get-the-authentication-token ; The default values are empty. username = password = ; Alignak Url ; ------------------------------------------------------------------------------------------ ; Url of alignak server. ; Default is http://127.0.0.1 url = http://127.0.0.1 ; Backend url ; ------------------------------------------------------------------------------------------ ; The url of alignak Backend. ; Default is %(url)s:5000 backend = %(url)s:5000 ; Webui url ; ------------------------------------------------------------------------------------------ ; The url of alignak WebUI ; Default is %(url)s:80 webui = %(url)s:80 ; Web service url ; ------------------------------------------------------------------------------------------ ; The url of web service, usually set to port 8888 ; Default is empty webservice = ; Backend processes ; ------------------------------------------------------------------------------------------ ; The number of processes for connection to backend ; -!- Windows users must leave this parameter at 1 -!- ; Default is 1 processes = 1 ; Proxy address ; ------------------------------------------------------------------------------------------ ; Define proxy address for requests ; Format is: http(s)://proxy_address:port ; Default is empty proxy = ; Proxy user ; ------------------------------------------------------------------------------------------ ; Define corresponding proxy user. Only needed if you have a proxy. ; Default is empty proxy_user = ; Proxy password ; ------------------------------------------------------------------------------------------ ; Define corresponding proxy password. Only needed if you have a proxy. ; If "proxy_user" is set, a proxy login window will be automatically displayed. ; ! Setting password is less secure ! ; Default is empty proxy_password = [Alignak-app] ; Locale ; ------------------------------------------------------------------------------------------ ; Define language of App. Currently only "fr_FR", "en_US" are available. ; If empty, "en_US" will be used as default. ; Default is "en_US" locale = en_US ; Display at start ; ------------------------------------------------------------------------------------------ ; Defines whether the application is displayed or not, in full screen or minimized ; Default is "min". Available options are "no", "max", "min". display = min ; Problems at start ; ------------------------------------------------------------------------------------------ ; Defines if "Problems" tab is displayed by default at start ; Default is no. Set to "yes" to display "Problems" tab by default. problems = no ; Tab order ; ------------------------------------------------------------------------------------------ ; Defines order of App tabs: problems, host synthesis and spy. ; p = problems, h = host synthesis, s = spy, ; Default is p,h,s tab_order = p,h,s ; Requests interval ; ------------------------------------------------------------------------------------------ ; Define interval of App requests. App make regular requests ; Default is 20. Increase this settings can improve speed of App ; -!- Set this settings less than 5 is not recommended -!- requests_interval = 20 ; Notifications elapsed ; ------------------------------------------------------------------------------------------ ; Sets in minutes the time elapsed since notifications were triggered. ; Default is 20 notification_elapsed = 20 ; Notifications duration ; ------------------------------------------------------------------------------------------ ; Define duration of temporary notifications ; Default is 20 notification_duration = 30 ; Daemon freshness ; ------------------------------------------------------------------------------------------ ; Defines the refresh time (in minutes) that the alignak daemons should not exceed ; Default is 10 daemons_freshness = 10 ; Spy checks interval ; ------------------------------------------------------------------------------------------ ; Define checks interval in seconds for spied hosts to update spied events ; Default is 20 spy_interval = 20 ; Update Status widget (Dock) ; ------------------------------------------------------------------------------------------ ; Define in seconds the refresh of alignak daemon's status widget ; Default is 20 update_status = 20 ; Update Livestate widget (Dock) ; ------------------------------------------------------------------------------------------ ; Define in seconds the refresh of livestate widget ; Default is 20 update_livestate = 20 ; Update Dashboard widget (Top Panel) ; ------------------------------------------------------------------------------------------ ; Define in seconds the refresh time of dashboard widget ; Default is 20 update_dashboard = 20 ; Update Host widget (Host Synthesis tab) ; ------------------------------------------------------------------------------------------ ; Define in seconds the refresh time of host widget ; Default is 20 update_host = 20 ; Update Service widget (Host Synthesis tab) ; ------------------------------------------------------------------------------------------ ; Define in seconds the refresh time of service widget ; Default is 20 update_service = 20 ; Update Problems widget (Problems tab) ; ------------------------------------------------------------------------------------------ ; Define in seconds the refresh time of problems widget ; Default is 20 update_problems = 30 [Log] ; Log filename ; ------------------------------------------------------------------------------------------ ; Define name of file where logs of App will be stored. filename = alignakapp ; Log location ; ------------------------------------------------------------------------------------------ ; Set this value to define another directory. Path must be absolute ! ; Default is empty and apply following default values: ; Linux : $HOME/.local/alignak_app ; Windows: C:\ProgramData\Alignak-app location = ; Application Debug Mode ; ------------------------------------------------------------------------------------------ ; Activate Debug mode for Alignak-App to get more logs, when app unexpected stop ; Set to 'yes' or 'true' to activate "debug" mode ; Set to 'no' or 'false' to deactivate "debug" mode ; Default is 'no' debug = no
Run¶
Alignak-App Launcher¶
alignak-app-launcher command line interface:
Usage:
alignak-app-launcher [-h]
alignak-app-launcher [-s][--start]
alignak-app-launcher [-i][--install]
Options:
-h, --help Show this screen.
-s, --start Start Alignak-app in your current shell. (All platforms)
-i, --install Check installation folders and files. (All platforms)
Install a daemon file and autocompletion. (Linux only)
Daemon [alignak-app]:
Option "--install" will create a bin folder in your "$HOME", with a daemon file based on
the environment variables of your current session.
Then simply run "alignak-app start" to launch application.
Exit codes:
0 if required operation succeeded
22 if application detect an SSH session.
64 if command line parameters are not used correctly
Linux Daemon¶
If you have set environment variables for application, they will be added to the generated daemon script (see Configuration).
Here is the available commands for daemon:
Usage:
# Without parameters
alignak-app Displays the help message and configured environment variables.
# With parameters
alignak-app start Start Alignak-app daemon.
alignak-app stop Stop Alignak-app daemon.
alignak-app status Show status of daemon running.
alignak-app restart Stop and restart application.
Note: To generate a new daemon file with other environment, just run alignak-app-launcher --install
again with your new environment variables.
Windows Installer¶
If you used the installer provided in the repository or did you generate your own, just launch Alignak-app vX.x shorcut on your desktop.
All files have been installed in C:\Program Files\Alignak-app\
.
Interface¶
Login Window¶
If you have not set your configuration file, Alignak-app will display a login window by default. In this window, you’ll be able to:
- Configure your Alignak server (by clicking on server icon).
- Type your username and password to login.
Start¶
Once you’re connected, Alignak-app will start and show you a progress bar. Time to start will depend on your installation (a backend with a lot of host and services will take more time).
When Alignak-app has started, you’ll have:
- The Main Window of App, separated into two parts:
- The “App Dock” (Right part)
- The “App Panel” (Left part)
- A Tray Icon in your task bar. This icon gives you access to a menu with:
- Alignak-app menu, to view the app if it has been reduced
- About menu, to show informations of Alignak-app
- Reload menu, to reload your configuration.
Other menu will come in future versions.
App Dock (Right part)¶
When App is launched, the right part (called “dock”) will contains different buttons and some container who will receive different notifications.
Alignak¶
This part of dock contains informations about your connection to backend and the states of Alignak daemons. If you’ve some connection problems or if backend is restart, you’ll be notified here.
You can also see each daemon state by clicking on button with Alignak icon, if endpoint is available in backend.
Finally, you can see your profile by clicking on the button.
Livestate part¶
In the livestate part, you’ll see a resume of number of problems and items monitored in your backend.
Events part¶
This is one of the most interesting features of the application. You’ll receive many informations in this part like alignak notifications, acknowledge or modifications you do in App.
Events:
- If you want to remove an event, simply double click on it.
- Some events are temporary and remove themselves.
- Some events can be drag and drop (see below)
- Full events text can be see in tooltip when you keep mouse over.
Drag & Drop:
- Events from an host or a service can be drag and dropped in “Spied Hosts” tab.
- Events can also be moved to Host Synthesis view (Panel), to display host instantly.
App Panel (Left part)¶
The left part of application (called “Panel”), will display a Hosts Synthesis View. This is where you can see your monitored hosts and services.
Dashboard¶
At the top of this window, you will find a dashboard with the number of items, for each state (OK, CRITICAL, DOWN, ACKNOWLEDGED…).
Host Synthesis¶
Host View¶
Start typing the name of a host in the search bar and App will propose to you different corresponding names. When you select a host, its informations and the list of its services will be displayed.
Services¶
When a host is displayed, you will have the list of services, classified by aggregation. Click on one of them to display them.
If you click on a service, a summary of its status will be displayed on the right.
Actions¶
You will then be able to perform various actions such as seeing the details of each of its services, acknowledging a problem or planning a downtime for an item (service or host).
You will also have access to the host’s history. It may take a while to be available.
Another tab called “Problems” is used to display the problems listed by the backend (like a DOWN host or a CRITICAL service).
Problems¶
Problems tab will display problems found by Alignak-app in backend. This panel gathers hosts down, critical services or other issues.
- You’ll be able to acknowledge problems or trigger downtimes.
- You can choose to spy an host from any item.
- You can display host concerned in Host Synthesis view.
Spied Hosts¶
This is where you can find the list of hosts that you spy on.
- You can spy on as many hosts as you want.
- App will keep you informed about host state.
- When you select a spy host, App will show you the information it has collected.
- To stop spying on a host, just double click on it, host will be removed from list.
You can also drag & drop spied elements to display host instantly in Host Synthesis.
Architecture¶
Resume¶
This Python module is a desktop application, with a system tray icon, for Alignak solution.
Application notify you when you have changes in your monitoring. You can trigger actions inside application, see status of monitored items, problems to solved and many other things.
Architecture¶
Alignak-app works as follows:
- The
BackendClient
manage requests with Alignak backend. - The
ThreadManager
will launchBackendQThread(s)
to trigger requests inBackendClient
. - The
DataManager
will store data provided byBackendClient
inItems
. - The
QObjects
package display/update the data stored inDataManager
. - The
Utils
package contains settings, logs, installation,… - The
Locales
package contains translations. - The
Login
package manage user login if needed.
Alignak-app will use a system of Installer
who use environment variables to run:
ALIGNAKAPP_USR_DIR
: contains settings of user (write rights)ALIGNAKAPP_LOG_DIR
: contains log files of App (write rights)ALIGNAKAPP_APP_DIR
: contains binaries of App (images, css, languages) (read rights)
API¶
Main Class¶
Alignak App¶
Alignak App manages the creation of all objects and QObjects for the whole application:
- Creation of
AppProgressBar
until the Data Manager is ready - Creation of
AppQMainWindow
- Creation of standard python objects (settings, css, localization)
-
class
alignak_app.alignakapp.
AlignakApp
¶ Bases:
PyQt5.QtCore.QObject
Class who build Alignak-app QObjects, initialize configurations, systray icon and Thread Manager.
-
static
check_threads
()¶ Launch periodically threads
-
static
show_login_window
()¶ Show LoginQDialog window for user to login to backend
-
start
(username=None, password=None)¶ Start Alignak-app
-
static
-
class
alignak_app.alignakapp.
AppProgressBar
¶ Bases:
PyQt5.QtWidgets.QProgressBar
AppProgressBar in busy mode with text displayed at the center.
Backend¶
The Backend package contains classes to manage alignak data
Backend¶
Backend manage connection and access to Alignak backend. It also fill
DataManager
.
-
class
alignak_app.backend.backend.
BackendClient
¶ Bases:
object
Class who collect informations with Backend-Client and returns data for Alignak-App.
-
acknowledge
(item, sticky, notify, comment)¶ Prepare data for acknowledge and POST on backend API or WS if available
Parameters: Returns: request response
Return type:
-
downtime
(item, fixed, duration, start_stamp, end_stamp, comment)¶ Prepare data for downtime and POST on backend API or WS if available
Parameters: - item (alignak_app.items.host.Host | alignak_app.items.service.Service) – item to downtime: host | service
- fixed (bool) – define if donwtime is fixed or not
- duration (int) – duration timestamp of downtime
- start_stamp (int) – start timestamp of downtime
- end_stamp (int) – end timestamp of downtime
- comment (str) – comment of downtime
Returns: request response
Return type:
-
get
(endpoint, params=None, projection=None, all_items=False)¶ GET on alignak Backend REST API
Parameters: Returns: request response
Return type:
-
login
(username=None, password=None, proxies=None, check=False)¶ Connect to alignak backend
Parameters: Returns: True if connected or False if not
Return type:
-
patch
(endpoint, data, headers)¶ PATCH on alignak Backend REST API
Parameters: Returns: dictionary containing patch response from the backend
Return type:
-
post
(endpoint, data, headers=None)¶ POST on alignak Backend REST API
Parameters: Returns: response (creation information)
Return type:
-
query_alignakdaemons
()¶ Launch request on “alignakdaemon” endpoint
-
query_history
(hostname=None, host_id=None)¶ Launch request on “history” endpoint but only for hosts in “data_manager”
Parameters:
-
query_hosts
()¶ Launch request on “host” endpoint, add hosts in problems if needed
-
query_livesynthesis
()¶ Launch request on “livesynthesis” endpoint
-
query_notifications
()¶ Launch request on “history” endpoint. Only for ‘type’: ‘monitoring.notification’ and for current App user
-
query_realms
()¶ Launch a request on
realm
endpoint
-
query_services
(host_id=None)¶ Launch request for “service” endpoint. If
host_id
is given, only services related to host are added / updatedParameters: host_id (str) – “_id” of host
-
query_services_problems
(state)¶ Launch requests on “service” endpoint to get items with “ls_state = state”
Wanted states are:
WARNING
,CRITICAL
andUNKNOWN
Parameters: state (str) – state of service
-
query_timeperiods
()¶ Launch a request on
timeperiod
endpoint
-
query_user
()¶ Launch request on “user” endpoint. Only for current App user.
-
Data Manager¶
DataManager manage alignak data provided by
Client
.
database
fied contains all data collected by Appdb_is_ready
fied says to App if database has been filled or not (needed on start)old_notifications
fied store old notifications from backend to avoid sending them again
-
class
alignak_app.backend.datamanager.
DataManager
¶ Bases:
object
Class who store alignak data
-
get_all_hostnames
()¶ Collect and return all names of all hosts
Returns: all names of all hosts Return type: list
-
get_host_services
(host_id)¶ Return services corresponding to host ID
Parameters: host_id (str) – ‘_id’ of host Returns: services corresponding to host ID Return type: list
-
get_host_with_services
(host_field)¶ Returns the desired host and all its services
Parameters: host_field (str) – field of wanted host: host_id | name Returns: dict with host data and its associated services Return type: dict
-
get_item
(item_type, key, value=None)¶ Return the wanted item for item type who contain the value
Parameters: Returns: wanted item
Return type: alignak_app.items.item.*
-
get_items_and_problems
()¶ Return total of items and problems
Returns: dict of problem and total number for each item Return type: dict
-
get_period_name
(period)¶ Return the period name or alias
Parameters: period (str) – wanted period _id
Returns: the wanted realm alias or name if available Return type: str
-
get_problems
()¶ Update and return items who are in problem: hosts and services
Returns: dict of items in problem, and number for each type of item Return type: dict
-
get_realm_name
(realm)¶ Return the realm name or alias
Parameters: realm (str) – wanted realm _id
Returns: the wanted realm alias or name if available Return type: str
-
get_synthesis_count
()¶ Get on “synthesis” endpoint and return the states of hosts and services
Returns: states of hosts and services. Return type: dict
-
static
is_problem
(item_type, item_data)¶ Return True if item data is a problem, else return false. Only if item is monitored (checks are enabled).
Parameters: Returns: if item is a problem or not
Return type:
-
is_ready
()¶ Check if DataManager is filled and ready
Returns: if ready or current status Return type: str
-
remove_item
(item_type, key, value=None)¶ Remove the wanted item in “database[item_type]” who contain the “value” or “key”
Parameters:
-
update_database
(item_type, items_list)¶ Update an item type in database
Parameters: - item_type (str) – type of item to update
- items_list (list | dict) – list of items for the wanted type
-
update_item_data
(item_type, item_id, data)¶ Update a single item in database
Parameters:
-
update_problems
()¶ Update hosts and services in “problems” database
-
WS Client¶
WS Client manage connection and access to Alignak backend by the Web Service module. It will
also fill DataManager
in future versions.
-
class
alignak_app.backend.ws_client.
WSClient
¶ Bases:
object
Class who manage Web Service requests
-
get
(endpoint, params)¶ GET on alignak Backend Web Service
Parameters: - endpoint (str) – WS endpoint
- params (dict|None) – dict of parameters for the WS
Returns: request result
Return type:
-
Items¶
The Items package contains classes who create items who are stored in
DataManager
.
Item¶
Item is parent class for all items objects:
-
class
alignak_app.items.item.
Item
¶ Bases:
object
Class who create an item
-
create
(_id, data, name=None)¶ Create wanted item
Parameters:
-
static
get_check_text
(check_type)¶ Return text for check type :param check_type: type of check (
active_checks_enabled
orpassive_checks_enabled
) :type check_type: str :return: the corresponding text :rtype: str
-
-
alignak_app.items.item.
get_icon_name
(item_type, state, acknowledge, downtime, monitored)¶ Return icon for a host or a service item
Parameters: Returns: icon name for icon
Return type:
-
alignak_app.items.item.
get_icon_name_from_state
(item_type, state)¶ Return icon name from state for host or service
Parameters: Returns:
Daemon¶
Daemon manage creation of daemon item for backend alignakdaemon
endpoint
-
class
alignak_app.items.daemon.
Daemon
¶ Bases:
alignak_app.items.item.Item
Class who create a daemon item
-
create
(_id, data, name=None)¶ Create wanted item
Parameters:
-
static
get_check_text
(check_type)¶ Return text for check type :param check_type: type of check (
active_checks_enabled
orpassive_checks_enabled
) :type check_type: str :return: the corresponding text :rtype: str
-
static
get_daemons_names
()¶ Returns all the names of daemons
Returns: all the names of daemons Return type: list
-
static
get_daemons_status_icon
()¶ Return daemons status icon name
Returns: daemons status icon name Return type: str
-
static
get_request_model
()¶ Return the request model for alignakdaemon requests
Returns: request model for alignakdaemon endpoint Return type: dict
-
static
get_states
(status)¶ Return states of daemons or backend
Parameters: status (str) – status of item Returns: the status string Return type: str
-
Event¶
Event manage creation of event item (Notifications collected from history
endpoint)
-
class
alignak_app.items.event.
Event
¶ Bases:
alignak_app.items.item.Item
Class who create an event item
-
create
(_id, data, name=None)¶ Create wanted item
Parameters:
-
static
get_check_text
(check_type)¶ Return text for check type :param check_type: type of check (
active_checks_enabled
orpassive_checks_enabled
) :type check_type: str :return: the corresponding text :rtype: str
-
static
get_request_model
()¶ Return the request model for notification requests
Returns: request model for history endpoint (only for notifications) Return type: dict
-
History¶
History manage creation of history item for backend history
endpoint
-
class
alignak_app.items.history.
History
¶ Bases:
alignak_app.items.item.Item
Class who create a history item
-
create
(_id, data, name=None)¶ Create wanted item
Parameters:
-
static
get_check_text
(check_type)¶ Return text for check type :param check_type: type of check (
active_checks_enabled
orpassive_checks_enabled
) :type check_type: str :return: the corresponding text :rtype: str
-
static
get_history_icon_name
(message, event_type)¶ Return icon name related to message or event type
Parameters: Returns: icon name
Return type:
-
static
get_request_model
()¶ Return the request model for history requests
Returns: request model for history endpoint Return type: dict
-
Host¶
Host manage creation of host item for backend host
endpoint
-
class
alignak_app.items.host.
Host
¶ Bases:
alignak_app.items.item.Item
Class who create a host item
-
create
(_id, data, name=None)¶ Create wanted item
Parameters:
-
static
get_available_icons
()¶ Return list of available icons for a Host item
Returns: list of available icons for Host Return type: list
-
static
get_check_text
(check_type)¶ Return text for check type :param check_type: type of check (
active_checks_enabled
orpassive_checks_enabled
) :type check_type: str :return: the corresponding text :rtype: str
-
get_overall_tooltip
(services)¶ Return corresponding overall state tooltip depends of
_overall_state_id
of Host and its ServicesParameters: services (list) – list of Service items Returns: overall tooltip message Return type: str
-
static
get_request_model
()¶ Return the request model for host requests
Returns: request model for host endpoint Return type: dict
-
Live Synthesis¶
Live Synthesis manage creation of livesynthesis item for backend livesynthesis
endpoint
-
class
alignak_app.items.livesynthesis.
LiveSynthesis
¶ Bases:
alignak_app.items.item.Item
Class who create livesynthesis item
-
create
(_id, data, name=None)¶ Create wanted item
Parameters:
-
static
get_check_text
(check_type)¶ Return text for check type :param check_type: type of check (
active_checks_enabled
orpassive_checks_enabled
) :type check_type: str :return: the corresponding text :rtype: str
-
static
get_request_model
()¶ Return the request model for livesynthesis requests
Returns: request model for livesynthesis endpoint Return type: dict
-
static
get_synthesis_count_model
()¶ Return the synthesis count model
Returns: synthesis count model Return type: dict
-
Period¶
Period manage creation of period item for backend timeperiod
endpoint
-
class
alignak_app.items.period.
Period
¶ Bases:
alignak_app.items.item.Item
Class who create a period item
-
create
(_id, data, name=None)¶ Create wanted item
Parameters:
-
static
get_check_text
(check_type)¶ Return text for check type :param check_type: type of check (
active_checks_enabled
orpassive_checks_enabled
) :type check_type: str :return: the corresponding text :rtype: str
-
static
get_request_model
()¶ Return the request model for timeperiod requests
Returns: request model for timeperiod endpoint Return type: dict
-
Realm¶
Realm manage creation of realm item for backend realm
endpoint
-
class
alignak_app.items.realm.
Realm
¶ Bases:
alignak_app.items.item.Item
Class who create a realm item
-
create
(_id, data, name=None)¶ Create wanted item
Parameters:
-
static
get_check_text
(check_type)¶ Return text for check type :param check_type: type of check (
active_checks_enabled
orpassive_checks_enabled
) :type check_type: str :return: the corresponding text :rtype: str
-
static
get_request_model
()¶ Return the request model for realm requests
Returns: request model for realm endpoint Return type: dict
-
Service¶
Service manage creation of service item for backend service
endpoint
-
class
alignak_app.items.service.
Service
¶ Bases:
alignak_app.items.item.Item
Class who create a service item
-
create
(_id, data, name=None)¶ Create wanted item
Parameters:
-
static
get_available_icons
()¶ Return list of available icons for a Service item
Returns: list of available icons for Service Return type: list
-
static
get_check_text
(check_type)¶ Return text for check type :param check_type: type of check (
active_checks_enabled
orpassive_checks_enabled
) :type check_type: str :return: the corresponding text :rtype: str
-
static
get_request_model
(host_id=None)¶ Return the request model for service requests
Parameters: host_id (str) – “_id” of host, needed to get only host services Returns: request model for service endpoint Return type: dict
-
static
get_service_states_nb
()¶ Return all service state in a dict with int() as zero
Returns: all service state with int() as zero Return type: dict
-
User¶
User manage creation of user item
-
class
alignak_app.items.user.
User
¶ Bases:
alignak_app.items.item.Item
Class who create user item for backend
user
endpoint-
create
(_id, data, name=None)¶ Create wanted item
Parameters:
-
static
get_check_text
(check_type)¶ Return text for check type :param check_type: type of check (
active_checks_enabled
orpassive_checks_enabled
) :type check_type: str :return: the corresponding text :rtype: str
-
static
get_request_model
(token)¶ Return the request model for user requests
Parameters: token (str) – token of user Returns: request model for user endpoint Return type: dict
-
Utils¶
The Utils package contains classes and functions configurations
Settings¶
Settings manage configurations of Alignak-app
settings.cfg
: contains configurations of Alignak-app (stored inALIGNAKAPP_USR_DIR
)images.ini
: contains all images names (stored inALIGNAKAPP_APP_DIR
)style.css
: contains css of Alignak-app (stored inALIGNAKAPP_APP_DIR
)
-
class
alignak_app.utils.config.
Settings
¶ Bases:
object
Class who read and create configuration for Alignak-app
-
get_config
(section, option, boolean=False)¶ Return global application configuration values
Parameters: Returns: configuration value
Return type: str | bool
-
get_image
(name)¶ Return the path of wanted image
Parameters: name (str) – name of image Returns: full path of image Return type: str
-
init_config
()¶ Initialize configurations
-
init_css
()¶ Init the css file and fill app_css
-
Installer¶
Installer check and manage installation of Alignak-app
- Check
ALIGNAKAPP_APP_DIR
,ALIGNAKAPP_USR_DIR
andALIGNAKAPP_LOG_DIR
folders - Check required files for application and user
- Install configuration and daemon files for user
-
class
alignak_app.utils.installer.
Installer
¶ Bases:
object
Class who create and check: folders, files and environment variables for Alignak-App
-
check_environment
(mode='start')¶ Assign fields to environment variables if they don’t exist
-
check_install_folders
()¶ Check Alignak-app folders
Returns: if all folders are present Return type: bool
-
check_installation
(mode='start')¶ Check Alignak-app installation
-
check_user_installation
()¶ Check user installation files
-
init_environment
()¶ Assign environment variables to fields if they exists
-
install
()¶ Install Alignak-app user files on system
-
System¶
System manage interactions with folders and files for Alignak-app
-
alignak_app.utils.system.
file_executable
(filename)¶ Make filename executable
Parameters: filename (str) – file to make executable
-
alignak_app.utils.system.
install_file
(origin_dir, dest_dir, filename)¶ Install (copy) filename from an origin folder to a destination folder
Parameters:
-
alignak_app.utils.system.
mkdir
(folder)¶ Make wanted folder
Parameters: folder (str) – folder to create Returns: if creation is success or not Return type: bool
-
alignak_app.utils.system.
read_config_file
(cfg_parser, filename)¶ Read configuration file and assign it to configParser object
Parameters: - cfg_parser (configparser.ConfigParser) – configparser object
- filename (str) – name of file to read
Returns: corresponding filename if read is success
Return type:
-
alignak_app.utils.system.
write_file
(origin_dir, dest_dir, filename, formatted_var=None)¶ Write a file from an origiin to a destination, with formatted variables if needed
Parameters:
Logs¶
Logs manage application logs directory and file who are created inside ALIGNAKAPP_LOG_DIR
.
-
alignak_app.utils.logs.
create_logger
()¶ Create the logger for Alignak-App
Returns: the RootLogger of App Return type: logging.RootLogger
Time¶
Time manage time and date for Alignak-app
-
alignak_app.utils.time.
get_current_time
()¶ Return current formatted time
Returns: current time Return type: str
-
alignak_app.utils.time.
get_date_fromtimestamp
(timestamp)¶ Return formatted date string correspondig to timestamp
Parameters: timestamp (float) – time stamp Returns: formatted date Return type: str
-
alignak_app.utils.time.
get_diff_since_last_timestamp
(timestamp, unit=None)¶ Return the difference between given time stamp and current time
Parameters: - timestamp (float) – a time stamp
- unit – if unit return only corresponding value
Returns: time difference formatted
Return type: str | int
-
alignak_app.utils.time.
get_local_datetime
(_date)¶ Return the local time from a datetime
Parameters: _date (datetime.datetime) – datetime to set to local time Returns: local date time Return type: datetime.datetime
-
alignak_app.utils.time.
get_local_datetime_from_date
(_date)¶ Return the local timestamp from date
Parameters: _date (str) – date to convert to datetime Returns: corresponding local datetime of date Return type: datetime.datetime
Locales¶
The Locales package contains classes to manage translation.
QObjects¶
The QObjects package contains PyQt5 classes of Alignak-app
App Main¶
App Main manage creation of QMainWindow for:
-
class
alignak_app.qobjects.app_main.
AppQMainWindow
(parent=None)¶ Bases:
PyQt5.QtWidgets.QMainWindow
Class who create QMainWindow of Alignak-app
-
initialize
()¶ Initialize QMainWindow for App
-
mouseMoveEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
mousePressEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
showEvent
(_)¶ showEvent(self, QShowEvent)
-
Dock¶
Dock manage creation of QWidget for Dock (Right part)
Panel¶
Panel manage creation of QWidget for Panel (Left part)
-
class
alignak_app.qobjects.panel.
PanelQWidget
(parent=None)¶ Bases:
PyQt5.QtWidgets.QWidget
Class who manage Panel with Host and Services QWidgets
-
display_host
()¶ Display and update HostQWidget
-
dragEnterEvent
(event)¶ Override dragEnterEvent.
Parameters: event – event triggered when something enter
-
dragMoveEvent
(event)¶ - Override dragMoveEvent.
- Only accept EventItem() objects who have
Qt.UserRole
Parameters: event – event triggered when something move
-
dropEvent
(event)¶ - Override dropEvent.
- Get dropped item data, create a new one, and delete the one who is in EventsQWidget
Parameters: event – event triggered when something is dropped
-
get_current_host
()¶ Return current Host item with name in QLineEdit
Returns: current host Return type: alignak_app.items.host.Host
-
static
get_tab_order
()¶ Return tab order defined by user, else default order
Returns: tab order of App Return type: list
-
initialize
()¶ Create the QWidget with its items and layout.
-
set_host_from_problems
()¶ Set line search if
sender()
is instance of QPushButton fromProblems
QWidget
-
spy_host
()¶ Spy host who is available in line_search QLineEdit
-
Alignak¶
The Alignak package contains QObjects to display global alignak data, including
alignakdaemon
and livesynthesis
endpoints
Alignak¶
Alignak manage creation of QWidgets for general Alignak data, like:
- Daemons status: status of each daemons (
see
StatusQDialog
class) - Backend connection: status of backend connection (
see
TrayIcon
class) - User: data of current user (see
User
package)
-
class
alignak_app.qobjects.alignak.alignak.
AlignakQWidget
(parent=None)¶ Bases:
PyQt5.QtWidgets.QWidget
Class who display daemons status, backend connection and user informations
-
initialize
()¶ Initialize QWidget
-
show_status_dialog
()¶ Update and show StatusQDialog
-
show_user_widget
()¶ Update and show ProfileQWidget
-
update_status
()¶ Update daemons and backend status
-
Dashboard¶
Dashboard manage the creation of QWidgets to display number of:
- Each states of Hosts items
- Each states of Services items
-
class
alignak_app.qobjects.alignak.dashboard.
DashboardQWidget
(parent=None)¶ Bases:
PyQt5.QtWidgets.QWidget
Class who manage Host and Services resume QWidgets with number of:
- Hosts:
UP
,UNREACHABLE
,DOWN
- Services:
OK
,WARNING
,CRITICAL
,UNKNWON
,UNREACHABLE
- Hosts and services:
NOT_MONITORED
,ACKNOWLEDGED
,DOWNTIMED
-
get_host_resume_widget
()¶ Return Host resume QWidget
-
get_services_resume_widget
()¶ Return Services resume QWidget
-
initialize
()¶ Initialize QWidget
-
open_item_type_url
(item_type)¶ Retrieve sender to send right endpoint to open_url() function for item type
Parameters: item_type (str) – type of item: hosts | services
-
update_dashboard
()¶ Update number of items in dashboard
- Hosts:
Livestate¶
Livestate manage creation fo QWidget to resume number of:
- Number of hosts monitored and in problem
- Number of services monitored and in problem
- Number of item monitored and in problems
-
class
alignak_app.qobjects.alignak.livestate.
LivestateQWidget
¶ Bases:
PyQt5.QtWidgets.QWidget
Class who display items livestate: hosts, services and number of problems
-
get_item_type_widget
(item_type, problem_nb, total_nb)¶ Create and return QWidget with backend data
Parameters: Returns: widget with its data
Return type: QWidget
-
initialize
()¶ Initialize QWidget
-
paintEvent
(_)¶ Override paintEvent to paint background
-
update_labels
()¶ Update QLabels of QWidget
-
Problems¶
Problems manage creation of QWidgets to display problems found in Alignak backend:
-
class
alignak_app.qobjects.alignak.problems.
ProblemsQWidget
(parent=None)¶ Bases:
PyQt5.QtWidgets.QWidget
Class who create Problems QWidget
-
add_spied_host
()¶ Add a host to spied hosts
-
get_btn_widget
()¶ Return QWidget with spy and host synthesis QPushButtons
Returns: widget with spy and host button Return type: QWidget
-
get_current_user_role_item
()¶ Return current selected item by
Qt.UserRole
Returns: current selected item or None Return type: alignak_app.items.item.Item
-
get_search_widget
()¶ Create and return the search QWidget
Returns: search QWidget Return type: QWidget
-
initialize
(spy_widget)¶ Initialize QWidget and set SpyQWidget
Parameters: spy_widget (alignak_app.qobjects.events.spy.SpyQWidget) – instance of SpyQWidget to manage spy events
Update status of action buttons and set current item for ActionsQWidget
-
Problems Table¶
Problems Table manage creation of QTableView to display problems found in Alignak backend:
- Hosts:
DOWN
,UNREACHABLE
- Services:
WARNING
,CRITICAL
,UNKNOWN
-
class
alignak_app.qobjects.alignak.problems_table.
ProblemsQTableView
(parent=None)¶ Bases:
PyQt5.QtWidgets.QTableView
Class who create Problems QTableView to display each problem
-
static
get_item_text
(item)¶ Return item text depends if it’s a host or service
Parameters: item (alignak_app.items.host.Host | alignak_app.items.service.Service) – host or service item Returns: text of item Return type: str
-
static
get_output_tableitem
(item)¶ Return centered QTableWidgetItem with output
Parameters: item (alignak_app.items.host.Host | alignak_app.items.service.Service) – host or service item Returns: table item with text Return type: QStandardItem
-
get_tableitem
(item)¶ Return centered QTableWidgetItem with problem
Parameters: item (alignak_app.items.host.Host | alignak_app.items.service.Service) – host or service item Returns: table item with text Return type: QStandardItem
-
static
Status¶
Status manage creation of QDialog for daemons status
-
class
alignak_app.qobjects.alignak.status.
StatusQDialog
(parent=None)¶ Bases:
PyQt5.QtWidgets.QDialog
Class who create QWidget for Daemons status.
-
add_daemon_labels
(daemon_item, line)¶ Add daemon QLabels to layout
Parameters: - daemon_item (alignak_app.items.item_daemon.Daemon) – daemon item
- line (int) – current line of layout
-
add_daemon_titles_labels
(line)¶ Add QLabels titles for daemons to layout
Parameters: line (int) – current line of layout
-
static
daemon_is_problem
(daemon_item)¶ Check Daemon Refresh and if daemon is alive. Send a message if needed
Parameters: daemon_item (alignak_app.items.daemon.Daemon) – Daemon item Returns: if daemon is a problem True, else False Return type: bool
-
init_daemons_labels
(daemons)¶ Initialize the daemon QLabels for each daemons
Parameters: daemons (list) – list of daemon items
-
initialize
()¶ Initialize QDialog
-
mouseMoveEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
mousePressEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
Common¶
The Common package contains common QObjects for Alignak-app, used by several other QWidgets
Actions¶
Actions manage global QDialog’s for actions : Acknowledge and Downtime
-
class
alignak_app.qobjects.common.actions.
AckQDialog
(parent=None)¶ Bases:
PyQt5.QtWidgets.QDialog
Class who create Acknowledge QDialog for hosts/services
-
initialize
(item_type, item_name, comment)¶ Initialize Acknowledge QDialog
Parameters:
-
mouseMoveEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
mousePressEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
-
class
alignak_app.qobjects.common.actions.
ActionsQWidget
(parent=None)¶ Bases:
PyQt5.QtWidgets.QWidget
Class who create Actions QWidget
-
add_acknowledge
()¶ Create AckQDialog and manage acknowledge
-
add_downtime
()¶ Create DownQDialog and manage downtime
-
static
can_submit_actions
()¶ Return if user can trigger actions from App or not, depending if Web Service is set and reachable:
- If Web Service: if reachable, make actions are available else they are disabled
- If NOT Web Service: App will use backend API
Returns: if user can trigger actions Return type: bool
-
initialize
(item)¶ Initialize Actions QWidget, with ack and downtime buttons
-
update_widget
()¶ Update QWidget
-
-
class
alignak_app.qobjects.common.actions.
DownQDialog
(parent=None)¶ Bases:
PyQt5.QtWidgets.QDialog
Class who create Downtime QDialog for hosts/services
-
duration_to_seconds
()¶ Return “duration” QTimeEdit value in seconds
Returns: “duration” in seconds Return type: int
-
handle_accept
()¶ Check if end_time timestamp is not lower than start_time
-
initialize
(item_type, item_name, comment)¶ Initialize Downtime QDialog
Parameters:
-
mouseMoveEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
mousePressEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
Buttons¶
Buttons manage global QPushButtons
Dialogs¶
Dialogs manage global QDialogs
-
class
alignak_app.qobjects.common.dialogs.
EditQDialog
(parent=None)¶ Bases:
PyQt5.QtWidgets.QDialog
Class who create Edit QDialog to edit text in Alignak-app
-
accept_text
()¶ Set Edit QDialog to Rejected or Accepted (prevent to patch for nothing)
-
get_text_widget
()¶ Return text QWidget with QTextEdit
Returns: text QWidget Return type: QWidget
-
-
class
alignak_app.qobjects.common.dialogs.
MessageQDialog
(parent=None)¶ Bases:
PyQt5.QtWidgets.QDialog
Class who create a Message QDialog to display texts in Alignak-app
-
get_message_widget
(dialog, title, text)¶ Return colored message QWidget
Parameters: Returns: message QWidget
Return type: QWidget
-
-
class
alignak_app.qobjects.common.dialogs.
ValidatorQDialog
(parent=None)¶ Bases:
PyQt5.QtWidgets.QDialog
Class who create Validator QDialog to edit text in Alignak-app with regexp to validate
-
accept_text
()¶ Set Edit QDialog to Rejected or Accepted (prevent to patch for nothing)
-
check_text
()¶ Valid email with
QRegExpValidator
and inform user
-
get_text_widget
(regexp)¶ Return text QWidget with QTextEdit
Returns: text QWidget Return type: QWidget
-
Frames¶
Frames manage global QFrames for Alignak-app
Labels¶
Labels manage global QLabels and QPixmaps
-
alignak_app.qobjects.common.labels.
get_icon_item
(item_type, problem_nb)¶ Return QPixmap with the corresponding image
Parameters: Returns: QPixmap with corresponding image
Return type: QPixmap
Widgets¶
Widgets manage global QWidgets
-
class
alignak_app.qobjects.common.widgets.
LogoQWidget
¶ Bases:
PyQt5.QtWidgets.QWidget
Class who manage creation of Logo QWidget
-
initialize
(child_widget, title, exitapp)¶ Initialize QWidget
Parameters:
-
minimize
()¶ Minimize QWidget
-
minimize_maximize
()¶ Minimize / Maximize QWidget
-
paintEvent
(_)¶ Override to apply “background-color” property of QWidget
-
-
alignak_app.qobjects.common.widgets.
center_widget
(widget)¶ Center QWidget
Parameters: widget (QWidget) – widget to center
-
alignak_app.qobjects.common.widgets.
get_logo_widget
(child_widget, title, exitapp=False)¶ Return LogoQWidget with alignak logo
Parameters: Returns: Logo QWidget with buttons and child QWidget
Return type: QWidget
Events¶
The Events package contains QObjects to view events collected by the application, like notifications in history, hosts spied, actions performed by the user
Events¶
Events manage creation of QWidget for events
-
class
alignak_app.qobjects.events.events.
EventsQWidget
¶ Bases:
PyQt5.QtWidgets.QWidget
Class who create QWidget for events
-
add_event
(event_type, msg, timer=False, host=None)¶ Add event to events list
Parameters:
-
event_exist
(msg)¶ Check if event already displayed, move it to top and update tooltip. Only for EventItem who have a
Qt.UserRole
Parameters: msg (str) – message of event Returns: if message exist or not in events QWidgetList Return type: bool
-
initialize
()¶ Intialize QWidget
-
remove_event
(item=None)¶ Remove item when user double click on an item
Parameters: item (EventItem) – item to remove, else remove the current row
-
remove_timer_event
(event)¶ Remove EventItem with timer
Parameters: event (EventItem) – EventItem with timer
-
send_datamanager_events
()¶ Add events stored in DataManager
-
-
alignak_app.qobjects.events.events.
get_events_widget
()¶ Return EventsQWidget instance
Returns: EventsQWidget instance Return type: alignak_app.qobjects.events.events.EventsQWidget
-
alignak_app.qobjects.events.events.
init_event_widget
()¶ Initialize the global EventsQWidget. Used for drag & drop and send events
-
alignak_app.qobjects.events.events.
send_event
(event_type, msg, timer=False, host=None)¶ Add event to Events QWidget (access function to make event sendable in whole application. Event type define icon color of
EventItem
.- green: [
OK
,UP
] - blue: [
UNKNOWN
,INFO
,SPY
] - orange: [
WARNING
,UNREACHABLE
,WARN
] - red’: [
DOWN
,CRITICAL
,ALERT
] - yellow: [
ACK
] - yellow: [
DOWNTIME
]
Parameters: - green: [
Event Item¶
Event item manage creation of QListWidgetItem
for events
-
class
alignak_app.qobjects.events.item.
EventItem
¶ Bases:
PyQt5.QtWidgets.QListWidgetItem
Class who create an event QListWidgetItem
-
close_item
()¶ Hide items when timer is finished
-
static
get_event_type
(data)¶ Return event type depending of data content
Parameters: data (dict) – data of backend item Returns: event type for item Return type: str
-
Spy¶
Spy manage creation of QWidget to manage spied items
-
class
alignak_app.qobjects.events.spy.
SpyQWidget
¶ Bases:
PyQt5.QtWidgets.QWidget
Class who create QWidget for spied hosts
-
static
get_hint_item
()¶ Return an EventItem with a hint text
Returns: event item with hint text Return type: EventItem
-
initialize
()¶ Intialize Spy QWidget
-
manage_host_events
(row)¶ Manage spy events for a host, defined by current row of “spy_list_widget”
Parameters: row (int) – current row of “spy_list_widget”
-
remove_event
()¶ Remove item when user double click on an item, update parent tab text
-
send_spy_events
()¶ Send event messages for all hosts who are spied
-
update_parent_spytab
()¶ Update the parent spy tab text
-
static
Spy List¶
Spy List manage creation of custom QListWidget for host items who are spied
-
class
alignak_app.qobjects.events.spy_list.
SpyQListWidget
¶ Bases:
PyQt5.QtWidgets.QListWidget
Class who create QListWidget for spied hosts
-
add_spy_host
(host_id)¶ Add a host to spied list and create corresponding EventItem()
Parameters: host_id (str) – “_id” of host to spy
-
dragMoveEvent
(event)¶ - Override dragMoveEvent.
- Only accept EventItem() objects who have a
Qt.UserRole
and not already in “spied_hosts”
Parameters: event – event triggered when something move
-
dropEvent
(event)¶ - Override dropEvent.
- Get dropped item data, create a new one, and delete the one who is in EventsQWidget
Parameters: event – event triggered when something is dropped
-
Host¶
The Host package contains QObjects to display data of the backend host
Customs¶
Customs manage creation of QWidget to display custom variables of an host
-
class
alignak_app.qobjects.host.customs.
CustomsQWidget
(parent=None)¶ Bases:
PyQt5.QtWidgets.QWidget
Class who create Customs Qwidget for host
-
initialize
()¶ Initialize Customs QWidget
-
mouseMoveEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
mousePressEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
paintEvent
(_)¶ Override to apply “background-color” property of QWidget
-
update_customs
(host_item)¶ Update customs QTableWidget with customs of host item
Parameters: host_item (alignak_app.items.host.Host) – Host item
-
History¶
History manage creation of QWidget to display history of a host
-
class
alignak_app.qobjects.host.history.
HistoryQWidget
(parent=None)¶ Bases:
PyQt5.QtWidgets.QWidget
Class who create the History QWidget for host
-
static
get_event_type
(event, hostname)¶ Return event type for history
Parameters: Returns: the event type
Return type:
-
get_event_widget
(hostname, event)¶ Return event QWidget with icon, event text and event message
Parameters: Returns: widget of event
Return type: QWidget
-
static
get_icon_label
(event)¶ Return QWidget with corresponding icon to item state
Parameters: event (dict) – data of an event Returns: icon QWidget Return type: QWidget
-
initialize
()¶ Initialize History QWidget
-
mouseMoveEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
mousePressEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
paintEvent
(_)¶ Override to apply “background-color” property of QWidget
-
static
Host¶
Host manage creation of QWidget to display host data
-
class
alignak_app.qobjects.host.host.
HostQWidget
(parent=None)¶ Bases:
PyQt5.QtWidgets.QWidget
Class who create QWidget to display host data
-
get_actions_widget
()¶ Return QWidget with actions buttons
Returns: widget with buttons Return type: QWidget
-
get_host_icon_widget
()¶ Return QWidget with overall icon state and host name
Returns: widget with host name and icon Return type: QWidget
-
get_last_check_widget
()¶ Return QWidget with last check data
Returns: widget with last check data Return type: QWidget
-
get_notes_output_widget
()¶ Return QWidget with output and notes data
Returns: widget with host output and notes Return type: QWidget
-
get_variables_widget
()¶ Return QWidget with host variables
Returns: widget with host variables Return type: QWidget
-
initialize
()¶ Initialize QWidget
-
patch_data
()¶ Display QDialog for patch
-
patch_host_checks
(check_type, state)¶ Patch the host check: ‘active_checks_enabled’ | ‘passive_checks_enabled’
Parameters:
-
set_data
(host_item)¶ Set data of host and service
Parameters: host_item (alignak_app.items.host.Host) – the Host item
-
show_customs
()¶ Update and show CustomsQWidget
-
show_history
()¶ Update and show HistoryQWidget
-
update_host
(host_item=None)¶ Update HostQWidget data and QLabels
Parameters: host_item (alignak_app.items.host.Host) – the Host item
-
Synthesis¶
Synthesis manage creation of QWidget for Host Synthesis view
-
class
alignak_app.qobjects.host.synthesis.
SynthesisQWidget
(parent=None)¶ Bases:
PyQt5.QtWidgets.QWidget
Class who manage Synthesis view with Host and Services QWidgets
-
create_line_search
(hostnames_list)¶ Add all hosts to QLineEdit and set QCompleter
Parameters: hostnames_list (list) – list of host names
-
get_search_widget
()¶ Create and return the search QWidget
Returns: search QWidget Return type: QWidget
-
initialize_synthesis
()¶ Initialize Synthesis QWidget
-
update_synthesis
(host, services, not_spied)¶ Update Synthesis QWidget with given host and services
Parameters: - host (alignak_app.items.host.Host) – host item
- services (list) – list of services attached to host
- not_spied (bool) – define if host is spied or not
-
Login¶
The Login package contains QObjects to display connection windows, for login and server settings
Login¶
Login manage creation of QDialog for user login
-
class
alignak_app.qobjects.login.login.
LoginQDialog
(parent=None)¶ Bases:
PyQt5.QtWidgets.QDialog
Class who create login QDialog.
-
accept_login
()¶ Accept Login or not if backend is connected
-
create_widget
()¶ Create widget login
-
handle_proxy
()¶ Handle Proxy QDialog display and set proxies for login
-
static
handle_server
()¶ Handle for Server QDialog and set alignak backend server settings
-
mouseMoveEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
mousePressEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
set_proxy_settings
(proxy_password=None)¶ Set the proxy settings, with password if given
Parameters: proxy_password (str) – the pasword of proxy
-
showEvent
(_)¶ QDialog.showEvent(QShowEvent)
-
Server¶
Server manage creation of QDialog for Alignak backend server settings
-
class
alignak_app.qobjects.login.server.
ServerQDialog
(parent=None)¶ Bases:
PyQt5.QtWidgets.QDialog
Class who create Server QDialog.
-
get_settings_widget
()¶ Return the alignak settings QWidget
Returns: settings QWidget Return type: QWidget
-
initialize_dialog
()¶ Initialize Server QDialog
-
mouseMoveEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
mousePressEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
Service¶
The Service package contains QObjects to display data of the backend service
Service¶
Service manage creation of QWidget to display service data
-
class
alignak_app.qobjects.service.service.
ServiceDataQWidget
(parent=None)¶ Bases:
PyQt5.QtWidgets.QWidget
Class who create QWidget with service data
-
get_actions_widget
()¶ Return QWidget with actions buttons
Returns: widget with buttons Return type: QWidget
-
get_last_check_widget
()¶ Return QWidget with last check data
Returns: widget with last check data Return type: QWidget
-
get_service_icon_widget
()¶ Return QWidget with its icon and name
Returns: widget with icon and name Return type: QWidget
-
initialize
()¶ Initialize QWidget
-
periodic_refresh
()¶ Refresh QWidget periodically
-
update_widget
(service)¶ Update ServiceDataQWidget
Parameters: service (alignak_app.core.models.service.Service) – Service item with its data
-
Services¶
Services manage creation of QWidget to display the services
-
class
alignak_app.qobjects.service.services.
ServicesQWidget
(parent=None)¶ Bases:
PyQt5.QtWidgets.QWidget
Class wo create services QWidget
-
add_filter_item
(filter_item)¶ Add filter item to QListWidget
Parameters: filter_item (alignak_app.items.service.Service) – filter item (service)
-
filter_services
(state)¶ Filter services with the wanted state
Parameters: state – state of service: OK, WARNING, NOT_MONITORED, DOWNTIME Returns:
-
initialize
()¶ Initialize QWidget
-
set_filter_items
(state)¶ Add filter items to QListWidget corresponding to “state”
Parameters: state (str) – state of service to filter
-
update_service_data
()¶ Update ServiceDataqWidget
-
Number Services¶
Number Services manage creation of QWidget to display number of host services, for each state
Service Tree Item¶
Service Tree Item manage creation of QTreeWidgetItem(s) to store and display Service item data
-
class
alignak_app.qobjects.service.tree_item.
ServiceTreeItem
(parent=None)¶ Bases:
PyQt5.QtWidgets.QTreeWidgetItem
Class who create QTreeWidgetItem with service data
-
initialize
(service_item)¶ Initialize the QTreeWidgetItem
Parameters: service_item (alignak_app.core.models.service.Service) – service item with its data
-
update_item
()¶ Update QIcon of service
-
Systray¶
The Service package contains QObjects to display system tray icon (taskbar)
App TrayIcon¶
App TrayIcon manage the creation of QSystemTrayIcon for Alignak-app menus
-
class
alignak_app.qobjects.systray.tray_icon.
AppTrayIcon
(icon, parent=None)¶ Bases:
PyQt5.QtWidgets.QSystemTrayIcon
Class who create QMenu and QActions for QSystemTrayIcon (displayed in task bar)
Create and add to menu “about” QAction
Create and add to menu “app” QAction
Create and add to menu “exit” QAction
Create and add to menu “reload” QAction
Create and add to menu “webui” QAction
Initialize and create each QAction of QMenu
-
check_connection
()¶ Check periodically connection to Alignak backend
-
static
quit_app
()¶ Quit application and close all widgets handle by application
Refresh menu if needed
-
static
reload_configuration
()¶ Reload configuration
Threads¶
The Threads package contains QObjects who manage application QThreads
Backend Thread¶
Backend Thread manage creation of QThreads for backend requests
Thread Manager¶
Thread Manager manage BackendQThreads creations and their priority:
- low : threads that group the queries about the elements that change little
- normal: threads that group the queries on items that change often
- high: threads that group the queries made on the fly
-
class
alignak_app.qobjects.threads.threadmanager.
ThreadManager
(parent=None)¶ Bases:
PyQt5.QtCore.QObject
Class who create BackendQThreads periodically, to request on Alignak Backend endpoints
-
add_high_priority_thread
(thread_name, data)¶ Launch a thread with higher priority (doesn’t wait launch_threads() function)
Parameters:
-
clean_threads
()¶ Clean current BackendQThreads
-
fill_threads
(thread_type)¶ Fill threads to launch for a specific thread type
Parameters: thread_type (str) – type of thread to fill
-
is_launched
(thread_type, thread_name)¶ Returns if the thread name is already in the started threads type
Parameters: Returns: if thread is launched or not
Return type:
-
launch_threads
(thread_type=None)¶ Launch the next thread of the given type or launch all the next threads for each type
Parameters: thread_type (str) – type of thread to launch
-
stop_high_priority_threads
()¶ Stop threads with high priority
-
stop_threads
()¶ Stop all running BackendQThreads
-
User¶
The User package contains QObjects to display data of the backend user
User Options¶
User Options manage creation options of QDialogs for user notifications options
-
class
alignak_app.qobjects.user.options.
UserOptionsQDialog
(parent=None)¶ Bases:
PyQt5.QtWidgets.QDialog
Class who create options QDialog
-
get_notifications_widget
(item_type, options)¶ Create QWidget with options and their icons
Parameters: Returns: QWidget with options and icons
Return type: QWidget
-
static
get_selected_options
(item_type, options)¶ Return the options who are selected or not
Parameters: Returns: dict of options selected
Return type:
-
Password¶
Password manage Qdialog for user password
Profile¶
Profile manage creation of QWidget who display user profile who use Alignak-app
-
class
alignak_app.qobjects.user.profile.
ProfileQWidget
(parent=None)¶ Bases:
PyQt5.QtWidgets.QWidget
Class who create QWidget for User profile.
-
enable_notifications
(notification_type, btn_state)¶ Enable notification for the wanted type: hosts or services
Parameters:
-
get_hosts_notif_widget
()¶ Create and return notification QWidget for hosts
Returns: hosts notification QWidget Return type: QWidget
-
get_informations_widget
()¶ Create and return QWidget with user informations
Returns: main QWidget Return type: QWidget
-
get_notes_mail_widget
()¶ Return QWidget with notes and email areas and edition buttons
Returns: notes and email QWidget Return type: QWidget
-
get_notifications_widget
()¶ Create and return notification QWidget for hosts and services
Returns: notifications QWidget Return type: QWidget
-
get_services_notif_widget
()¶ Create and return notification QWidget for services
Returns: services notification QWidget Return type: QWidget
-
initialize
()¶ Initialize User QWidget
-
mouseMoveEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
mousePressEvent
(event)¶ QWidget.mousePressEvent(QMouseEvent)
-
paintEvent
(_)¶ Override to apply “background-color” property of QWidget
-
patch_data
(patch_type)¶ Display QDialogs for patches
Parameters: patch_type (str) – type of patch (“notes” or “password”)
-
static
show_token_dialog
()¶ Show Token QDialog
-
update_widget
()¶ Update UserQWidget
-
About¶
About¶
About manage creation of QDialog to display data about Alignak-app
-
class
alignak_app.qobjects.about.
AboutQDialog
(parent=None)¶ Bases:
PyQt5.QtWidgets.QDialog
Class who create QDialog to display about data
-
static
get_external_link_label
(link, title='')¶ Return QLabel with clickable text
Parameters: Returns: QLabel with clickable link
Return type: QLabel
-
initialize
()¶ Initialize QDialog
-
show_about
()¶ Show about dialog
-
static