aboutsummaryrefslogtreecommitdiff
path: root/src/ping903q.c
AgeCommit message (Collapse)AuthorFiles
2020-03-07ping903q: new option "-a"Sergey Poznyakoff1
* NEWS: Update. * README: Update. * configure.ac: Version 0.5.90 * doc/ping903q.1: Update. * src/ping903q.c: Disallow the use without arguments. New option -a: query statistics for "all" monitored IPs.
2020-03-07Simplify entry point structure.Sergey Poznyakoff1
The /ip entry point is gone. The /hosts entry point accepts new query arguments: (1) select=LIST, which introduces a list of IP addresses (hostnames) to query and (2) attr=LIST - a list of attributes to return in each stat object. In both cases, LIST is a comma-separated list of values. The "select" argument can be used together with explicit host (/hosts/IP?select=LIST), which is equivalent to /hosts/?select=IP,LIST. The /match entry point takes the "select" query argument as well. It return array of match objects. Each match object contains at least the following attributes: - name: original host name used in the request - hosts: array of monitored host names or IPs corresponding to that name, (can be empty). If an error occurred (e.g. host name cannot be resolved) the "error" attribute contains the textual description of the error. The ping903q utility now accepts one or more IP addresses as arguments in all modes, except nagios check. The statistics or matches for each IP are returned separately. * README: Document changes. * doc/ping903q.1: Likewise. * src/ping903.c (http_log): Log query arguments, if any. (ept_host_stat): Accept query arguments: select and attr. Return array of stat objects. (ept_ip_stat): Remove. (ept_ip_match): Accept query arguments: select. Rewrite output. (endpoint): Remove /ip * src/ping903.h (get_ipaddr_stat): Remove. (get_host_matches): Change signature. * src/ping903q.c (HTTP_BUF_INITIALIZER): New macro. (http_buf_init, http_buf_free): New functions. (query_host,match_host): Removed. (query_hosts,match_hosts): Removed. (query_host_nagios): New function. * src/pinger.c (get_ipaddr_stat): Remove. (hostping_match): New function. (get_host_matches): Rewrite.
2020-03-05ping903q: improve output in Nagios mode; treat initial state as OKSergey Poznyakoff1
New option -N is provided to treat the initial state as UNKNOWN as in previous versions.
2020-02-28Implement here-document syntax in configuration file.Sergey Poznyakoff1
Here-document is supported for ip-list and trusted-ip statements. * doc/ping903.conf.5: Document the here-document syntax. * NEWS: Likewise. * examples/inspect: Mention that the created output is a valid configuration file. * src/config.c: Support for here-document. * src/defs.h: Mark printf-like functions as such. * src/ping903.h (CF_HEREDOC_OPCODE): New data type. (cf_callback_arg): Add heredoc member. (STMT_T_HEREDOC): New statement type. * src/remoteip.c (cf_trusted_ip_heredoc): New function. * src/ping903.c: Fix format strings and unused variables. * src/ping903q.c: Likewise. * src/pinger.c: Likewise.
2020-02-28Minor fixSergey Poznyakoff1
2020-02-27Add missing copylefts; improve docsSergey Poznyakoff1
2020-02-27ping903q: optionally supply credentials in the command lineSergey Poznyakoff1
New command line option -R supplies the authentication realm for ping903q. If given, the credentials for that realm will be looked up on startup and sent with each HTTP request. This allows the program to avoid sending an extra HTTP request. * src/ping903q.c (get_auth_creds): Split into two functions: get_auth_creds and get_realm_creds. (http_query): Don't attemt send lookup for authorization credentials. (main): New option -R (authentication realm). Look up credentials for that realm if given.
2020-02-27Implememt client-side basic authSergey Poznyakoff1
* lib/Makefile.am: Add base64.c * lib/base64.c: New file. * lib/basicauth.c: Move base64 support to a separate source. * lib/basicauth.h (base64_encode,base64_decode): New protos. * src/strsplit.c: New file. * src/Makefile.am (libping903_a_SOURCES): Add strsplit.c * src/defs.h (CRED_FILE_NAME): New macro. (ecalloc,strsplit,argcv_free): New proto. * src/mem.c (ecalloc): New function. * src/ping903.c (strsplit): Remove. (cf_auth): Use modified strsplit. * src/ping903q.c (http_query): Attempt to authenticate if basic auth is required. * examples/lib/LWP/Ping903.pm: New file. * examples/dbload: Use LWP::Ping903 * examples/inspect: Likewise. * examples/ipadd: Likewise. * examples/ipdel: Likewise.
2020-02-24Minor fixes in json parser.Sergey Poznyakoff1
* src/json.c (json_strerror): New function. (json_parse_string): Fix coredump on invalid objects. * src/json.h (json_strerror): New proto. * src/ping903q.c (json_parse_string): Remove.
2020-02-24Improve ping903q output in Nagios check modeSergey Poznyakoff1
* doc/ping903q.1: Document the -p option. * src/ping903q.c: Use configurable prefix in Nagios mode. Round up loss percentage to 2 decimal digits on output.
2020-02-24Fix nagios check output for unreachable hosts.Sergey Poznyakoff1
* src/ping903q.c (nagios_check): Fix output for unreachable hosts.
2020-02-19Fix handling of missing replies.Sergey Poznyakoff1
* src/ping903.h (hostaddr): New member recv_tv. * src/ping903q.c (print_host_status): gracefully handle absense of the "stddev" attribute. Include IP address (or host name) to the nagios check output. * src/pinger.c: Get rid of the send queue. Send echo requests in batches each ping_interval. Correctly handle missing replies.
2020-02-18Fix ping903q in nagios check mode.Sergey Poznyakoff1
This was broken in a744738c. * src/ping903q.c (nagios_check): Fix handling of the status attribute.
2020-02-14Version 0.2v0.2Sergey Poznyakoff1
* NEWS: Update. * README: Update. * THANKS: Update. * doc/ping903.8: Spell checking. * doc/ping903q.1: Likewise. * src/Makefile.am: Distribute ping903.conf * src/ping903.h (HOST_STAT_INIT) (HOST_STAT_VALID,HOST_STAT_PENDING) (HOST_STAT_INVALID): New constants. (host_stat): New member "status". (host_stat_is_valid): Rewrite using status. * src/ping903q.c: "status" is string now. Handle particular values. * src/pinger.c: Maintain current status of each host_stat structure in the status member. (host_stat): Mark object as valid. (host_reset): Update status. (get_host_stat): Report object validity in the "validity" member, and its current status in "status" (string). * src/json.c: Implement json_value_copy. * src/json.h (json_value_copy): New proto. * src/ping903.c (ept_config): Return particular setting, if so requested.
2020-02-13Implement IP lookup and match mode.Sergey Poznyakoff1
* src/ping903.c: Implement two new endpoints: /ip and /match, for IP lookup and match mode. * src/ping903.h (get_ipaddr_stat) (get_host_matches): New protos. * src/pinger.c (get_ipaddr_stat) (get_host_matches): New functions. * src/ping903q.c (resolve_ip): New global. (query_host): Use /host or /ip depending on the value of resolve_ip. (match_host): New function. * doc/ping903q.1: Update.
2020-02-13ping903q: resolve supplied argument before querying; improve error handlingSergey Poznyakoff1
2020-02-13Implement nagios check mode in ping903qSergey Poznyakoff1
2020-02-13Change default listen address to 127.0.0.1Sergey Poznyakoff1
2020-02-12Add manpagesSergey Poznyakoff1
2020-02-12Separate ping-interval and probe-intervalSergey Poznyakoff1
* configure.ac: Use AM_PROG_AR * src/config.c: rename "interval" to "ping-interval". New statement: "probe-interval". (readconfig): Signal error if ping_count probes don't fit into probe_interval. * src/ping903.conf: Update. * src/ping903.h (host_stat): Rename "tv" to "start_tv". New member: "stop_tv". * src/pinger.c (probe_interval): New global. (sendq_enqueue_unlocked): Remove. (sendq_enqueue): Set xmit_tv to the time when this host should be probed again. (sendq_dequeue): Sleep until the right ping time. (p903_sender): Don't lock sendq_mutex. This is done by sendq_dequeue. (host_stat): Save start_tv and stop_tv. (get_host_stat): Format stop-timestamp and recv-timestamp. * src/main.c: Use sysexits. * src/ping903q.c (print_host_status): Use stop-timestamp and recv-timestamp to calculate duration.
2020-02-12Implement simple query utilitySergey Poznyakoff1
* configure.ac: Test for ranlib * src/.gitignore: Update. * src/ping903q.c: New file. * src/Makefile.am: Build ping903q * src/defs.h: New file. * src/mem.h: New file. * src/json.h (json_2nrealloc): New proto. * src/config.c: New statement: "access-log-verbose" Change error codes to positive values. * src/main.c: Use DEFAULT_CONFIG_FILE instead of hardcoding the file name. * src/ping903.c: Log json object only if access-log-verbose has been requested. * src/ping903.conf: Document access-log-verbose * src/ping903.h (HOSTADDR): Rename tv to xmit_tv. New member: start_tv. * src/pinger.c: Keep the time when first packet has been sent in the start_tv member.

Return to:

Send suggestions and report system problems to the System administrator.