Skip to content

Commit 431da78

Browse files
authored
Merge pull request #3178 from atanas-vladimirov/json
upsc: Add -j option for JSON output
2 parents 78e0257 + 226520e commit 431da78

File tree

11 files changed

+332
-88
lines changed

11 files changed

+332
-88
lines changed

Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ SUBDIR_TGT_RULE = ( \
208208
all-libs-local/include:
209209
+@$(SUBDIR_TGT_RULE)
210210

211-
### Delivers: libcommon.la libcommonclient.la libcommonstr.la
211+
### Delivers: libcommon.la libcommonclient.la libcommonstr.la libcommonstrjson.la
212212
### (consume only one of these at a time!)
213213
### Delivers: libcommonversion.la (only version methods)
214214
### Delivers: libparseconf.la libnutconf.la libnutwincompat.la
@@ -329,6 +329,7 @@ all/common: all/include all-libs-local/common
329329
### Requires-ext: common/libcommon.la common/libcommonclient.la
330330
### Requires-ext: common/libparseconf.la
331331
### Requires-ext: common/libcommonversion.la
332+
### Requires-ext: common/libcommonstrjson.la
332333
### Requires-int: libupsclient.la
333334
all/clients: all/common all-libs-local/clients
334335
+@$(SUBDIR_TGT_RULE)

NEWS.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ NOTE: If using `upssched` and monitoring multiple UPSes, consider setting up
198198
a `START-TIMER-SHARED` rule with a short (approx. 1 second) timeout to group
199199
several `FSD` notifications into one executed action. [PR #3097]
200200

201+
- `upsc` has now optional JSON output [issue #3172, PR #3178]
202+
201203
- `upsset` should now recognize `RANGE NUMBER` and `NUMBER` types. [#3164]
202204

203205
- `upsstats` has now JSON output mode via `?json` (or `&json`) CGI query

clients/Makefile.am

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ AM_CXXFLAGS = -DHAVE_NUTCOMMON=1 -I$(top_srcdir)/include
2121
$(top_builddir)/common/libcommon.la \
2222
$(top_builddir)/common/libcommonclient.la \
2323
$(top_builddir)/common/libcommonversion.la \
24+
$(top_builddir)/common/libcommonstrjson.la \
2425
$(top_builddir)/common/libparseconf.la: dummy
2526
+@cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F)
2627

@@ -91,6 +92,7 @@ if WITH_CGI
9192
endif WITH_CGI
9293

9394
upsc_SOURCES = upsc.c upsclient.h
95+
upsc_LDADD = $(LDADD_CLIENT) $(top_builddir)/common/libcommonstrjson.la
9496
upscmd_SOURCES = upscmd.c upsclient.h
9597
upsrw_SOURCES = upsrw.c upsclient.h
9698
upslog_SOURCES = upslog.c upsclient.h upslog.h
@@ -114,6 +116,7 @@ upsimage_cgi_LDADD = $(LDADD) $(LIBGD_LDFLAGS)
114116
upsset_cgi_SOURCES = upsset.c upsclient.h cgilib.c cgilib.h
115117
upsstats_cgi_SOURCES = upsstats.c upsclient.h status.h upsstats.h \
116118
upsimagearg.h cgilib.c cgilib.h
119+
upsstats_cgi_LDADD = $(LDADD_CLIENT) $(top_builddir)/common/libcommonstrjson.la
117120

118121
# not LDADD... why?
119122
libupsclient_la_SOURCES = upsclient.c upsclient.h

0 commit comments

Comments
 (0)