/mnt/labs/sanet3/sanet3-ose-svn/trunk/sanet/core/management/commands/generate_commands_doc.pyc ERROR <type ‘exceptions.Exception’> Error importing handler core.management.commands.nodes_csv_export: “No module named customfield.models” >>>>>>> core nodes_csv_export
9.5. Command line tools¶
Contenuti
- Command line tools
- Indroduzione
- Main modules
- django.contrib.auth
- core
- agentinfo
- broker_info
- cache_info
- change_password
- check_active_rrds
- check_logs_consistency
- check_multiple_primary
- check_scheduling_config
- check_schema
- clean_rrds
- create_datasource_store
- create_super_user
- datasource_produce_random_values
- dbusage
- erase_dg_logs
- erase_queue
- exec_datagroup
- exec_expr
- exec_timegraph
- extract_conditions
- fetch_ds_rrddata
- filter_poller_log
- fix_dead_users
- get_config
- get_ds_filename
- get_ds_path
- get_ds_storeinfo
- helpme
- push_alarm
- push_event
- remove_old_logs
- sanetdata
- sanetdinfo
- Make statistics about scheduling groups
- Make statistics about scheduling groups
- statusdinfo
- test_user_password
- cli
- webui
- tags
- Other modules
9.5.1. Indroduzione¶
Questi sono tutti i sotto-comandi del comando:
sanet-manage <comando> [ <parametri> ]
Note
Questo comando e’ equivalente al comando:
python {{SANET_INSTALL_DIR}}/manage.py <comando> [ <parametri> ]
9.5.2. Main modules¶
9.5.2.1. django.contrib.auth¶
Management utility to create superusers.
9.5.2.2. core¶
9.5.2.2.2. broker_info¶
Mostra informazioni sullo stato del sistema di comunicazione tra i processi del sistema:
broker_info [--flat] [ --broker <connection string> ] [queues]
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.2.2.3. cache_info¶
- Syntax:
sanet-manage cache_info info sanet-manage cache_info keys [ <patter> [ sorted ] ]
Extract informations about Sanet caching subsystem.
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.2.2.4. change_password¶
Syntax:
sanet-manage change_password [options] [ <username> ]
Changes password of the given user username.
It username is not specified, the current shell user is used.
Example:
sanet-mange change_password user1
Note
This is an alias for the changepassword django command.
9.5.2.2.5. check_active_rrds¶
Syntax:
sanet-manage check_active_rrds
Prints informations about RRD files.
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.2.2.6. check_logs_consistency¶
Syntax:
sanet-manage check_logs_consistency [--start YYYY-MM-DD] [--end YYYY-MM-DD]
Verifies inconsistent Condition logs selected between start and end dates.
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.2.2.7. check_multiple_primary¶
Syntax:
sanet-manage check_multiple_primary [options]
Options:
--tenant <name> Limit the check to the given tenant.
Verifies if there are multiple primary conditions configured for a monitored element.
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.2.2.9. check_schema¶
Syntax:
sanet-mange check_schema
Updates Sanet DataBase schema.
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.2.2.10. clean_rrds¶
Syntax:
sanet-mange clean_rrds [options]
Removes orphans RRD files.
A RRD file is orphan when :
- it’s related to a deleted datasource.
- it’s related to a datasource with the save-value flag set to False.
- Options:
- –print-only : Does not perform any action.
- –remove-no-save-value : Removes files linked to datasources with flag “save-value” set to False.
9.5.2.2.11. create_datasource_store¶
Syntax:
sanet-manage create_datasource_store [optioni] <path | id>
Initialize the storage (RRD file) for the given datasource.
Options:
--tenant <name> Specify the tenant, otherwise the primary tenant is selected.
Example:
sanet-manage create_datasource_store 'localhost;;datagroup-test;datasource1' sanet-manage create_datasoruce_store 117634a4962841f2952695a92c3b6c1d
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.2.2.12. create_super_user¶
Syntax:
sanet-manage create_super_user [options]
Create a new user with superuser privileges (flag set to true).
--username <username> --email <email>
Example:
sanet-manage create_super_user --username admin2 --email admin2@labs.it
Note
This is an alias for the createsuperuser django command.
9.5.2.2.13. datasource_produce_random_values¶
Syntax:
sanet-manage datasource_produce_random_values [ --tenant <name> ] <path datasource> <DD-MM-YYYY inizio> <DD-MM-YYYY fine> <minvalue>-<max>
Generate and stores random values for the given datasource, between the selected time range.
Warning
This is an internal Sanet command. It is not recommended to use this command.
Example:
sanet-manage datasource_produce_random_values 'localhost;;cpu-hr;cpuperc-hr' '01-01-2016' '01-03-2016' 0-1000
9.5.2.2.14. dbusage¶
Syntax:
sanet-manage dbusage
Show informations about DataBase’s running queries.
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.2.2.16. erase_queue¶
Syntax:
erase_queue <queue_id>
Erase the given IPC queue queue_id.
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.2.2.17. exec_datagroup¶
Launch:
sanet-manage exec_datagroup [options] ( <UUID> | <path> )
Available options are:
-l <n> Imposta il livello di logging al valore <n>, 1 debug massimo, 10 debug normale, 20 info. --tenant <nome> Esegue il datagroup del tenant specificato. Default: Tenant primario
9.5.2.2.17.1. Examples¶
Check the datagroup xha;;icmp-reachability
# python manage.py exec_datagroup 'xha;;icmp-reachability' -l 10 2013-07-25 19:03:19,656 DEBUG MainThread > Loading cache manager... 2013-07-25 19:03:19,662 DEBUG MainThread > Loading datasource store... 2013-07-25 19:03:19,672 DEBUG MainThread > Loading data... 2013-07-25 19:03:19,687 DEBUG MainThread > Using default tenant: <Tenant:10a279a6ce5c4438a98f9c33c0b77cde:site> 2013-07-25 19:03:19,692 DEBUG MainThread > Loading system symbols 2013-07-25 19:03:19,728 INFO MainThread > Loading extra symbols from ['sanet_extra.agent.functions.rtt_pingerd'] 2013-07-25 19:03:19,740 DEBUG MainThread > ######################################################## 2013-07-25 19:03:19,741 DEBUG MainThread > ###################### CHECKING ######################## 2013-07-25 19:03:19,741 DEBUG MainThread > ######################################################## 2013-07-25 19:03:19,741 DEBUG MainThread > Checking datagroup 1081cb2edf8f4a5ca49e68e6bdc83004 at 1374771799.74 2013-07-25 19:03:19,741 DEBUG MainThread > Loading previeous execution state... 2013-07-25 19:03:19,743 DEBUG MainThread > Loading free parameters 2013-07-25 19:03:19,748 DEBUG MainThread > params 'probesize' = (3) 1472 2013-07-25 19:03:19,763 DEBUG MainThread > -------------------------- Calculating datasource rttmin ---------------- 2013-07-25 19:03:19,764 DEBUG MainThread > Evaluating datasource xha;;icmp-reachability;rttmin 2013-07-25 19:03:19,764 DEBUG MainThread > $delta = 11.4565660954 2013-07-25 19:03:19,765 DEBUG MainThread > getRttInfo_pingerd(ipv=None, host=2a01:4f8:110:3383::1, tries=None, probe=1472.0, timeout=None, frag=False, bind=None) 2013-07-25 19:03:19,765 WARNING MainThread > PINGERD_ADDRESS not defined in environment! Using normal ping 2013-07-25 19:03:19,765 DEBUG MainThread > Resolving ipv=6, host=2a01:4f8:110:3383::1 2013-07-25 19:03:19,767 DEBUG MainThread > 2a01:4f8:110:3383::1: Sending IPv6 pings. 2013-07-25 19:03:19,767 DEBUG MainThread > exec_ping: ping6 -c 1 -s 1472 -A -W 1.0 -n '2a01:4f8:110:3383::1' 2013-07-25 19:03:19,875 DEBUG MainThread > exec_ping: ping6 -c 1 -s 1472 -A -W 1.0 -n '2a01:4f8:110:3383::1' 2013-07-25 19:03:19,980 DEBUG MainThread > exec_ping: ping6 -c 1 -s 1472 -A -W 1.0 -n '2a01:4f8:110:3383::1' 2013-07-25 19:03:20,087 DEBUG MainThread > exec_ping: ping6 -c 1 -s 1472 -A -W 1.0 -n '2a01:4f8:110:3383::1' 2013-07-25 19:03:20,193 DEBUG MainThread > exec_ping: ping6 -c 1 -s 1472 -A -W 1.0 -n '2a01:4f8:110:3383::1' 2013-07-25 19:03:20,300 DEBUG MainThread > 2a01:4f8:110:3383::1: got ping answer #0 in 0.107907 s 2013-07-25 19:03:20,301 DEBUG MainThread > 2a01:4f8:110:3383::1: got ping answer #1 in 0.104681 s 2013-07-25 19:03:20,301 DEBUG MainThread > 2a01:4f8:110:3383::1: got ping answer #2 in 0.106491 s 2013-07-25 19:03:20,301 DEBUG MainThread > 2a01:4f8:110:3383::1: got ping answer #3 in 0.106536 s 2013-07-25 19:03:20,301 DEBUG MainThread > 2a01:4f8:110:3383::1: got ping answer #4 in 0.106056 s 2013-07-25 19:03:20,302 DEBUG MainThread > avg=0.1063342, min=0.104681, max=0.107907, loss=0.0 2013-07-25 19:03:20,303 DEBUG MainThread > Check result 1374771799.76, SV, 0.104681, [u"expression getICMPStat('rttmin', $node, $probesize) expanded to 0.104681"] 2013-07-25 19:03:20,303 DEBUG MainThread > Saving rttmin = 0.104681 2013-07-25 19:03:20,303 DEBUG MainThread > Saving rttmin/lastgoodcheck = 1374771800.303601 2013-07-25 19:03:20,304 DEBUG MainThread > -------------------------- Calculating datasource rttmax ---------------- 2013-07-25 19:03:20,304 DEBUG MainThread > Evaluating datasource xha;;icmp-reachability;rttmax 2013-07-25 19:03:20,304 DEBUG MainThread > $delta = 11.9944171906 2013-07-25 19:03:20,306 DEBUG MainThread > getRttInfo_pingerd(ipv=None, host=2a01:4f8:110:3383::1, tries=None, probe=1472.0, timeout=None, frag=False, bind=None) 2013-07-25 19:03:20,307 DEBUG MainThread > SIMPLEVALUE CACHE HIT: 2a01:4f8:110:3383::1:1472:5:1.0:False:None:6 = (0.1063342, 0.104681, 0.107907, 0.0, []) <type 'tuple'> 2013-07-25 19:03:20,307 DEBUG MainThread > Check result 1374771800.3, SV, 0.107907, [u"expression getICMPStat('rttmax', $node, $probesize) expanded to 0.107907"] 2013-07-25 19:03:20,307 DEBUG MainThread > Saving rttmax = 0.107907 2013-07-25 19:03:20,307 DEBUG MainThread > Saving rttmax/lastgoodcheck = 1374771800.307629 2013-07-25 19:03:20,308 DEBUG MainThread > -------------------------- Calculating datasource rttavg ---------------- 2013-07-25 19:03:20,308 DEBUG MainThread > Evaluating datasource xha;;icmp-reachability;rttavg 2013-07-25 19:03:20,308 DEBUG MainThread > $delta = 11.9975709915 2013-07-25 19:03:20,309 DEBUG MainThread > getRttInfo_pingerd(ipv=None, host=2a01:4f8:110:3383::1, tries=None, probe=1472.0, timeout=None, frag=False, bind=None) 2013-07-25 19:03:20,309 DEBUG MainThread > SIMPLEVALUE CACHE HIT: 2a01:4f8:110:3383::1:1472:5:1.0:False:None:6 = (0.1063342, 0.104681, 0.107907, 0.0, []) <type 'tuple'> 2013-07-25 19:03:20,309 DEBUG MainThread > Check result 1374771800.31, SV, 0.1063342, [u"expression getICMPStat('rttavg', $node, $probesize) expanded to 0.1063342"] 2013-07-25 19:03:20,310 DEBUG MainThread > Saving rttavg = 0.1063342 2013-07-25 19:03:20,310 DEBUG MainThread > Saving rttavg/lastgoodcheck = 1374771800.31033 2013-07-25 19:03:20,310 DEBUG MainThread > -------------------------- Calculating datasource lossperc ---------------- 2013-07-25 19:03:20,310 DEBUG MainThread > Evaluating datasource xha;;icmp-reachability;lossperc 2013-07-25 19:03:20,311 DEBUG MainThread > $delta = 11.9995350838 2013-07-25 19:03:20,311 DEBUG MainThread > getRttInfo_pingerd(ipv=None, host=2a01:4f8:110:3383::1, tries=None, probe=1472.0, timeout=None, frag=False, bind=None) 2013-07-25 19:03:20,312 DEBUG MainThread > SIMPLEVALUE CACHE HIT: 2a01:4f8:110:3383::1:1472:5:1.0:False:None:6 = (0.1063342, 0.104681, 0.107907, 0.0, []) <type 'tuple'> 2013-07-25 19:03:20,312 DEBUG MainThread > Check result 1374771800.31, SV, 0.0, [u"expression getICMPStat('loss', $node, $probesize) expanded to 0"] 2013-07-25 19:03:20,312 DEBUG MainThread > Saving lossperc = 0.0 2013-07-25 19:03:20,312 DEBUG MainThread > Saving lossperc/lastgoodcheck = 1374771800.312801 2013-07-25 19:03:20,319 DEBUG MainThread > -------------------------- Calculating condition reach ---------------- 2013-07-25 19:03:20,319 DEBUG MainThread > Checking condition reach 2013-07-25 19:03:20,319 DEBUG MainThread > $delta = 12.0010859966 2013-07-25 19:03:20,320 DEBUG MainThread > Saving reach/lastgoodcheck = 1374771800.320371 2013-07-25 19:03:20,320 DEBUG MainThread > Check result 1374771800.32, result=True, infos=[u' {lossperc@} < 1 expanded to (0 < 1)'] 2013-07-25 19:03:20,320 DEBUG MainThread > Old state : UP 2013-07-25 19:03:20,320 DEBUG MainThread > New state : UP 2013-07-25 19:03:20,321 DEBUG MainThread > Updating condition state 2013-07-25 19:03:20,321 DEBUG MainThread > UP -> UP 2013-07-25 19:03:20,321 DEBUG MainThread > Updating penalty--->TODO 2013-07-25 19:03:20,321 DEBUG MainThread > Checking all changed fields... 2013-07-25 19:03:20,321 DEBUG MainThread > ----------------------- Saving execution state ---------------------- 2013-07-25 19:03:20,322 DEBUG MainThread > lossperc = 0.0 2013-07-25 19:03:20,322 DEBUG MainThread > lossperc/lastgoodcheck = 1374771800.312801 2013-07-25 19:03:20,322 DEBUG MainThread > reach/lastgoodcheck = 1374771800.320371 2013-07-25 19:03:20,322 DEBUG MainThread > rttavg = 0.1063342 2013-07-25 19:03:20,323 DEBUG MainThread > rttavg/lastgoodcheck = 1374771800.31033 2013-07-25 19:03:20,323 DEBUG MainThread > rttmax = 0.107907 2013-07-25 19:03:20,323 DEBUG MainThread > rttmax/lastgoodcheck = 1374771800.307629 2013-07-25 19:03:20,323 DEBUG MainThread > rttmin = 0.104681 2013-07-25 19:03:20,324 DEBUG MainThread > rttmin/lastgoodcheck = 1374771800.303601 2013-07-25 19:03:20,324 DEBUG MainThread > ----------------------- Element fields to update ---------------------- 2013-07-25 19:03:20,324 DEBUG MainThread > ----------------------- Pushing updates ---------------------- 2013-07-25 19:03:20,325 DEBUG MainThread > Check finished. Update data = 2013-07-25 19:03:20,331 DEBUG MainThread > [{'conditions_updates': {u'74d5c331cbeb44b093d76310cb65bcce': {'fields': {'lastdone': 1374771800.320735}, 'infos': [u' {lossperc@} < 1 expanded to (0 < 1)'], 'time': 1374771800.319544, 'uuid': u'74d5c331cbeb44b093d76310cb65bcce'}}, 'datagroup_id': u'1081cb2edf8f4a5ca49e68e6bdc83004', 'datagroup_updates': {}, 'datasources_updates': {u'09893adb00874763ade0ffaece3a58da': {'fields': {'lastdone': 1374771799.764363, 'lastvalue': 0.104681}, 'infos': [u"expression getICMPStat('rttmin', $node, $probesize) expanded to 0.104681"], 'time': 1374771799.764363, 'uuid': u'09893adb00874763ade0ffaece3a58da'}, u'5dca34f65bc949d0bf22d504b67ba976': {'fields': {'lastdone': 1374771800.308346, 'lastvalue': 0.1063342}, 'infos': [u"expression getICMPStat('rttavg', $node, $probesize) expanded to 0.1063342"], 'time': 1374771800.308346, 'uuid': u'5dca34f65bc949d0bf22d504b67ba976'}, u'5f2df9582cad41c5bc4b279a099cdef1': {'fields': {'lastdone': 1374771800.304476, 'lastvalue': 0.107907}, 'infos': [u"expression getICMPStat('rttmax', $node, $probesize) expanded to 0.107907"], 'time': 1374771800.304476, 'uuid': u'5f2df9582cad41c5bc4b279a099cdef1'}, u'8fb653003b914bba92c61e13ffc19d6f': {'fields': {'lastdone': 1374771800.31103, 'lastvalue': 0.0}, 'infos': [u"expression getICMPStat('loss', $node, $probesize) expanded to 0"], 'time': 1374771800.31103, 'uuid': u'8fb653003b914bba92c61e13ffc19d6f'}}, 'element_id': u'6bd8081044cf4f58a932f3c0ee265f13', 'elements': {}, 'mtime': 1373626873.01769}]
9.5.2.2.18. exec_expr¶
Launch:
cd $SANET_INSTALL_DIR python manage.py exec_expr [options] <node>[:<subentity>] [ <expression> ]
The program will evaluate a generic expression using informations about the specified node / subentity (interface, storage, device, service).
If node (or the subentity) are present inside SANET’s configuration, the programm will load all default node/subentity variables .
Options:
--stdin Additional parameters (and the expression) will be read line by line from standard input. The parameter expression can be read from standard input too. See later in this section. --tenant <name> The expression will be evaluated with data taken from the selected tenant instead of from the primary tenant.
9.5.2.2.18.1. Examples¶
Generic expression on a generic host not defined inside SANET:
# python manage.py exec_expr localhost '1+1'
Output:
2013-07-25 18:53:46,638 DEBUG MainThread > Loading tenant environment 2013-07-25 18:53:46,654 DEBUG MainThread > Using default tenant: <Tenant:10a279a6ce5c4438a98f9c33c0b77cde:site> ... ... ... 2013-07-25 18:53:46,790 DEBUG MainThread > evaluated() VALUE: 2 INFOS:
Retrieve SysName from node mason defined inside Sanet:
# python manage.py exec_expr mason '1.3.6.1.2.1.1.1.0@'
Output:
2013-07-25 18:55:31,989 DEBUG MainThread > Loading tenant environment ... ... ... 2013-07-25 18:55:32,201 DEBUG MainThread > evaluated() VALUE: Linux mason 2.4.34.5 #12 Tue Jun 26 14:09:29 CEST 2007 i686 INFOS:
9.5.2.2.18.2. Specify additional variables and expression from standard input¶
Additional variables can be specified line by line throw standard input which must have the following syntax:
$variable_name [ "=" <type> ] "=" <value>
Where:
- $*variable_name* : Must be a valid expression variable (es: $foo)
- type : (optional) Must be a valid type-string: num, string. Default is: string.
- value : The symbols’ value.
Example:
# python manage.py exec_expr --stdin mason '10 * $myvariable'
$myvariable=num=5
*Ctrl+D*
Output:
2013-07-25 18:57:53,205 DEBUG MainThread > Loading tenant environment 2013-07-25 18:57:53,220 DEBUG MainThread > Using default tenant: <Tenant:10a279a6ce5c4438a98f9c33c0b77cde:site> ... ... ... 2013-07-25 18:58:03,262 DEBUG MainThread > evaluated() VALUE: 50.0 INFOS:
9.5.2.2.18.3. Specify the expression from standard input¶
If you want to specify the expression from standard input, you must append a blank line after parameters’ lines and enter the expression string.
Esample:
# python manage.py exec_expr --stdin mason '10 * $myvariable' $myvariable1=hello $myvariable2=world $myvariable3=it's $myvariable4=me $myvariable + 1 *Ctrl+D*
Output:
2013-07-25 18:57:53,205 DEBUG MainThread > Loading tenant environment 2013-07-25 18:57:53,220 DEBUG MainThread > Using default tenant: <Tenant:10a279a6ce5c4438a98f9c33c0b77cde:site> ... ... ... 2013-07-25 18:58:03,262 DEBUG MainThread > evaluated() VALUE: 6 INFOS:
9.5.2.2.19. exec_timegraph¶
Launch:
sanet-manage exec_timegraph [opzioni] <datagroup> <timegraph name> sanet-manage exec_timegraph [opzioni] <timegraphid>
Testare un timegraph
Le opzioni disponibili sono:
--tenant <nome> Esegue il datagroup del tenant specificato. Default: Tenant primario --seconds <n> Imposta quanto indietro nel tempo rispetto all'istante di esecuzione utilizzare per calcolare i dati delle serie. --export Le serie del timegraph vengono esportate in formato CSV --graph Show graph with ascii.
9.5.2.2.19.1. Esempi¶
Alcuni esempi:
sanet-manege exec_timegraph 8f4e95cd2de54a888cfd92eb974ae83b --seconds=3000 --export sanet-manage exec_timegraph 'localhost;;icmp-reachability' rttgraph --seconds=3000 --export
9.5.2.2.20. extract_conditions¶
Syntax:
sanet-manage extract_conditions [options]
List all the defined conditions.
Options:
--tenant <tenant> Specify the tenant to use. --priority_value <num> Filter by priority value *num*. --priority_label <label> Filter by priority level *name*.
Output format:
<element type> , <primary flag> , <path>
Example:
node,*,localhost;;icmp-reachability;reach
9.5.2.2.21. fetch_ds_rrddata¶
Sintassi:
sanet-manage fetch_ds_data [-h] [--tenant <name> ] -- <path | uuid> [-s <start>] [-e <end>]
Important
E’ fondamentale che la sequenza di escape ‘–’ venga indicata prima del <path> o <uuid>.
Opzioni:
-h Mostra l'help --tenant <name> Specifica su quale tenant cercare il datasource <path> -s <start> Istante temporale di inizio estrazione. -e <end> Istante finale di inizio estrazione.
I parametri start e end permettono di specificare un valore nei seguenti formati:
- timestamp (es. 121342342)
- range tempolae supportato da RRDTOOL (es: -400s, -8h, ecc.)
Esempio:
sanet-manage fetch_ds_rrddata -- 'localhost;;cpu-hr;cpuperc-hr' -s -408s
9.5.2.2.22. filter_poller_log¶
This command is for debug only. Do not use.
9.5.2.2.23. fix_dead_users¶
Poiche’ il database e’ suddiviso in schemi, quando un utente viene cancellato il sistema di “delete cascade” di django potrebbe non “azzerare” correttamente i field “owner” in diverse tabelle.
Questo comando verifica e azzera il field “owner” se associato ad un User.id non piu’ esistente.
9.5.2.2.24. get_config¶
Lancio:
sanet-manage get_config [ option_name ]
Produce un dump su standard output della configurazione corrente del sistema caricata dal file di configurazione “settings.py”.
Questo comando e’ utile per estrarre informazioni parziali di configurazione:
$ sanet-manage get_config SANET_INSTALL_DIR /usr/share/sanet
Per avere tutta la configurazione:
$ sanet-manage get_config ... BASE_DIR /opt/sanet3 BASE_URL_PREFIX BASE_WEB_URL_PREFIX web BROKER_ADDRESS ('localhost',) BROKER_AUTH ('sanet', 'sanet') COMMENTS_ALLOW_PROFANITIES False ADMINS () ADMIN_FOR () ALLOWED_INCLUDE_ROOTS () APPEND_SLASH True AUTHENTICATION_BACKENDS ('sanet_common.django.auth.backends.dummy.DummyBackend',) BASE_DIR /opt/sanet3 BASE_URL_PREFIX BASE_WEB_URL_PREFIX web BROKER_ADDRESS ('localhost',) BROKER_AUTH ('sanet', 'sanet') CACHES {'default': {'LOCATION': '', 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}} ... ... ... ...
9.5.2.2.25. get_ds_filename¶
Read datasources’ path (or UUID) from stdin and returns the path of the related store file (RRD FILE)
Uso:
- ::
- sanet-manage get_ds_filename [options]
Opzioni:
--tenant name Seleziona il tenant di riferimento. --usauuid Legge da standainput UUID di datasource al posto di path.
Esempio 1:
sanet-manage get_ds_filename localhost;;cpu-hr;cpuperc-hr Cltr+D localhost;;cpu-hr;cpuperc-hr /home/dbilli/labs/sanet_data2/var/lib/site/rrds/481c58593e2e43aba411b39ce2c71936.rrd
Esempio 2:
sanet-manage get_ds_filename --useuuid 481c58593e2e43aba411b39ce2c71936 Cltr+D 481c58593e2e43aba411b39ce2c71936 /home/dbilli/labs/sanet_data2/var/lib/site/rrds/481c58593e2e43aba411b39ce2c71936.rrd
9.5.2.2.26. get_ds_path¶
Reads DataSource UUIDS from stdin and returns the corrisponding Sanet Path.
Uso:
sanet-manage get_ds_path [options]
Opzioni:
--tenant name Seleziona il tenant di riferimento.
Esempio 1:
sanet-manage get_ds_filename 481c58593e2e43aba411b39ce2c71936 Cltr+D localhost;;cpu-hr;cpuperc-hr
9.5.2.2.27. get_ds_storeinfo¶
Syntax:
sanet-manage get_ds_storeinfo <path|id>
Returns RRDTOOL informations about the RRD file linked to the given datasource.
Example:
# sanet-manage get_ds_storeinfo c620e819a12249df8771d5919556f280 filename = "............/rrds/c620e819a12249df8771d5919556f280.rrd" rrd_version = "0003" step = 60 last_update = 1522005473 header_size = 584 ds[data].index = 0 ds[data].type = "GAUGE" ds[data].minimal_heartbeat = 3600 ds[data].min = NaN ds[data].max = NaN ds[data].last_ds = "U" ds[data].value = NaN ds[data].unknown_sec = 53 rra[0].cf = "AVERAGE" rra[0].rows = 525600 rra[0].cur_row = 216338 rra[0].pdp_per_row = 1 rra[0].xff = 5.0000000000e-01 rra[0].cdp_prep[0].value = NaN rra[0].cdp_prep[0].unknown_datapoints = 0
9.5.2.2.28. helpme¶
Syntax:
sanet-manage helpme
Show Sanet’s shell commands.
Example:
# sanet-manage helpme [core] agentinfo Query running agent. broker_info Show broker informations. cache_info Show cache informations. clean_rrds Print old/unused datasources files (RRD files) create_datasource_store Create datasource store file (RRD file) datasource_produce_random_values Produce random values for the specified datasource. dbshell2 dbusage Show DataBase usage (pending connections/queries) exec_datagroup Execute an existing datagroup exec_expr Execute a generic expression. exec_timegraph Processe and produce timegraph's series extract_conditions Estract conditions ... ... ...
9.5.2.2.30. push_event¶
Push generic event and process it with the matching with passive datagroup
TODO
INTERNAL COMMAND. DO NOT USE.
9.5.2.2.31. remove_old_logs¶
Rimuove (per uno o tutti i tenant) alcuni dati piu’ vecchi di una data specificata.
La sintassi e’:
remove_old_logs [options] <YYYY-MM-GG>
I dati che vengono rimossi sono: - log delle variazioni di stato delle condition - allarmi di entables
TODO
9.5.2.2.32. sanetdata¶
Lancio:
sanet-manage sanetdata
- Questo comando effettua un checkup dell’installazione effettuando le seguenti operazioni automatiche:
- inizializzazione di directory/file di sistema
- aggiornamento del database da una release all’altra
- fix di dati corrotti
Danger
questo comando deve essere SEMPRE eseguito quando sanet NON e’ in esecuzione.
Note
Questo comando puo’ essere lanciato un numero illimitato di volte.
Attention
Questo comando cancella le sessioni WEB attualmente memorizzate dal sistema. Una volta lanciato, tutte le sessioni WEB che richiedono autenticazione (login) devono essere ripristinate.
9.5.2.2.33. sanetdinfo¶
Send commands to Sanet main daemon (sanetd).
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.2.2.36. statusdinfo¶
Syntax:
sanet-manage statusdinfo --status
Returns internal status of the statusd subprocess.
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.2.2.37. test_user_password¶
Questo comando verifica le credenziali di accesso di un utente utilizzando il modulo di autenticazione configurato per il sistema:
sanet-manage test_user_password <username>
Esempio:
$ sanet-manage test_user_password foo Password: ********* Invalid credentials
E’ utile per controllare se il sistema di autenticazione utilizzato funziona correttamente:
9.5.2.3. cli¶
9.5.2.3.1. sanetcli¶
Questo comando lancia la CLI di sanet. I seguenti comandi sono equivalenti:
$ sanet-cli
$ sanet-manage sanetcli
9.5.2.3.2. sanetcli¶
Si rimanda alla sezione: CLI (Command Line Interface).
9.5.2.4. webui¶
9.5.2.4.1. clean_temp_web_data¶
Lancio:
sanet-manage clean_temp_web_data
Rimuove tutti i file temporanei prodotti dall’interfaccia web durante la gestione delle richieste.
Le directory che vengono controllate sono:
{{VAR_DIR}}/ <tenant uuid> / media / timegraph_images / *
9.5.2.5. tags¶
9.5.2.5.1. debug_tag_state¶
Questo comando serve per analizzare l’albero di calcolo degli stati di un TagTree e/o uno specifico Tag di quel Tree.
Utilizzo:
sanet-manage debug_tag_state <nome tree> [ <path tag completo ]
Esempio:
sanet-manage debug_tag_state tree1
sanet-manage debug_tag_state tree1 "tree1:/Global/Sedi"
sanet-manage debug_tag_state tree1 "tree1:/Global/Sedi/Pontecchio Marconi"
9.5.2.5.2. fix_parental_relationships¶
Questo comando serve per analizzare l’albero dei tagtree e fixare eventuali “parentele” sbagliate nei datagroup.
Utilizzo:
sanet-manage fix_parental_relationships <nome tree> [--tenant <nome tenant>]
Esempio:
sanet-manage fix_parental_relationships geo
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.2.5.3. get_missing_dgtag_number¶
Questo comando serve per analizzare l’albero dei tagtree e fixare eventuali “parentele” sbagliate nei datagroup.
Utilizzo:
sanet-manage get_missing_dgtag_number [--tenant <nome tenant>]
Esempio:
sanet-manage get_missing_dgtag_number
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.2.5.4. get_tag_uuid¶
Usage:
sanet-manage get_tag_uuid <tag path>
Prints on standard output the UUID of the given <tag path>.
Example:
$ sanet-manage get_tag_uuid geo:/geo 9677479ea62143ccb6c35e0913b43f57
If the give <tag path> does not exist, the command exits with return code -1.
9.5.2.5.5. get_untagged_nodes¶
Uso:
sanet-manage get_untagged_nodes [ --tenant <name> ] [ --trees <nomi tree> ]
Restituisce l’elenco dei nodi non presenti in nessuno dei tagtree esistenti (o elencati dal parametro trees) per il tenant tenant.
Esempio: Elenco di tutti i nodi non taggati dentro i tree geo e rancid
sanet-manage get_untagged_nodes --tenant site --trees geo,rancid
9.5.2.5.7. tag_find_missing_dgs¶
Questo comando serve per taggare i datagroup non taggati insieme ai propri elementi.
Utilizzo:
sanet-manage tag_find_missing_dgs <tagtree id or name> [--tenant <nome tenant>]
Esempio:
sanet-manage tag_find_missing_dgs <tagtree id or name>
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.2.5.8. tags_cleanup¶
Remove broken references to deleted elements (nodes, interface, conditions, ecc..)
Usage:
sanet-manage tags_cleanup
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.3. Other modules¶
9.5.3.1. entables¶
9.5.3.1.1. entables_cmdline¶
Syntax:
sanet-manage entables_cmdline [options]
or:
entables [options]
See Comandi di gestione.
9.5.3.1.2. entables_ctl¶
Send commands to Entables’s daemon.
Warning
This is an internal Sanet command. It is not recommended to use this command.
9.5.3.1.3. entables_server¶
INTERAL COMMAND. DO NOT USE.
9.5.3.1.4. entables_test_tags¶
Syntax:
sanet-manage entables_test_tags share/files/sanet_alarm_example.json ' ${alarmid} '
Questo comando serve per testare manualmente i tags di entables a partire da un allarme di sanet in formato JSON:
Warning
Questo e’ un comando di debug. Non utilizzare.
9.5.3.2. utils¶
9.5.3.2.1. show_exec_times¶
Syntax:
sanet-manage show_exec_times [ --tree <name>,<name>,<name,...]
The program will show the total execution time for a single node. The total execution time for a node is calculated by summing all node’s datagroups last execution time.
Options:
--tree List of comma-seprated tagtree names. If the nodes is tagged inside anyone of the specified tagtree, the command will show the related tags' path.
Example:
# sanet-manage show_exec_times NODE TIME TAGS internet 0.248# sanet-manage show_exec_times NODE TIME TAGS internet 0.248