| 1 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | Mon::Client - Methods for interaction with Mon client | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | use Mon::Client; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | Mon::Client is used to interact with "mon" clients. It supports | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | a protocol-independent API for retrieving the status of the mon | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | server, and performing certain operations, such as disableing hosts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | and service checks. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | =item new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | Creates a new object. A hash can be supplied which sets the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | default values. An example which contains all of the variables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | that you can initialize: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | $c = new Mon::Client ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | host => "monhost", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | port => 2583, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | username => "foo", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | password => "bar", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | =item password (pw) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | If I<pw> is provided, sets the password. Otherwise, returns the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | currently set password. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | =item host (host) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | If I<host> is provided, sets the mon host. Otherwise, returns the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | currently set mon host. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | =item port (portnum) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | If I<portnum> is provided, sets the mon port number. Otherwise, returns the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | currently set port number. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | =item username (user) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | If I<user> is provided, sets the user login. Otherwise, returns the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | currently set user login. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | =item prot | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | If I<protocol> is provided, sets the protocol, specified by a string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | which is of the form "1.2.3", where "1" is the major revision, "2" is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | the minor revision, and "3" is the sub-minor revision. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | If I<protocol> is not provided, the currently set protocol is returned. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | =item protid ([protocol]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | Returns true if client and server protocol match, false otherwise. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | Implicitly called by B<connect>. If protocol is specified as an integer, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | supplies that protocol version to the server for verification. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | =item version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | Returns the protocol version of the remote server. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | =item error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | Returns the error string from set by the last method, or undef if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | there was no error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | =item connected | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | Returns 0 (not connected) or 1 (connected). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | =item connect (%args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | Connects to the server. If B<host> and B<port> have not been set, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | uses the defaults. Returns I<undef> on error. If $args{"skip_protid"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | is true, skip protocol identification upon connect. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | =item disconnect | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | Disconnects from the server. Return I<undef> on error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | =item login ( %hash ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | B<%hash> is optional, but if specified, should contain two keys, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | B<username> and B<password>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | Performs the "login" command to authenticate the user to the server. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | Uses B<username> and B<password> if specified, otherwise uses | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | the username and password previously set by those methods, respectively. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | =item checkauth ( command ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | Checks to see if the specified command, as executed by the current user, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | is authorized by the server, without actually executing the command. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | Returns 1 (command is authorized) or 0 (command is not authorized). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | =item disable_watch ( watch ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | Disables B<watch>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | =item disable_service ( watch, service ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | Disables a service, as specified by B<watch> and B<service>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | =item disable_host ( host ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | Disables B<host>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | =item enable_watch ( watch ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | Enables B<watch>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | =item enable_service ( watch, service ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | Enables a service as specified by B<watch> and B<service>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | =item enable_host ( host ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | Enables B<host>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | =item set ( group, service, var, val ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | Sets B<var> in B<group,service> to B<val>. Returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | undef on error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | =item get ( group, service, var ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | Gets variable B<var> in B<group,service> and returns it, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | or undef on error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | =item quit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | Logs out of the server. This method should be followed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | by a call to the B<disconnect> method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | =item list_descriptions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | Returns a hash of service descriptions, indexed by watch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | and service. For example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | %desc = $mon->list_descriptions; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | print "$desc{'watchname'}->{'servicename'}\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | =item list_deps | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | Lists dependency expressions and their components for all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | services. If there is no dependency for a particular service, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | then the value will be "NONE". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | %deps = $mon->list_deps; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | foreach $watch (keys %deps) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | foreach $service (keys %{$deps{$watch}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | my $sref = \%{$deps{$watch}->{$service}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | print "expr ($watch,$service) = $sref->{expression}\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | print "components ($watch,$service) = @{$sref->{components}}\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | =item list_group ( hostgroup ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | Lists members of B<hostgroup>. Returns an array of each | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | member. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | =item list_watch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | Returns an array of all the defined watch groups and services. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | foreach $w ($mon->list_watch) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | print "group=$w->[0] service=$w->[1]\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | =item list_opstatus ( [group1, service1], ... ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | Returns a hash of per-service operational statuses, as indexed by watch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | and service. The list of anonymous arrays is optional, and if is not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | provided then the status of all groups and services will be queried. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | %s = $mon->list_opstatus; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | foreach $watch (keys %s) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | foreach $service (keys %{$s{$watch}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | foreach $var (keys %{$s{$watch}{$service}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | print "$watch $service $var=$s{$watch}{$service}{$var}\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | =item list_failures | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | Returns a hash in the same manner as B<list_opstatus>, but only | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | the services which are in a failure state. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | =item list_successes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | Returns a hash in the same manner as B<list_opstatus>, but only | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | the services which are in a success state. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | =item list_disabled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | Returns a hash of disabled watches, services, and hosts. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | %d = $mon->list_disabled; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | foreach $group (keys %{$d{"hosts"}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | foreach $host (keys %{$d{"hosts"}{$group}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | print "host $group/$host disabled\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | foreach $watch (keys %{$d{"services"}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | foreach $service (keys %{$d{"services"}{$watch}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | print "service $watch/$service disabled\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | for (keys %{$d{"watches"}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | print "watch $_ disabled\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | =item list_alerthist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | Returns an array of hash references containing the alert history. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | @a = $mon->list_alerthist; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | for (@a) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | print join (" ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | $_->{"type"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | $_->{"watch"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | $_->{"service"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | $_->{"time"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | $_->{"alert"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | $_->{"args"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | $_->{"summary"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | =item list_dtlog | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | Returns an array of hash references containing the downtime log. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | @a = $mon->list_dtlog | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | for (@a) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | print join (" ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | $_->{"timeup"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | $_->{"group"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | $_->{"service"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | $_->{"failtime"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | $_->{"downtime"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | $_->{"interval"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | $_->{"summary"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | =item list_failurehist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | Returns an array of hash references containing the failure history. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | @f = $mon->list_failurehist; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | for (@f) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | print join (" ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | $_->{"watch"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | $_->{"service"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | $_->{"time"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | $_->{"summary"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | =item list_pids | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | Returns an array of hash references containing the list of process IDs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | of currently active monitors run by the server. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | @p = $mon->list_pids; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | $server = shift @p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | for (@p) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | print join (" ", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | $_->{"watch"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | $_->{"service"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | $_->{"pid"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | =item list_state | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | Lists the state of the scheduler. Returns a two-element array. The | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | first element of the array is 0 if the scheduler is stopped, and 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | if the scheduler is currently running. The second element of the array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | returned is the string "scheduler running" if the scheduler is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | currently running, and if the scheduler is stopped, the second | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | element is the time(2) that the scheduler was stopped. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | @s = $mon->list_state; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | if ($s[0] == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | print "scheduler stopped since " . localtime ($s[1]) . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | =item start | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | Starts the scheduler. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | =item stop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | Stops the scheduler. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | =item reset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | Resets the server. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | =item reload ( what ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | Causes the server to reload its configuration. B<what> is an optional | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | argument, and currently the only supported option is B<auth>, which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | reloads the authorization file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | =item term | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | Terminates the server. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | =item set_maxkeep | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | Sets the maximum number of history entries to store in memory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | =item get_maxkeep | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | Returns the maximum number of history entries to store in memory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | =item test ( test, group, service [, exitval, period]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | Schedules a service test to run immediately, or tests an alert for a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | given period. B<test> must be B<monitor>, B<alert>, B<startupalert>, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | B<upalert>. To test alerts, the B<exitval> and B<period> must be supplied. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | Periods are identified by their label in the mon config file. If there | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | are no period tags, then the actual period string must be used, exactly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | as it is listed in the config file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | =item test_config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | Tests the syntax of the configuration file. Returns a two-element | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | array. The first element of the array is 0 if the syntax of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | config file is invalid, and 1 if the syntax of the config file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | is OK. The second element of the array returned is the failure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | message, if the config file has invalid syntax, and the result code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | if the config file syntax is OK. This function returns undef if it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | cannot get a connection or a response from the mon server. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | Config file checking stops as soon as an error is found, so | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | you will need to run this command more than once if you have multiple | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | errors in your config file in order to find them all. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | @s = $mon->test_config; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | if ($s[0] == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | print "error in config file:\n" . $s[1] . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | =item ack ( group, service, text ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | When B<group/service> is in a failure state, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | acknowledges this with B<text>, and disables all further | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | alerts during this failure period. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | =item loadstate ( state ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | Loads B<state>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | =item savestate ( state ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | Saves B<state>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | =item servertime | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | Returns the time on the server using the same output as the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | time(2) system call. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | =item send_trap ( %vars ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | Sends a trap to a remote mon server. Here is an example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | $mon->send_trap ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | group => "remote-group", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | service => "remote-service", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | retval => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | opstatus => "operational status", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | summary => "summary line", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | detail => "multi-line detailed information", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | I<retval> must be a nonnegative integer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | I<opstatus> must be one of I<fail>, I<ok>, I<coldstart>, I<warmstart>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | I<linkdown>, I<unknown>, I<timeout>, I<untested>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | Returns I<undef> on error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | # Perl module for interacting with a mon server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | # $Id: Client.pm 1.4 Thu, 11 Jan 2001 08:42:17 -0800 trockij $ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | # Copyright (C) 1998-2000 Jim Trocki | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | # This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | # it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # (at your option) any later version. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | # This program is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | # GNU General Public License for more details. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | # You should have received a copy of the GNU General Public License | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | # along with this program; if not, write to the Free Software | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | package Mon::Client; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 1 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 1 | require 5.004; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 1 | ▶ | use IO::File; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 1 | ▶ | use Socket; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 1 | ▶ | use Text::ParseWords; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 1 | @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 1 | @EXPORT_OK = qw(%OPSTAT $VERSION); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 1 | $VERSION = "0.11"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 1 | my ($STAT_FAIL, $STAT_OK, $STAT_COLDSTART, $STAT_WARMSTART, $STAT_LINKDOWN, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | $STAT_UNKNOWN, $STAT_TIMEOUT, $STAT_UNTESTED, $STAT_DEPEND, $STAT_WARN) = (0..9); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 1 | my ($TRAP_COLDSTART, $TRAP_WARMSTART, $TRAP_LINKDOWN, $TRAP_LINKUP, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | $TRAP_AUTHFAIL, $TRAP_EGPNEIGHBORLOSS, $TRAP_ENTERPRISE, $TRAP_HEARTBEAT) = (0..7); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 1 | %OPSTAT = ("fail" => $STAT_FAIL, "ok" => $STAT_OK, "coldstart" => | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | $STAT_COLDSTART, "warmstart" => $STAT_WARMSTART, "linkdown" => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | $STAT_LINKDOWN, "unknown" => $STAT_UNKNOWN, "timeout" => $STAT_TIMEOUT, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | "untested" => $STAT_UNTESTED, "dependency" => $STAT_DEPEND); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 1 | my %TRAPS = ( "coldstart" => $TRAP_COLDSTART, "warmstart" => | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | $TRAP_WARMSTART, "linkdown" => $TRAP_LINKDOWN, "linkup" => $TRAP_LINKUP, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | "authfail" => $TRAP_AUTHFAIL, "egpneighborloss" => $TRAP_EGPNEIGHBORLOSS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | "enterprise" => $TRAP_ENTERPRISE, "heartbeat" => $TRAP_HEARTBEAT ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | sub _sock_write; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | sub _sock_readline; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | sub _do_cmd; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | sub _list_opstatus; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | sub _start_stop; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | sub _un_esc_str; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | sub _esc_str; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | my $proto = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | my $self = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | my %vars = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | ▶ | if ($ENV{"MONHOST"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | $self->{"HOST"} = $ENV{"MONHOST"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | $self->{"HOST"} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | $self->{"CONNECTED"} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | $self->{"HANDLE"} = new IO::File; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | ▶ | $self->{"PORT"} = getservbyname ("mon", "tcp") || 2583; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
getservbyname('mon', 'tcp') || 2583
MC/DC0%0/1
getservbyname('mon', 'tcp') || 2583
getservbyname('mon', 'tcp')
Truth table0%0/2
A
A= getservbyname('mon', 'tcp')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | $self->{"PROT"} = 0x2611; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | $self->{"TRAP_PRO_VERSION"} = "0.3807"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | $self->{"PASSWORD"} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | $self->{"USERNAME"} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | $self->{"DESCRIPTIONS"} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | $self->{"GROUPS"} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | $self->{"ERROR"} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | $self->{"VERSION"} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | if ($ENV{"USER"} ne "") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | $self->{"USERNAME"} = $ENV{"USER"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | $self->{"USERNAME"} = (getpwuid ($<))[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | $self->{"OPSTATUS"} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | $self->{"DISABLED"} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | foreach my $k (keys %vars) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | if ($k eq "host" && $vars{$k} ne "") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition0%0/3
$k eq "host" and $vars{$k} ne ""
MC/DC0%0/2
$k eq "host" and $vars{$k} ne ""
$k eq "host"
$vars{$k} ne ""
Truth table0%0/3
A and B
A= $k eq "host"B= $vars{$k} ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | $self->{"HOST"} = $vars{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | ▶ | } elsif ($k eq "port" && $vars{$k} ne "") { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$k eq "port" and $vars{$k} ne ""
MC/DC0%0/2
$k eq "port" and $vars{$k} ne ""
$k eq "port"
$vars{$k} ne ""
Truth table0%0/3
A and B
A= $k eq "port"B= $vars{$k} ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | $self->{"PORT"} = $vars{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } elsif ($k eq "username") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | $self->{"USERNAME"} = $vars{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | } elsif ($k eq "password") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | $self->{"PASSWORD"} = $vars{$k}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | bless ($self, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | sub password { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
password: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | if (@_) { $self->{"PASSWORD"} = shift } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | return $self->{"PASSWORD"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | ▶ | sub host { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
host: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | ▶ | if (@_) { $self->{"HOST"} = shift } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | return $self->{"HOST"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | ▶ | sub port { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
port: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | ▶ | if (@_) { $self->{"PORT"} = shift } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | return $self->{"PORT"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | sub username { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
username: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | ▶ | if (@_) { $self->{"USERNAME"} = shift } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | return $self->{"USERNAME"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 0 | ▶ | sub prot { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prot: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | ▶ | if ($_[0] =~ /^\d+\.\d+\.\d+$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | $self->{"PROT"} = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | $self->{"ERROR"} = "invalid protocol version"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | return $self->{"PROT"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | ▶ | if ($self->{"CONNECTED"}) { $self->disconnect; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | ▶ | sub error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | return $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | ▶ | sub connected { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connected: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | return $self->{"CONNECTED"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | ▶ | sub connect { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connect: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | my ($iaddr, $paddr, $proto); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | ▶ | if ($self->{"HOST"} eq "") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | $self->{"ERROR"} = "no host defined"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | ▶ | if (!defined ($iaddr = inet_aton ($self->{"HOST"}))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | $self->{"ERROR"} = "could not resolve host"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | ▶ | if (!defined ($paddr = sockaddr_in ($self->{"PORT"}, $iaddr))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | $self->{"ERROR"} = "could not generate sockaddr"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | ▶ | if (!defined ($proto = getprotobyname ('tcp'))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | $self->{"ERROR"} = "could not getprotobyname for tcp"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | ▶ | if (!defined socket ($self->{"HANDLE"}, PF_INET, SOCK_STREAM, $proto)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | $self->{"ERROR"} = "socket failed, $!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | ▶ | if (!defined connect ($self->{"HANDLE"}, $paddr)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | $self->{"ERROR"} = "connect failed, $!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | $self->{"CONNECTED"} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | ▶ | if (!$args{"skip_protid"}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | ▶ | if (!$self->protid) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | $self->{"ERROR"} = "connect failed, protocol mismatch"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 0 | close ($self->{"HANDLE"}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | ▶ | sub protid { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
protid: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 0 | my $p = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | ▶ | if (!defined $p) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | $p = int ($self->{"PROT"}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, "protid $p"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 0 | $self->{"ERROR"} = "error ($l)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | ▶ | sub disconnect { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disconnect: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | ▶ | if (!defined close ($self->{"HANDLE"})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | $self->{"ERROR"} = "could not close: $!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | $self->{"CONNECTED"} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | ▶ | sub login { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
login: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | my %l = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | $self->{"USERNAME"} = $l{"username"} if (defined $l{"username"}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | ▶ | $self->{"PASSWORD"} = $l{"password"} if (defined $l{"password"}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | ▶ | if (!defined $self->{"USERNAME"} || $self->{"USERNAME"} eq "") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $self->{"USERNAME"} or $self->{"USERNAME"} eq ""
MC/DC0%0/2
not defined $self->{"USERNAME"} or $self->{"USERNAME"} eq ""
not defined $self->{"USERNAME"}
$self->{"USERNAME"} eq ""
Truth table0%0/3
not(A) or B
A= not defined $self->{"USERNAME"}B= $self->{"USERNAME"} eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 0 | $self->{"ERROR"} = "no username"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | ▶ | if (!defined $self->{"PASSWORD"} || $self->{"PASSWORD"} eq "") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $self->{"PASSWORD"} or $self->{"PASSWORD"} eq ""
MC/DC0%0/2
not defined $self->{"PASSWORD"} or $self->{"PASSWORD"} eq ""
not defined $self->{"PASSWORD"}
$self->{"PASSWORD"} eq ""
Truth table0%0/3
not(A) or B
A= not defined $self->{"PASSWORD"}B= $self->{"PASSWORD"} eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | $self->{"ERROR"} = "no password"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | "login $self->{USERNAME} $self->{PASSWORD}"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | $self->{"ERROR"} = "error ($l)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | ▶ | sub checkauth { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkauth: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | my ($cmd) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | ▶ | if ($cmd eq "") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | $self->{"ERROR"} = "invalid command"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, "checkauth $cmd"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | ▶ | if ($r =~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | ▶ | sub disable_watch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disable_watch: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | my ($watch) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | ▶ | if ($watch !~ /\S+/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 0 | $self->{"ERROR"} = "invalid watch"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, "disable watch $watch"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 0 | $self->{"ERROR"} = "error ($l)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 0 | ▶ | sub disable_service { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disable_service: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | my ($watch, $service) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | ▶ | if ($watch !~ /\S+/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | $self->{"ERROR"} = "invalid watch"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 0 | ▶ | if ($service !~ /\S+/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | $self->{"ERROR"} = "invalid service"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | "disable service $watch $service"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | $self->{"ERROR"} = "error ($l)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | ▶ | sub disable_host { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disable_host: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | my (@hosts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, "disable host @hosts"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | $self->{"ERROR"} = "error ($l)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 0 | ▶ | sub enable_watch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enable_watch: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 0 | my ($watch) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | ▶ | if ($watch !~ /\S+/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | $self->{"ERROR"} = "invalid watch"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, "enable watch $watch"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | $self->{"ERROR"} = "error ($l)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 0 | ▶ | sub enable_service { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enable_service: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | my ($watch, $service) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | ▶ | if ($watch !~ /\S+/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | $self->{"ERROR"} = "invalid watch"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | ▶ | if ($service !~ /\S+/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | $self->{"ERROR"} = "invalid service"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | "enable service $watch $service"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | $self->{"ERROR"} = "error ($l)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | ▶ | sub enable_host { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
enable_host: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | my (@hosts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, "enable host @hosts"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | $self->{"ERROR"} = "error ($l)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | ▶ | sub version { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 0 | ▶ | unless (defined($self->{"VERSION"})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, "version"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 0 | $self->{"ERROR"} = "error ($l)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 0 | ($self->{"VERSION"} = $l) =~ s/^version\s+//;; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | return $self->{"VERSION"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 0 | ▶ | sub quit { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
quit: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, "quit"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 0 | ▶ | sub list_descriptions { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_descriptions: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | 0 | my ($d, $group, $service, $desc, %desc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 0 | my ($r, @d) = _do_cmd ($self->{"HANDLE"}, "list descriptions"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | $self->{"ERROR"} = "error (@d)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 0 | ▶ | return $r if (!defined $r); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 0 | foreach $d (@d) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 0 | ($group, $service, $desc) = split (/\s+/, $d, 3); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 0 | $desc{$group}{$service} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | _un_esc_str ((parse_line ('\s+', 0, $desc))[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 0 | return %desc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 0 | ▶ | sub list_deps { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_deps: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 0 | my ($r, @d) = _do_cmd ($self->{"HANDLE"}, "list deps"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 0 | $self->{"ERROR"} = "error (@d)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 0 | ▶ | return $r if (!defined $r); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 0 | my %dep = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 0 | foreach my $d (@d) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 0 | my ($what, $group, $service, $l) = split (/\s+/, $d, 4); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 0 | ▶ | if ($what eq "exp") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 0 | $dep{$group}->{$service}->{"expression"} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | _un_esc_str ((parse_line ('\s+', 0, $l))[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | } elsif ($what eq "cmp") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 0 | @{$dep{$group}->{$service}->{"components"}} = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | split (/\s+/, $l); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 0 | return %dep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | 0 | ▶ | sub list_group { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_group: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 0 | my ($group) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | ▶ | if ($group eq "") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 0 | $self->{"ERROR"} = "invalid group"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, "list group $group"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | 0 | ▶ | if ($r =~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 0 | $l =~ s/^hostgroup\s+$group\s+//;; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | 0 | return split (/\s+/, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 0 | ▶ | sub list_watch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_watch: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 0 | my ($r, @l) = _do_cmd ($self->{"HANDLE"}, "list watch"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 0 | my @groups; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | 0 | ▶ | if ($r =~ /^220/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 0 | foreach my $l (@l) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 0 | push @groups, [split (/\s+/, $l, 2)]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 0 | @groups; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 0 | ▶ | sub list_opstatus { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_opstatus: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 0 | my @g = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 0 | ▶ | if (@g == 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 0 | _list_opstatus ($self, "list opstatus"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 0 | my @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 0 | foreach my $i (@g) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 0 | push @l, "$i->[0],$i->[1]"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 0 | _list_opstatus ($self, "list opstatus " . join (" ", @l)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | 0 | ▶ | sub list_failures { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_failures: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 0 | _list_opstatus($self, "list failures"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | 0 | ▶ | sub list_successes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_successes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 0 | _list_opstatus($self, "list successes"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | 0 | ▶ | sub list_disabled { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_disabled: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 0 | my (%disabled, $h); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 0 | my ($r, @d) = _do_cmd ($self->{"HANDLE"}, "list disabled"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 0 | $self->{"ERROR"} = $d[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | 0 | foreach $r (@d) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 0 | ▶ | if ($r =~ /^group (\S+): (.*)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 0 | foreach $h (split (/\s+/, $2)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | 0 | $disabled{hosts}{$1}{$h} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | } elsif ($r =~ /^watch (\S+) service (\S+)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | 0 | $disabled{services}{$1}{$2} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | } elsif ($r =~ /^watch (\S+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | 0 | $disabled{watches}{$1} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | 0 | return %disabled; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | 0 | ▶ | sub list_alerthist { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_alerthist: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | 0 | my (@alerts, $h, $group, $service, $time, $alert, $args, $summary); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | 0 | my ($r, @h) = _do_cmd ($self->{"HANDLE"}, "list alerthist"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | 0 | $self->{"ERROR"} = "error (@h)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 0 | foreach $h (@h) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | 0 | $h = _un_esc_str ($h); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | 0 | my ($type, $group, $service, $time, $alert, $args, $summary) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | ($h =~ /^(\S+) \s+ (\S+) \s+ (\S+) \s+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | (\d+) \s+ (\S+) \s+ \(([^)]*)\) \s+ (.*)$/x); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | 0 | push @alerts, { type => $type, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | watch => $group, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | group => $group, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | service => $service, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | time => $time, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | alert => $alert, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | args => $args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | summary => $summary }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | 0 | return @alerts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 0 | ▶ | sub list_dtlog { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_dtlog: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | 0 | my (@dtlog, $h, $timeup, $group, $service, $failtime, $downtime, $interval, $summary); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 0 | my ($r, @h) = _do_cmd ($self->{"HANDLE"}, "list dtlog"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 0 | $self->{"ERROR"} = "error (@h)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | 0 | foreach $h (@h) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | 0 | $h = _un_esc_str ($h); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | 0 | my ($timeup, $group, $service, $failtime, $downtime, $interval, $summary) = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | ($h =~ /^(\d+) \s+ (\S+) \s+ (\S+) \s+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | (\d+) \s+ (\d+) \s+ (\d+) \s+ (.*)$/x); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | 0 | push @dtlog, { timeup => $timeup, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | group => $group, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | service => $service, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | failtime => $failtime, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | downtime => $downtime, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | interval => $interval, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | summary => $summary }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | 0 | return @dtlog; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | 0 | ▶ | sub list_failurehist { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_failurehist: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | 0 | my ($r, @f, $f, $group, $service, $time, $summary, @failures); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | 0 | ($r, @f) = _do_cmd ($self->{"HANDLE"}, "list failurehist"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | 0 | $self->{"ERROR"} = "@f"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | 0 | foreach $f (@f) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | 0 | ($group, $service, $time, $summary) = split (/\s+/, $f, 4); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | 0 | push @failures, { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | watch => $group, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | service => $service, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | time => $time, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | summary => $summary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | 0 | return @failures; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | 0 | ▶ | sub list_pids { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_pids: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | 0 | my ($r, $l, @pids, @p, $p, $pid, $group, $service, $server); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | 0 | ($r, @p) = _do_cmd ($self->{"HANDLE"}, "list pids"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | 0 | $self->{"ERROR"} = "@p"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | 0 | foreach $p (@p) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | 0 | ▶ | if ($p =~ /server (\d+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | 0 | $server = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | 0 | ($group, $service, $pid) = split (/\s+/, $p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | 0 | push @pids, { watch => $group, service => $service, pid => $pid }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | 0 | return ($server, @pids); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | 0 | ▶ | sub list_state { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_state: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | 0 | my ($r, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | 0 | ($r, $l) = _do_cmd ($self->{"HANDLE"}, "list state"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | 0 | ▶ | if ($l =~ /scheduler running/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | 0 | return (1, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | } elsif ($l =~ /scheduler stopped since (\d+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | 0 | return (0, $1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | 0 | ▶ | sub start { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | 0 | _start_stop ($self, "start"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | 0 | ▶ | sub stop { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stop: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | 0 | _start_stop ($self, "stop"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | 0 | ▶ | sub reset { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | 0 | my @opts = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | 0 | my ($r, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | 0 | ▶ | if (@opts == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | 0 | ($r, $l) = _do_cmd ($self->{"HANDLE"}, "reset"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | 0 | ($r, $l) = _do_cmd ($self->{"HANDLE"}, "reset @opts"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | 0 | ▶ | sub reload { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reload: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | 0 | my ($r, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | 0 | ($r, $l) = _do_cmd ($self->{"HANDLE"}, join (" ", "reload", @_)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | 0 | ▶ | sub term { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
term: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | 0 | my ($r, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | 0 | ($r, $l) = _do_cmd ($self->{"HANDLE"}, "term"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | 0 | ▶ | sub set_maxkeep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_maxkeep: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | 0 | my $val = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | 0 | ▶ | if ($val !~ /^\d+$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | 0 | $self->{"ERROR"} = "invalid value for maxkeep"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, "set maxkeep $val"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | 0 | ▶ | sub get_maxkeep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_maxkeep: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, "set maxkeep"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | 0 | $l =~ /maxkeep = (\d+)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | 0 | return $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | 0 | ▶ | sub set { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | 0 | my ($group, $service, $var, $val) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, "set $group $service $var " . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | "'" . _esc_str ($val, 1) . "'"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | 0 | ▶ | if (!defined $r) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | elsif ($r !~ /^220/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | 0 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | 0 | my ($group, $service, $var) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, "get $group $service $var"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | 0 | ($group, $service, $var) = split (/\s+/, $l, 3); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | 0 | $var =~ s/^[^=]*=//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | 0 | return _un_esc_str ((parse_line ('\s+', 0, $var))[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | 0 | ▶ | sub test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
test: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | 0 | my ($what, $group, $service, $exitval, $period) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | 0 | my ($r, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | 0 | ▶ | if ($what !~ /^monitor|alert|startupalert|upalert$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | 0 | $self->{"ERROR"} = "unknown test"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | 0 | ▶ | if (!defined $group) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | 0 | $self->{"ERROR"} = "group not specified"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | 0 | ▶ | if (!defined $service) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | 0 | $self->{"ERROR"} = "service not specified"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | 0 | ▶ | if ($what =~ /^alert|startupalert|upalert$/ && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$what =~ /^alert|startupalert|upalert$/ and $exitval eq "" || $period eq ""
$exitval eq "" or $period eq ""
MC/DC0%0/3
$what =~ /^alert|startupalert|upalert$/ and $exitval eq "" || $period eq ""
$what =~ /^alert|startupalert|upalert$/
$exitval eq ""
$period eq ""
Truth table0%0/4
A and B or C
A= $what =~ /^alert|startupalert|upalert$/B= $exitval eq ""C= $period eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | ($exitval eq "" || $period eq "")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | 0 | $self->{"ERROR"} = "must specify exit value and time period"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | 0 | ($r, $l) = _do_cmd ($self->{"HANDLE"}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | join (" ", "test", $what, $group, $service, $exitval, $period)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | 0 | ▶ | sub test_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
test_config: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | 0 | my ($r, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | 0 | ($r, $l) = _do_cmd ($self->{"HANDLE"}, "test config"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | 0 | return (0 , $l) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | 0 | return (1 , $r); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | 0 | ▶ | sub ack { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ack: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1655 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1656 | 0 | my ($group, $service, $text) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1657 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1658 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1659 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1660 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1661 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1662 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1663 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1665 | 0 | $text = _esc_str ($text, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1667 | 0 | my ($r, $l) = _do_cmd ($self->{"HANDLE"}, "ack $group $service '$text'"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1668 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1669 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1670 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1671 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1672 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1673 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1674 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1675 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1676 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1677 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1678 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1679 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1680 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1681 | 0 | ▶ | sub loadstate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
loadstate: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1682 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1683 | 0 | my (@state) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1684 | 0 | my ($r, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1685 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1686 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1687 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1688 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1689 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1690 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1691 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1692 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1693 | 0 | ($r, $l) = _do_cmd ($self->{"HANDLE"}, "loadstate @state"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1694 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1695 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1696 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1697 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1698 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1699 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1700 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1701 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1702 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1703 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1704 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1705 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1706 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1707 | 0 | ▶ | sub savestate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
savestate: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1708 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1709 | 0 | my (@state) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1710 | 0 | my ($r, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1711 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1712 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1713 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1714 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1715 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1716 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1717 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1719 | 0 | ($r, $l) = _do_cmd ($self->{"HANDLE"}, "savestate @state"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1721 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1722 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1723 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1724 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1725 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1726 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1727 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1728 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1729 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1733 | 0 | ▶ | sub servertime { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
servertime: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1734 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1735 | 0 | my ($r, $l, $t); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1736 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1737 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1738 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1739 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1740 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1741 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1742 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1743 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1744 | 0 | ($r, $l) = _do_cmd ($self->{"HANDLE"}, "servertime"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1746 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1747 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1748 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1749 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1750 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1751 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1752 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1753 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1754 | 0 | $l =~ /^(\d+)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1755 | 0 | return $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1756 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1757 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1758 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1759 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1760 | # clear timers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1761 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1762 | 0 | ▶ | sub clear { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1763 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1764 | 0 | my ($r, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1765 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1766 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1767 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1768 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1769 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1770 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1771 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1772 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1773 | 0 | ($r, $l) = _do_cmd ($self->{"HANDLE"}, "clear timers"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1774 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1775 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1776 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1777 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1778 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1779 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1780 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1781 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1782 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1783 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1784 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1786 | # sub crap_cmd { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1787 | # my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1788 | # my ($r, $l); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1789 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1790 | # undef $self->{ERROR}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1791 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1792 | # if (!$self->{CONNECTED}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1793 | # $self->{ERROR} = "not connected"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1794 | # return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1795 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1796 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1797 | # ($r, $l) = _do_cmd ($self->{HANDLE}, "COMMAND"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1798 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1799 | # if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1800 | # $self->{ERROR} = $l; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1801 | # return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1802 | # } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1803 | # $self->{ERROR} = $r; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1804 | # return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1805 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1806 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1807 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1809 | 0 | ▶ | sub send_trap { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_trap: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1810 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1811 | 0 | my %v = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1812 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1813 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1814 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1815 | 0 | ▶ | if ($v{"retval"} !~ /^\d+$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1816 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1817 | 0 | $self->{"ERROR"} = "invalid value for retval"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1818 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1819 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1820 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1821 | 0 | ▶ | if (!defined ($v{"opstatus"} = $OPSTAT{$v{"opstatus"}})) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1822 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1823 | 0 | $self->{"ERROR"} = "Undefined opstatus type"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1824 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1825 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1826 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1827 | 0 | foreach my $k (keys %v) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1828 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1829 | 0 | $v{$k} = _esc_str ($v{$k}, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1830 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1831 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1832 | 0 | my $pkt = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1833 | 0 | $pkt .= "pro='" . _esc_str ($self->{"TRAP_PRO_VERSION"}, 1) . "'\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1834 | 0 | $pkt .= "usr='" . _esc_str ($self->{"USERNAME"}, 1) . "'\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1835 | $pkt .= "pas='" . _esc_str ($self->{"PASSWORD"}, 1) . "'\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1836 | 0 | ▶ | if ($self->{"USERNAME"} ne ""); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1837 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1838 | 0 | $pkt .= "spc='$v{opstatus}'\n" . | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1839 | "seq='0'\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1840 | "typ='trap'\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1841 | "grp='$v{group}'\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1842 | "svc='$v{service}'\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1843 | "sta='$v{retval}'\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1844 | "spc='$v{opstatus}'\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1845 | "tsp='" . time . "'\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1846 | "sum='$v{summary}'\n" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1847 | "dtl='$v{detail}'\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1848 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1849 | 0 | my $proto = getprotobyname ("udp"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1850 | 0 | ▶ | if ($proto eq "") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1851 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1852 | 0 | $self->{"ERROR"} = "could not get proto"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1853 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1854 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1855 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1856 | 0 | ▶ | if (!socket (TRAP, AF_INET, SOCK_DGRAM, $proto)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1857 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1858 | 0 | $self->{"ERROR"} = "could not create UDP socket: $!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1859 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1860 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1861 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1862 | 0 | my $port = $self->{"PORT"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1864 | 0 | my $paddr = sockaddr_in ($port, inet_aton ($self->{"HOST"})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1865 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1866 | 0 | ▶ | if (!defined (send (TRAP, $pkt, 0, $paddr))) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1867 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1868 | 0 | $self->{"ERROR"} = "could not send trap to ".$self->{"HOST"}.": $!\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1869 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1870 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1871 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1872 | 0 | close (TRAP); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1873 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1874 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1875 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1876 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1877 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1878 | 0 | ▶ | sub _start_stop { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_start_stop: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1879 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1880 | 0 | my $cmd = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1881 | 0 | my ($r, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1882 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1883 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1884 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1885 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1886 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1887 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1888 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1889 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1890 | 0 | ▶ | if ($cmd ne "start" && $cmd ne "stop") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cmd ne "start" and $cmd ne "stop"
MC/DC0%0/2
$cmd ne "start" and $cmd ne "stop"
$cmd ne "start"
$cmd ne "stop"
Truth table0%0/3
A and B
A= $cmd ne "start"B= $cmd ne "stop"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1891 | 0 | $self->{"ERROR"} = "undefined command"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1892 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1893 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1894 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1895 | 0 | ($r, $l) = _do_cmd ($self->{"HANDLE"}, "$cmd"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1896 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1897 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1898 | 0 | $self->{"ERROR"} = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1899 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1900 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1901 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1902 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1903 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1904 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1905 | 0 | return $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1906 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1907 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1908 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1909 | 0 | ▶ | sub _list_opstatus { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_list_opstatus: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1910 | 0 | my ($self, $cmd) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1911 | 0 | my (%op, $o, %opstatus); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1912 | 0 | my ($group, $service, $last, $timer, $summary); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1913 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1914 | 0 | undef $self->{"ERROR"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1915 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1916 | 0 | ▶ | if (!$self->{"CONNECTED"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1917 | 0 | $self->{"ERROR"} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1918 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1919 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1920 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1921 | 0 | my ($r, @op) = _do_cmd ($self->{"HANDLE"}, "$cmd"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1922 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1923 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1924 | 0 | $self->{"ERROR"} = $op[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1925 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1926 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1927 | 0 | $self->{"ERROR"} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1928 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1929 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1930 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1931 | 0 | foreach $o (@op) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1932 | 0 | foreach my $w (quotewords ('\s+', 0, $o)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1933 | 0 | my ($var, $val) = split (/=/, $w, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1934 | 0 | $op{$var} = _un_esc_str ($val); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1935 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1936 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1937 | 0 | ▶ | next if ($op{group} eq ""); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1938 | 0 | ▶ | next if ($op{service} eq ""); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1939 | 0 | $group = $op{"group"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1940 | 0 | $service = $op{"service"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1941 | 0 | foreach my $w (keys %op) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1942 | 0 | $opstatus{$group}{$service}{$w} = $op{$w}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1943 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1944 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1945 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1946 | 0 | return %opstatus; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1947 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1948 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1949 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1950 | 0 | ▶ | sub _sock_write { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sock_write: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1951 | 0 | my ($sock, $buf) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1952 | 0 | my ($nleft, $nwritten); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1953 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1954 | 0 | $nleft = length ($buf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1955 | 0 | ▶ | while ($nleft) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1956 | 0 | $nwritten = syswrite ($sock, $buf, $nleft); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1957 | 0 | ▶ | return undef if (!defined ($nwritten)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1958 | 0 | $nleft -= $nwritten; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1959 | 0 | substr ($buf, 0, $nwritten) = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1960 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1961 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1962 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1963 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1964 | 0 | ▶ | sub _do_cmd { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_do_cmd: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1965 | 0 | my ($fd, $cmd) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1966 | 0 | my ($l, @out); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1967 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1968 | 0 | @out = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1969 | 0 | ▶ | return (undef) if (!defined _sock_write ($fd, "$cmd\n")); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1970 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1971 | 0 | for (;;) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1972 | 0 | $l = _sock_readline ($fd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1973 | 0 | ▶ | return (undef) if (!defined $l); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1974 | 0 | chomp ($l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1975 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1976 | 0 | ▶ | if ($l =~ /^(\d{3}\s)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1977 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1978 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1979 | 0 | push (@out, $l); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1980 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1981 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1982 | 0 | ($l, @out); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1983 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1985 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1986 | 0 | ▶ | sub _sock_readline { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_sock_readline: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1987 | 0 | my ($sock) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1988 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1989 | 0 | my $l = <$sock>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1990 | 0 | return $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1991 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1992 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1993 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1994 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1995 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1996 | # not yet implemented | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1997 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1998 | #list aliasgroups | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1999 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2000 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2001 | 0 | ▶ | sub _esc_str { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_esc_str: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2002 | 0 | my $str = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2003 | 0 | my $inquotes = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2004 | 0 | my $escstr = ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2005 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2006 | 0 | ▶ | for (my $i = 0; $i < length ($str); $i++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2007 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2008 | 0 | my $c = substr ($str, $i, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2009 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2010 | 0 | ▶ | if (ord ($c) < 32 || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/9
ord $c < 32 or ord $c > 126 or $c eq "\"" or $c eq "'"
ord $c < 32 or ord $c > 126 or $c eq "\""
ord $c < 32 or ord $c > 126
MC/DC0%0/4
ord $c < 32 or ord $c > 126 or $c eq "\"" or $c eq "'"
ord $c < 32
ord $c > 126
$c eq "\""
$c eq "'"
Truth table0%0/5
A or B or C or D
A= ord $c < 32B= ord $c > 126C= $c eq "\""D= $c eq "'"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2011 | ord ($c) > 126 || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2012 | $c eq "\"" || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2013 | $c eq "\'") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2014 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2015 | 0 | $c = sprintf ("\\%02x", ord($c)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2016 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2017 | ▶ | elsif ($inquotes && $c eq "\\") | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$inquotes and $c eq "\\"
MC/DC0%0/2
$inquotes and $c eq "\\"
$inquotes
$c eq "\\"
Truth table0%0/3
A and B
A= $inquotesB= $c eq "\\"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2018 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2019 | 0 | $c = "\\\\"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2020 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2021 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2022 | 0 | $escstr .= $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2023 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2024 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2025 | 0 | $escstr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2026 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2027 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2028 | 0 | ▶ | sub _un_esc_str { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_un_esc_str: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2029 | 0 | my $str = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2030 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2031 | 0 | $str =~ s{\\([0-9a-f]{2})}{chr(hex($1))}eg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2032 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2033 | 0 | $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2034 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2035 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2036 | 0 | ▶ | sub list_aliases { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_aliases: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2037 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2038 | 0 | my ($r, @d, $d, $group, $service, @allAlias, $aliasBlock, %alias); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2039 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2040 | 0 | undef $self->{ERROR}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2041 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2042 | 0 | ▶ | if (!$self->{CONNECTED}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2043 | 0 | $self->{ERROR} = "not connected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2044 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2045 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2046 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2047 | 0 | ($r, @d) = _do_cmd ($self->{HANDLE}, "list aliases"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2048 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2049 | 0 | ▶ | if (!defined $r) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2050 | 0 | $self->{ERROR} = "error (@d)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2051 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2052 | } elsif ($r !~ /^220/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2053 | 0 | $self->{ERROR} = $r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2054 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2055 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2056 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2057 | 0 | ▶ | return $r if (!defined $r); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2058 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2059 | # the block separator is \n\n | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2060 | 0 | @allAlias = split (/\n\n/ ,join ("\n", @d)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2061 | 0 | foreach $aliasBlock (@allAlias) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2062 | 0 | my(@allServices, $headerAlias, @headerAlias, $nameLine, $name, $description); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2063 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2064 | # extract the service block | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2065 | 0 | @allServices = split ( /\nservice\s*/, $aliasBlock); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2066 | # The first element is not a service block, it is the alias header | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2067 | # alias FOO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2068 | # FOO is a good service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2069 | # FOO bla bla | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2070 | 0 | $headerAlias = shift (@allServices); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2071 | # Split the block to get the name and the description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2072 | 0 | @headerAlias = split (/\n/, $headerAlias); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2073 | 0 | $nameLine = shift(@headerAlias); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2074 | 0 | $nameLine =~ /\Aalias\s+(\S+)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2075 | 0 | $name = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2076 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2077 | 0 | $headerAlias = join("\n", @headerAlias); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2078 | 0 | ▶ | $alias{$name}{'declaration'} = ($headerAlias) ? $headerAlias : '?'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2079 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2080 | 0 | foreach $service (@allServices) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2081 | 0 | my($serviceName, @allWatch, $watch); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2082 | 0 | @allWatch = split ("\n", $service); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2083 | 0 | $serviceName = shift(@allWatch); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2084 | 0 | foreach $watch (@allWatch) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2085 | 0 | my($groupWatched, $serviceWatched, @items, $url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2086 | 0 | ▶ | if($watch =~ /\Awatch\s+(\S+)\s+service\s+(\S+)\s+items\s*(.*)\Z/){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2087 | 0 | $groupWatched = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2088 | 0 | $serviceWatched = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2089 | 0 | @items = split(/\s+/, $3); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2090 | 0 | $alias{$name}{'service'}{$serviceName}{'watch'}{$groupWatched}{'service'}{$serviceWatched}{'items'} = [ @items ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2091 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2092 | }elsif($watch =~ /\Aurl\s+(.*)\Z/){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2093 | 0 | $url = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2094 | 0 | $alias{$name}{'service'}{$serviceName}{'url'} = $url; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2095 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2096 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2097 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2098 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2099 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2100 | 0 | return %alias; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||