syspoll [ -c configfile ] [ -r retries[:interval] ] -a { start | retry } -j jobname [ -s setname ] [ -t hostlist ] [ -o outputfile ]
syspoll [ -c configfile ] -a { list_retry } -j jobname [ -s setname ]
syspoll [ -c configfile ] -a { list_jobs | list_sets | list_prots | list_perf }
syspoll [ -c configfile ] -a { print_log [ -b begin_date ][ -e end_date ] }
The main purpose is to centrally control report data collection for different target operating systems.
syspoll writes all command status and information output to stderr and only the job header and the query results to stdout respectively the outputfile if specified.
The following phases are traversed when a syspoll job is executed ( start or retry ) in a certain set:
print general information about the environment where syspoll is started, the configuration and the impact of some configuration- and command line options.
print information about the set.
print information about the job.
write the job header as specified in the JOB_HEADER setting in VARDIR/jobs/<jobname>/job.cfg to the outputfile (if specified) and stdout if the action -a start is selected.
If if the action -a retry is selected, the job header is not written (again) to the outputfile and is printed for reference purposes to stderr only.
connect to all systems as specified in the system target list using -t hostlist, the retry file or the POLL_HOSTLIST setting in the etc/syspoll.cfg file depending on the command line options selected.
try to resolve connection information, as the IP address, of the system to connect to. If the IP address cannot be resolved, no connection is possible (of course).
If the IP address could be resolved in the previous step, probe the connection to the target system using is_up(3) internally.
when the connection has been probed successfully, probe the operating system of the target system. This is actually the first test to check if a login to the target system is possible respectively, depending on the protocol, information can be queried from the target system.
if the operating system has been probed successfully in the previous step, handle the job query.
if there are payload files present for the job, deploy (copy) the payload files to the target system. Not all protocols might be capable to deploy payload files (see: lib/syspoll/protocols/<VARIANT>/<PLUGIN>).
Payload files are additional programs, scripts or other data that is needed by the query to do its work and are not present on the target system.
if a query is defined, execute the query on/for the target system. When queries are written it is important to output all relevant query result data to stdout. Data/information printed to stderr will be seen on the screen but not saved in the outputfile.
If a query could be executed syspoll rates the related target system as processed successfully and it is removed from the retry list.
remove the deployed files from the target systems again.
print an execution summary of the job.
As soon as it is possible, syspoll forecasts a completion of the entire job run based on the elapsed time, the total number of systems to process and the number of already processed target systems. The forecast is adjusted constantly.
syspoll has a plugin mechanism, where new protocols or new variants of protocols can be integrated.
New protocols might be SNMP or a database plugins to connect to PostgreSQL, mySQL, MSSQL or Oracle.
Protocol variants are existing protocols, but customized in the fine details of the connection method and the execution of queries. This might be the case if in a certain compliance situation it is only allowed to execute queries on remote systems using sudo(8). For this a variant of an existing protocol can be created without adjusting jobs.
A set is a handle to specify some specific additional general credentials that are valid for a job; as the login credentials used to execute the query and the protocol variant used. With sets it is possible to write a job query and use it without modifications for different target customer environments even if the user names, passwords and the details to connect to the systems change.
When a job is started first with the setname ACME and then with Riptide, for each set an own retry list is maintained. It is intended to use the customer name as setname or a combination of the customer name and the targeted customer environment, as: ACME.TEST.
The default setname is the customer name of the environment where syspoll is started as returned by server_environment -C or default if the set configuration for the customer name does not exist.
A set is represented by a configuration file in the var/syspoll/sets/ directory.
See also: server_environment(3).
The job header as specified in the JOB_HEADER setting in VARDIR/jobs/<jobname>/job.cfg is written once to the outputfile at the beginning of the job execution when the start action is executed.
The job header as specified in the JOB_HEADER setting in VARDIR/jobs/<jobname>/job.cfg is not written to the outputfile when the retry action is executed.
Currently the protocols SSH (secure shell) and WMI (Windows Management Instrumentation) are distributed with WA2L/edrc for syspoll.
The file has to be specified with an absolute path name.
When a dash is specified as hostlist (example: syspoll -a start -j poll -t -) the system target list is read from stdin.
The outputfile has to be specified as an absolute path name. See also: rel2abs(3) to see how to convert a relative path name to an absolute.
The VARDIR can be defined in the syspoll.cfg file. Default is edrc/var/syspoll/.
Query to be executed on a given operating system and the related protocol (<PROTOCOL>).
The following variables are exported to the query execution: JOB_LOCALUSER, JOB_REMOTEUSER, JOB_PAYLOAD, JOB_QUERY, JOB_PROTOCOL, JOB_PASSWORD, JOB_LOCALTEMP, JOB_POSTQUERY, JOB_HOSTNAME, AWK, ECHO, TAIL and OSID.
The retry file is reset when -a start is invoked.
When -a retry is issued once or multiple times, systems with a successful retry are removed from the retry file, unsuccessful systems remain in the file.
As always in WA2L/edrc, if the setup in server_environment.cfg and hostlist.cfg is done, the command runs within the environment without specifying targets. Therefore the options -s setname and -t hostlist can be omitted when the systems that are polled reside in the same environment as the host where syspoll is executed.
Thus, the most simplest invocation of syspoll is:
[ / ] [ root@acme001 ][*eshell*/bash] syspoll -a start -j bdf [ / ] [ root@acme001 ][*eshell*/bash] syspoll -a retry -j bdf
The two example jobs referenced in this section are probe and bdf, where probe tests connections to target systems without executing a real query and bdf resolves the file system disk space usage as done by df(1) or bdf(1) and returns the result as csv file having the format 'HOST;FILESYSTEM;TOTAL;FREE;USED;%USED;MOUNTPOINT;'.
The probe job is a job that is considered to be part of the syspoll command (therefore do not change it, create a copy if you need a modified version of it). This job does not have a real query, the purpose of this job is simply to test connections to the given targets and verify that the connection settings are correct.
[ / ] [ root@acme001 ][*eshell*/bash] syspoll -a start \ -s ACME -j probe \ -t acme002,acme003,acme004
[ / ] [ root@acme001 ][*eshell*/bash] syspoll -a start \ -s ACME -j bdf \ -t acme002,acme003,acme004 \ -o /tmp/bdf.csv
[ / ] [ root@acme001 ][*eshell*/bash] syspoll -a retry \ -s ACME -j bdf \ -o /tmp/bdf.csv
[ / ] [ root@acme001 ][*eshell*/bash] syspoll -a retry \ -s ACME -j bdf \ -t acme005,acme006 \ -o /tmp/bdf.csv
[ / ] [ root@acme001 ][*eshell*/bash] syspoll -a list_retry \ -s ACME -j bdf
See also: Example 10).
[ / ] [ root@acme001 ][*eshell*/bash] syspoll -a list_retry \ -s ACME -j bdf \ -t @WEB
[ / ] [ root@acme001 ][*eshell*/bash] syspoll -a start \ -s ACME -j probe \ -t /tmp/hostlist.txt
There is a file having pairs of hostnames and customer names separated by whitespaces:
acme001 ACME acme002 ACME websrv01 Bedrock erp5 Bedrock acme008 ACME :
Run the job only on targets that are used for the customer 'ACME':
[ / ] [ root@acme001 ][*eshell*/bash] \ awk '/\sACME$/{print $1}' < /tmp/assets.lst | \ syspoll -a start -s ACME -j probe -t -
Run the job only on targets that are used for the customer 'ACME':
[ / ] [ root@acme001 ][*eshell*/bash] sqlite /tmp/assets.db \ "select name from hosts where customer='ACME'" | \ syspoll -a start -s ACME -j probe -t -
See also: Example 6).
Using the setting USE_HOSTLIST_DAT=True and CMAN_ENVIRONMENT=Highlander.ADMIN in hostlist.cfg and when syspoll is started on a host that is member of the central management environment Highlander.ADMIN hostlist(3) can be used to address all targets of a certain customer.
Check if logged on to central management environment Highlander.ADMIN :
[ / ] [ root@adm001 ][*eshell*/bash]: whereami LOGGED ON TO SERVER ENVIRONMENT: Customer : Highlander Environment : ADMIN Description : Beringen, EDRC Development
Run the job only on targets that are used for the customer 'ACME':
[ / ] [ root@adm001 ][*eshell*/bash] syspoll -a start \ -s ACME -j bdf -t `hostlist -l -g @ACME.ALL`
Print a formatted list from csv output:
[ / ] [ root@acme001 ][*eshell*/bash] syspoll -a start \ -s ACME -j bdf | print_list
Print a formatted list from csv output with a reduced set of columns:
[ / ] [ root@acme001 ][*eshell*/bash] syspoll -a start \ -s ACME -j bdf \ -t acme002,acme003,acme004 | \ select_columns ";" "HOST;MOUNTPOINT;TOTAL" | print_list
Omit status information output during data collection:
[ / ] [ root@acme001 ][*eshell*/bash] syspoll -a start \ -s ACME -j bdf \ -t acme002,acme003,acme004 \ 2>/dev/null | \ select_columns ";" "HOST;MOUNTPOINT;TOTAL" | print_list
See also: Example 13), NOTES.
[ / ] [ root@acme001 ][*eshell*/bash] syspoll -a start \ -s ACME -j bdf \ -o ~edrc/var/www/report/006/ACME/bdf/acme__bdf_`date +%Y%m%d`.csv
See also: Example 12), NOTES.
In this example the collected query results are saved to the $HOME directory of the user 'report' what allows to access the report output directories thru ~report from shell, scripts etc. independent of the actual userhome location.
Preparations to provide the collected data with WA2L/edrc:report:
1) create the directory structure to save the collected data
[ / ] [ root@acme001 ][*eshell*/bash] mkdir ~report/ACME/bdf/ [ / ] [ root@acme001 ][*eshell*/bash] chmod 755 ~report/ACME/bdf/
2) create a symbolic link from WA2L/edrc:report to the report data
[ / ] [ root@acme001 ][*eshell*/bash] symlink ~report ~edrc/var/www/report/006
Create the crontab entry:
1 0 25 * * [ -d ~report/ ] && ~edrc/bin/syspoll -a start -s ACME -j bdf \ -o ~report/ACME/bdf/acme__bdf_`date +%Y%m%d`.csv > /dev/null 2>&1 1 2-20 25 * * [ -d ~report/ ] && ~edrc/bin/syspoll -a retry -s ACME -j bdf \ -o ~report/ACME/bdf/acme__bdf_`date +%Y%m%d`.csv > /dev/null 2>&1
In this definition the job is started once at 00:01 on every 25th of every month.
Then on the same day the job retries to query the unsuccessful targets every hour between 02:01 and 20:01.
Due to the fact, that syspoll locks a job for a set during execution it also does not create a mess if this job here runs longer then an hour.
The output is saved to the ~report/ACME/bdf/ directory.
The output file uses the reverse date as filename element using the date(1) command acme__bdf_`date +%Y%m%d`.csv what results in a filename of acme__bdf_20130225.csv when executed on February 25th 2013 (see also: http://www.tugsat.tugraz.at/launch).
Start the bdf job for set ACME and save job query results to /tmp/diskspace.csv:
[ / ] [ root@acme001 ][*eshell*/bash]: syspoll -a start -j bdf \ -s ACME -t acme001,acme002,acme003,acme004,acme005,acme006 -o /tmp/diskspace.csv syspoll - poll systems, by Chr. Walther poll systems ... general information ... Customer ......... : WA2L Environment ...... : [ EDRC_DVLP ] Beringen, EDRC Development Action ........... : start Hostname ......... : acme001 Who .............. : root Operating System . : Linux acme001 3.13.0-45-generic #74-Ubuntu SMP Date ............. : Sat Feb 21 13:08:06 CET 2015 Revision ......... : 13 Configfile ....... : /opt/edrc/etc/syspoll.cfg VARDIR ........... : /opt/edrc/var/syspoll RETRY_COUNTER .... : 2 RETRY_INTERVAL ... : 2 OSID ............. : Linux done. set information ... setname .......... : ACME description ...... : ACME Hardware Corporation set. revision ......... : 00 protocol variant . : edrc done. job information ... jobname .......... : bdf description ...... : disk space revision ......... : 00 outputfile ....... : /tmp/diskspace.csv (create) done. job header ... HOST;FILESYSTEM;TOTAL;FREE;USED;%USED;MOUNTPOINT; done. connect to systems ... host 'acme001' [8/8] ... connection information ... hostname ......... : acme001 hostaliases ...... : ipaddress ........ : 10.10.10.11 done. probe connection ... up, success. done. probe operating system ... try protocol ...( SSH )... done. os name .......... : Linux os release ....... : 3.13.0-45-generic os machine ....... : x86_64 protocol ......... : SSH local user ....... : edrc remote user ...... : root done. handle query ... deploy query payload ... no payload to deploy, skip. done. execute query ... acme001;/dev/sda6;41151808;17058308;21980068;53.412156;/; acme001;none;4;4;0;0.000000;/sys/fs/cgroup; acme001;udev;1013352;1013348;4;0.000395;/dev; acme001;tmpfs;204832;203556;1276;0.622950;/run; acme001;none;5120;5120;0;0.000000;/run/lock; acme001;none;1024144;1023920;224;0.021872;/run/shm; acme001;none;102400;102364;36;0.035156;/run/user; acme001;/dev/sda1;999320;720620;209888;21.003082;/boot; acme001;/dev/sda2;51475068;2071508;46765736;90.851237;/home; done. clear query payload ... payload cleared. done. done. done. host 'acme002' [7/8] ... estimated job completion: 2015-02-21 13:08:24 connection information ... hostname ......... : acme002 hostaliases ...... : ipaddress ........ : 10.10.10.12 done. probe connection ... up, success. done. probe operating system ... try protocol ...( SSH )... done. os name .......... : SunOS os release ....... : 5.10 os machine ....... : i86pc protocol ......... : SSH local user ....... : edrc remote user ...... : root done. handle query ... deploy query payload ... no payload to deploy, skip. done. execute query ... <<< OUTPUT TO BE ADDED >>> done. clear query payload ... payload cleared. done. done. done. host 'acme003' [6/8] ... estimated job completion: 2015-02-21 13:08:24 connection information ... hostname ......... : acme003 hostaliases ...... : ipaddress ........ : 10.10.10.13 done. probe connection ... up, success. done. probe operating system ... try protocol ...( SSH )... done. os name .......... : AIX os release ....... : 6.1 os machine ....... : powerpc protocol ......... : SSH local user ....... : edrc remote user ...... : root done. handle query ... deploy query payload ... no payload to deploy, skip. done. execute query ... <<< OUTPUT TO BE ADDED >>> done. clear query payload ... payload cleared. done. done. done. host 'acme004' [5/8] ... estimated job completion: 2015-02-21 13:08:24 connection information ... hostname ......... : acme004 hostaliases ...... : ipaddress ........ : 10.10.10.14 done. probe connection ... up, success. done. probe operating system ... try protocol ...( SSH )... done. os name .......... : HP-UX os release ....... : B.11.31 os machine ....... : ia64 protocol ......... : SSH local user ....... : edrc remote user ...... : root done. handle query ... deploy query payload ... no payload to deploy, skip. done. execute query ... <<< OUTPUT TO BE ADDED >>> done. clear query payload ... payload cleared. done. done. done. host 'acme005' [4/8] ... estimated job completion: 2015-02-21 13:08:22 connection information ... hostname ......... : acme005 hostaliases ...... : ipaddress ........ : 10.10.10.15 done. probe connection ... up, success. done. probe operating system ... try protocol ...( SSH WMI )... done. os name .......... : Windows os release ....... : 2012 os machine ....... : protocol ......... : WMI local user ....... : edrc remote user ...... : root done. handle query ... deploy query payload ... no payload to deploy, skip. done. execute query ... <<< OUTPUT TO BE ADDED >>> done. clear query payload ... payload cleared. done. done. done. host 'acme006' [3/8] ... estimated job completion: 2015-02-21 13:08:22 connection information ... hostname ......... : acme006 hostaliases ...... : ipaddress ........ : done. probe connection ... cannot resolve ip address, skip. fail. probe operating system ... connection probe failed, skip. fail. handle query ... operating system probe failed, skip. fail. fail. host 'acme007' [2/8] ... estimated job completion: 2015-02-21 13:08:23 connection information ... hostname ......... : acme007 hostaliases ...... : ipaddress ........ : 10.10.10.17 done. probe connection ... cannot connect, wait . retry cannot connect, wait . retry not up, fail. fail. probe operating system ... connection probe failed, skip. fail. handle query ... operating system probe failed, skip. fail. fail. host 'acme008' [1/8] ... estimated job completion: 2015-02-21 13:08:54 connection information ... hostname ......... : acme008 hostaliases ...... : www.acme.com www.acme.ch ipaddress ........ : 10.10.10.18 done. probe connection ... up, success. done. probe operating system ... try protocol ...( SSH WMI )... done. os name .......... : unknown os release ....... : unknown os machine ....... : unknown protocol ......... : unknown fail. handle query ... operating system probe failed, skip. fail. fail. done. execution summary ... failure for: acme006,acme007,acme008 unknown for: summary: success/failure/unknown/total 5/3/0/8 done. done.
List targets in retry list:
[ / ] [ root@acme001 ][*eshell*/bash]: syspoll -a list_retry -j bdf -s ACME syspoll - poll systems, by Chr. Walther HOSTNAME -------- acme006 acme007 acme008 (1)
List performance information:
[ / ] [ root@acme001 ][*eshell*/bash]: syspoll -a list_perf syspoll - poll systems, by Chr. Walther SET JOB t/RUN t/TARGET SUCCESS_RATE RUNS TARGETS LAST_RUN -------- --------- -------- -------- ------------ ---- ------- ------------------- ACME bdf 0:03:35 0:00:26 62.50 % 1 8 2015-02-21 13:08:06 WA2L bdf 0:00:08 0:00:02 85.71 % 2 7 2015-02-21 13:06:39 WA2L probe 0:00:26 0:00:07 15.00 % 6 20 2015-02-21 11:43:12 default probe 0:00:01 0:00:00 0.00 % 1 3 2015-02-20 23:54:50 (4)
Retry job on failed targets and add additional query results to /tmp/diskspace.csv :
[ / ] [ root@acme001 ][*eshell*/bash]: syspoll -a retry -j bdf -s ACME -o /tmp/diskspace.csv syspoll - poll systems, by Chr. Walther poll systems ... general information ... Customer ......... : WA2L Environment ...... : [ EDRC_DVLP ] Beringen, EDRC Development Action ........... : retry Hostname ......... : acme001 Who .............. : root Operating System . : Linux acme001 3.13.0-45-generic #74-Ubuntu SMP Date ............. : Sam Feb 21 13:51:09 CET 2015 Revision ......... : 13 Configfile ....... : /opt/edrc/etc/syspoll.cfg VARDIR ........... : /opt/edrc/var/syspoll RETRY_COUNTER .... : 2 RETRY_INTERVAL ... : 2 OSID ............. : Linux done. set information ... setname .......... : ACME description ...... : ACME Hardware Corporation set. revision ......... : 00 protocol variant . : edrc done. job information ... jobname .......... : bdf description ...... : disk space revision ......... : 00 outputfile ....... : /tmp/diskspace.csv (append) done. job header ... HOST;FILESYSTEM;TOTAL;FREE;USED;%USED;MOUNTPOINT; done. connect to systems ... host 'acme006' [3/3] ... connection information ... hostname ......... : acme006 hostaliases ...... : ipaddress ........ : done. probe connection ... cannot resolve ip address, skip. fail. probe operating system ... connection probe failed, skip. fail. handle query ... operating system probe failed, skip. fail. fail. host 'acme006' [2/3] ... estimated job completion: 2015-02-21 13:08:22 connection information ... hostname ......... : acme007 hostaliases ...... : ipaddress ........ : 10.10.10.16 done. probe connection ... up, success. done. probe operating system ... try protocol ...( SSH )... done. os name .......... : Linux os release ....... : 3.13.0-45-generic os machine ....... : x86_64 protocol ......... : SSH local user ....... : edrc remote user ...... : root done. handle query ... deploy query payload ... no payload to deploy, skip. done. execute query ... acme007;/dev/sda6;41151808;17060952;21977424;53.405731;/; acme007;none;4;4;0;0.000000;/sys/fs/cgroup; acme007;udev;1013352;1013348;4;0.000395;/dev; acme007;tmpfs;204832;203560;1272;0.620997;/run; acme007;none;5120;5120;0;0.000000;/run/lock; acme007;none;1024144;1023920;224;0.021872;/run/shm; acme007;none;102400;102364;36;0.035156;/run/user; acme007;/dev/sda1;999320;720620;209888;21.003082;/boot; acme007;/dev/sda2;51475068;2068184;46769060;90.857694;/home; done. clear query payload ... payload cleared. done. done. done. host 'acme008' [1/3] ... estimated job completion: 2015-02-21 13:08:54 connection information ... hostname ......... : acme008 hostaliases ...... : www.acme.com www.acme.ch ipaddress ........ : 10.10.10.18 done. probe connection ... up, success. done. probe operating system ... try protocol ...( SSH WMI )... done. os name .......... : unknown os release ....... : unknown os machine ....... : unknown protocol ......... : unknown fail. handle query ... operating system probe failed, skip. fail. fail. done. done. execution summary ... failure for: acme006 unknown for: summary: success/failure/unknown/total 1/2/0/3 done. done.
List targets in retry list:
[ / ] [ root@acme001 ][*eshell*/bash]: syspoll -a list_retry -j bdf -s ACME syspoll - poll systems, by Chr. Walther HOSTNAME -------- acme006 acme008 (1)
See also: Example 12) and 13) in EXAMPLES, WA2Ledrc:report(1), edrcinit(1m), and 'http://hostname:9900 -> Help' for more information about WA2L/edrc:report.
This is free software; see edrc/doc/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.