/usr/share/augeas/lenses/dist/nutupsmonconf.aug is in nut-client 2.7.2-4ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | (*
Module: NutUpsmonConf
Parses /etc/nut/upsmon.conf
Author: Raphael Pinson <raphink@gmail.com>
Frederic Bohe <fredericbohe@eaton.com>
About: License
This file is licensed under the GPL.
About: Lens Usage
Sample usage of this lens in augtool
* Print all notification messages
> print /files/etc/nut/upsmon.conf/NOTIFYMSG
About: Configuration files
This lens applies to /etc/nut/upsmon.conf. See <filter>.
*)
module NutUpsmonConf =
autoload upsmon_xfm
(************************************************************************
* Group: UPSMON.CONF
*************************************************************************)
(* general *)
let del_spc = Util.del_opt_ws ""
let sep_spc = Util.del_ws_spc
let eol = Util.eol
let num = /[0-9]+/
let word = /[^"#; \t\n]+/
let empty = Util.empty
let comment = Util.comment
let quoted_string = del "\"" "\"" . store /[^"\n]+/ . del "\"" "\""
(* UPS identifier
* <upsname>[@<hostname>[:<port>]]
*
* There might be a cleaner way to write this
* but I'm stuck with (hostname | hostname . port)?
*)
let hostname = [ label "hostname" . store /[^ \t\n:]+/ ]
let port = [ label "port" . store num ]
let identifier = [ label "upsname" . store /[^ \t\n@]+/ ]
. ( ( Util.del_str "@" . hostname )
| ( Util.del_str "@" . hostname
. Util.del_str ":" . port ) )?
let upsmon_num_re = "DEADTIME"
| "FINALDELAY"
| "HOSTSYNC"
| "MINSUPPLIES"
| "NOCOMMWARNTIME"
| "POLLFREQ"
| "POLLFREQALERT"
| "RBWARNTIME"
let upsmon_num = [ del_spc . key upsmon_num_re . sep_spc . store num . eol ]
let upsmon_word = [ del_spc . key "RUN_AS_USER" . sep_spc . store word . eol ]
let upsmon_file_re = "NOTIFYCMD"
| "POWERDOWNFLAG"
| "SHUTDOWNCMD"
let sto_to_eol = IniFile.sto_to_eol
(* here we should support both quoted and not quotted
* string but I can't manage to find the right way of doing this
*)
let upsmon_file = [ del_spc . key upsmon_file_re . sto_to_eol . eol ]
(* MONITOR system powervalue username password type *)
let upsmon_monitor = [ del_spc . key "MONITOR" . sep_spc
. [ label "system" . identifier ] . sep_spc
. [ label "powervalue" . store num ] . sep_spc
. [ label "username" . store word ] . sep_spc
. [ label "password" . store word ] . sep_spc
. [ label "type" . store word ] . eol ]
let upsmon_notify_type = "ONLINE"
| "ONBATT"
| "LOWBATT"
| "FSD"
| "COMMOK"
| "COMMBAD"
| "SHUTDOWN"
| "REPLBATT"
| "NOCOMM"
| "NOPARENT"
let upsmon_notify = [ del_spc . key "NOTIFYMSG" . sep_spc
. [ label "type" . store upsmon_notify_type . sep_spc ]
. [ label "message" . quoted_string ] . eol ]
let flags = "IGNORE"
| "SYSLOG"
| "WALL"
| "EXEC"
let plus = [ del /\+*/ "" ]
(*let entries = /IGNORE|SYSLOG|WALL|EXEC+/*)
let record = [ seq "record" . plus . store flags ]
let upsmon_notify_flag = [ counter "record"
. del_spc . key "NOTIFYFLAG" . sep_spc
. [ label "type" . store upsmon_notify_type . sep_spc ]
. record+ . eol ]
let upsmon_record = upsmon_num|upsmon_word|upsmon_file|upsmon_monitor|upsmon_notify|upsmon_notify_flag
let upsmon_lns = (upsmon_record|comment|empty)*
let upsmon_filter = ( incl "/etc/nut/upsmon.conf" )
. Util.stdexcl
let upsmon_xfm = transform upsmon_lns upsmon_filter
|