initial commit of file from CVS for e-smith-nutUPS on Wed 12 Jul 09:01:20 BST 2023
This commit is contained in:
		
							
								
								
									
										3
									
								
								root/etc/e-smith/templates/etc/hosts.allow/upsd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								root/etc/e-smith/templates/etc/hosts.allow/upsd
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| { | ||||
|         $DB->hosts_allow_spec('nut','nut'); | ||||
| } | ||||
| @@ -0,0 +1,11 @@ | ||||
| { | ||||
| return "# The upsd admin is not allowed" if ($nut{AdminUser} ne 'enabled'); | ||||
| return "# The upsd admin has no password" if (($nut{AdminPass} || '') eq ''); | ||||
| return "# The upsd admin is not allowed when nut access is set to public" if $nut{access} eq 'public'; | ||||
|  | ||||
| my $upsd = $DB->hosts_allow_spec('nut','upsd'); | ||||
| $upsd =~ s|upsd:|upsd: admin op |; | ||||
|  | ||||
| $OUT .= qq(#Allow the Admin User of upsd | ||||
| $upsd : ALLOW) if ($nut{status} eq 'enabled'); | ||||
| } | ||||
							
								
								
									
										3
									
								
								root/etc/e-smith/templates/etc/services/30Nut
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								root/etc/e-smith/templates/etc/services/30Nut
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| #Nut Service | ||||
| nut              3493/tcp                       # Network UPS Tools | ||||
| nut              3493/udp                       # Network UPS Tools | ||||
							
								
								
									
										1
									
								
								root/etc/e-smith/templates/etc/sysconfig/ups/MODEL
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								root/etc/e-smith/templates/etc/sysconfig/ups/MODEL
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| MODEL=upsdrvctl | ||||
							
								
								
									
										1
									
								
								root/etc/e-smith/templates/etc/sysconfig/ups/SERVER
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								root/etc/e-smith/templates/etc/sysconfig/ups/SERVER
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| SERVER={ $nut{Master} || 'yes' } | ||||
| @@ -0,0 +1,16 @@ | ||||
| # nut UPS specific subservices | ||||
| { | ||||
| $nutstatus = $nut{status} || 'disabled'; | ||||
| $master = $nut{Master} || 'yes'; | ||||
|  | ||||
| if ($nutstatus eq 'enabled') { | ||||
| 	$OUT .= "enable	nut-server.service\n" if ($master eq  'yes'); | ||||
| 	$OUT .= "disable nut-server.service\n" unless ($master eq  'yes'); | ||||
| 	$OUT .= "enable	nut-monitor.service\n"; | ||||
|   } | ||||
| else | ||||
|   { | ||||
|         $OUT .= "disable nut-server.service\n"; | ||||
|         $OUT .= "disable nut-monitor.service\n"; | ||||
|   } | ||||
| } | ||||
							
								
								
									
										16
									
								
								root/etc/e-smith/templates/etc/ups/ups.conf/UPS
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								root/etc/e-smith/templates/etc/ups/ups.conf/UPS
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| { | ||||
|     my $model = $nut{Model} || "usbhid-ups"; | ||||
|     my $device = $nut{Device} || "/var/lib/ups/hiddev0"; | ||||
|     my $type = $nut{Type}; | ||||
|     my $mfr = $nut{mfr}; | ||||
|     my $mdl = $nut{mdl}; | ||||
|     $OUT .= "[UPS]\n"; | ||||
|     $OUT .= "\tdriver = $model\n"; | ||||
|     if  ($model eq 'genericups') | ||||
|     {  | ||||
|       $OUT .= "\tupstype = $type\n" if defined $type; | ||||
|       $OUT .= "\tmfr = $mfr\n" if defined $mfr; | ||||
|       $OUT .= "\tmodel = $mdl\n" if defined $mdl; | ||||
|     } | ||||
|     $OUT .= "\tport = $device\n"; | ||||
| } | ||||
| @@ -0,0 +1,6 @@ | ||||
| { | ||||
| my $access  = $nut{access} || 'localhost'; | ||||
|  | ||||
| $OUT .= "LISTEN 127.0.0.1"; | ||||
| $OUT .= "\nLISTEN $LocalIP" if ($access eq 'private'); | ||||
| } | ||||
							
								
								
									
										8
									
								
								root/etc/e-smith/templates/etc/ups/upsd.users/monitor
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								root/etc/e-smith/templates/etc/ups/upsd.users/monitor
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
|        [upsmaster] | ||||
|                password  = { $nut{MasterPass} } | ||||
|                upsmon master | ||||
|  | ||||
|        [upsslave] | ||||
|                password  = { $nut{SlavePass} } | ||||
|                upsmon slave | ||||
|  | ||||
| @@ -0,0 +1,14 @@ | ||||
| { | ||||
|     # create admin user for upsd to allow setting of | ||||
|     # UPS parameters via upsrw | ||||
|  | ||||
|     $OUT .= ""; | ||||
|     return unless (($nut{AdminUser} || 'disabled') eq 'enabled'); | ||||
|     return unless (($nut{AdminPass} || '') ne ''); | ||||
|  | ||||
|     $OUT .= "\n"; | ||||
|     $OUT .= "       [admin]\n"; | ||||
|     $OUT .= "               password  = $nut{AdminPass}\n"; | ||||
|     $OUT .= "               actions   = set\n"; | ||||
|     $OUT .= "               instcmds  = all\n"; | ||||
| } | ||||
							
								
								
									
										1
									
								
								root/etc/e-smith/templates/etc/ups/upsmon.conf/DEADTIME
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								root/etc/e-smith/templates/etc/ups/upsmon.conf/DEADTIME
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| DEADTIME 15 | ||||
| @@ -0,0 +1 @@ | ||||
| FINALDELAY 5 | ||||
							
								
								
									
										1
									
								
								root/etc/e-smith/templates/etc/ups/upsmon.conf/HOSTSYNC
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								root/etc/e-smith/templates/etc/ups/upsmon.conf/HOSTSYNC
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| HOSTSYNC 15 | ||||
| @@ -0,0 +1 @@ | ||||
| MINSUPPLIES 1 | ||||
							
								
								
									
										7
									
								
								root/etc/e-smith/templates/etc/ups/upsmon.conf/MONITOR
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								root/etc/e-smith/templates/etc/ups/upsmon.conf/MONITOR
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| { | ||||
|     if ( ($nut{Master} || 'yes') ne 'no' ) { | ||||
| 	$OUT = "MONITOR UPS\@localhost 1 upsmaster $nut{MasterPass} master"; | ||||
|     } else { | ||||
| 	$OUT = "MONITOR $nut{SlaveUPS} 1 upsslave $nut{SlavePass} slave"; | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1 @@ | ||||
| NOCOMMWARNTIME 300 | ||||
							
								
								
									
										1
									
								
								root/etc/e-smith/templates/etc/ups/upsmon.conf/NOTIFYCMD
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								root/etc/e-smith/templates/etc/ups/upsmon.conf/NOTIFYCMD
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| NOTIFYCMD /sbin/e-smith/nutUPS.notify | ||||
| @@ -0,0 +1,9 @@ | ||||
| NOTIFYFLAG COMMBAD  SYSLOG+WALL+EXEC | ||||
| NOTIFYFLAG COMMOK   SYSLOG+WALL+EXEC | ||||
| NOTIFYFLAG FSD      SYSLOG+WALL+EXEC | ||||
| NOTIFYFLAG LOWBATT  SYSLOG+WALL+EXEC | ||||
| NOTIFYFLAG NOCOMM   SYSLOG+WALL+EXEC | ||||
| NOTIFYFLAG ONBATT   SYSLOG+WALL+EXEC | ||||
| NOTIFYFLAG ONLINE   SYSLOG+WALL+EXEC | ||||
| NOTIFYFLAG REPLBATT SYSLOG+WALL+EXEC | ||||
| NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC | ||||
							
								
								
									
										1
									
								
								root/etc/e-smith/templates/etc/ups/upsmon.conf/POLLFREQ
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								root/etc/e-smith/templates/etc/ups/upsmon.conf/POLLFREQ
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| POLLFREQ 5 | ||||
| @@ -0,0 +1 @@ | ||||
| POLLFREQALERT 5 | ||||
| @@ -0,0 +1 @@ | ||||
| POWERDOWNFLAG /etc/killpower | ||||
| @@ -0,0 +1 @@ | ||||
| RBWARNTIME 43200 | ||||
| @@ -0,0 +1 @@ | ||||
| SHUTDOWNCMD "/sbin/e-smith/signal-event halt" | ||||
| @@ -0,0 +1 @@ | ||||
| # For more information see "man upssched.conf" | ||||
| @@ -0,0 +1,3 @@ | ||||
| [Unit] | ||||
| PartOf=nut.service | ||||
| After=nut.service  network-online.target | ||||
| @@ -0,0 +1,4 @@ | ||||
| [Service] | ||||
| ExecStartPre= | ||||
| ExecStartPre=-/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-run.conf | ||||
| ExecStartPre=/sbin/e-smith/service-status nut | ||||
| @@ -0,0 +1,2 @@ | ||||
| [Install] | ||||
| WantedBy=sme-server.target | ||||
| @@ -0,0 +1,4 @@ | ||||
| [Unit] | ||||
| PartOf=nut.service | ||||
| After=nut.service  network-online.target | ||||
|  | ||||
| @@ -0,0 +1,2 @@ | ||||
| [Service] | ||||
| ExecStartPre=/sbin/e-smith/service-status nut | ||||
| @@ -0,0 +1,2 @@ | ||||
| [Install] | ||||
| WantedBy=sme-server.target | ||||
		Reference in New Issue
	
	Block a user
	 Brian Read
					Brian Read