Siebel::Srvrmgr::Daemon - super class for sessions with Siebel srvrmgr program
package MyDaemon; extends 'Siebel::Srvrmgr::Daemon';
This is a super class, and alone it does not provide any functionaly to use srvrmgr to send commands and process returned data.
The "private" method _setup_commands must be overrided by subclasses of it or commands will not be sent to srvrmgr (the currently implementation warns about that).
_setup_commands
warn
Logging of this class can be enabled by using Siebel::Srvrmgr logging feature.
The logic behind this class is easy: you can submit a pair of command/action to the class. It will then connect to the server by executing srvrmgr, submit the command to the server and recover the output generated. The action will be executed having this output as parameter. Anything could be considered as an action, from simple storing the output to even generating new commands to be executed in the server.
srvrmgr
A command is an instance of Siebel::Srvrmgr::Daemon::Command class. Any "list" command is supported, and also load preferences and exit. Anything else is considered dangerous and will generated an exception. Beware that you will need to have an Siebel::Srvrmgr::ListParser::Output class available to be able to parse the command output.
load preferences
exit
An action can be any class but is obligatory to create a subclass of Siebel::Srvrmgr::Daemon::Action base class. See the <commands> attribute for details.
Implementation details are reserved to subclasses of Siebel::Srvrmgr::Daemon: be sure to check them for real usage cenarios.
This is a string representing the servername where the instance should connect. This is a optional attribute during object creation with the new method.
new
Beware that the run method will verify if the server attribute has a defined value or not: if it has, the run method will try to connect to the Siebel Enterprise specifying the given Siebel Server. If not, the method will try to connect to the Enterprise only, not specifying which Siebel Server to connect.
run
server
This is a string representing the gateway where the instance should connect. This is a required attribute during object creation with the new method.
This is a string representing the enterprise where the instance should connect. This is a required attribute during object creation with the new method.
This is a string representing the login for authentication. This is a required attribute during object creation with the new method.
This is a string representing the password for authentication. This is a required attribute during object creation with the new method.
An array reference containing one or more references of Siebel::Srvrmgr::Daemon::Commands class.
The commands will be executed in the exactly order as given by the indexes in the array reference (as FIFO).
This is a required attribute during object creation with the new method.
An string representing the full path to the srvrmgr program in the filesystem.
An boolean defining if the interaction loop should be infinite or not.
The an integer value that will raise an ALARM signal generated by alarm. The default value is 30 seconds.
alarm
Besides read_timeout, this will raise an exception and exit the read loop from srvrmgr in cases were an output cannot be retrieved.
read_timeout
This attribute will be reset every time a read can be done from the STDOUT or STDERR from srvrmgr.
A boolean attribute used mostly for testing of this class.
If true, if will prepend the complete path of the Perl interpreter to the parameters before calling the srvrmgr program (of course the "srvrmgr" must be itself a Perl script).
It defaults to false.
A string representing the LANG_ID parameter to connect to srvrmgr. If defaults to "ENU";
An integer representing the number of times the child object was used in run invocations. This is reset to zero if a new child process is created.
The maximum times this class wil retry to launch a new process of srvrmgr if the previous one failed for any reason. This is intented to implement robustness to the process.
The number of retries of launching a new srvrmgr process. If this value reaches the value defined for maximum_retries, the instance of Siebel::Srvrmgr::Daemon will quit execution returning an error code.
maximum_retries
A boolean attribute that defines if the raw data recovered from srvrmgr should be kept or discarded as soon as possibly.
Having a default value of true, it should help reducing memory usage or debugging, if set false.
This is a single character attribute. It tells the Daemon class to consider a field delimiter, if such options was set in the srvrmgr program. If this option is used but this attribute is not set accordinly, parsing will probably fail.
Since this attribute should be defined during Daemon object instance, it is read-only.
Getter for the field_delimiter attribute.
field_delimiter
Getter for the clear_raw attribute.
clear_raw
Setter for the clear_raw attribute.
Returns the content of the alarm_timeout attribute.
alarm_timeout
Sets the attribute alarm_timeout. Expects an integer as parameter, in seconds.
Returns the value of the attribute child_runs.
child_runs
Returns the content of the attribute use_perl.
use_perl
Returns the value of the attribute ipc_buffer_size.
ipc_buffer_size
Sets the attribute ipc_buffer_size. Expects an integer as parameter, multiple of 1024.
Returns the value of the attribute lang_id.
lang_id
Sets the attribute lang_id. Expects a string as parameter.
Returns the content of server attribute as a string.
Sets the attribute server. Expects an string as parameter.
Returns the content of gateway attribute as a string.
gateway
Sets the attribute gateway. Expects a string as parameter.
Returns the content of enterprise attribute as a string.
enterprise
Sets the enterprise attribute. Expects a string as parameter.
Returns the content of user attribute as a string.
user
Sets the user attribute. Expects a string as parameter.
Returns the content of password attribute as a string.
password
Sets the password attribute. Expects a string as parameter.
Returns the content of the attribute commands.
commands
Set the content of the attribute commands. Expects an array reference as parameter.
Returns the content of the bin attribute.
bin
Sets the content of the bin attribute. Expects a string as parameter.
Returns the content of pid attribute as an integer.
pid
Returns the content of the attribute is_infinite, returning true or false depending on this value.
is_infinite
Reset the retries of creating a new process of srvrmgr program, setting the attribute retries to zero.
retries
Does a shift in the commands attribute.
shift
Does not expects any parameter. Returns the shifted Siebel::Srvrmgr::Daemon::Command instance or undef if there is only one command left (which is not shifted).
undef
This method is useful specially if the Daemon will keep executing commands, but setup commands (like load preferences) are not necessary to be executed again.
This is the method used to execute commands in srvrmgr program and must be overrided by subclasses of Siebel::Srvrmgr::Daemon or an exception will be generated.
Expects an array reference as parameter.
Changes any EOL character to LF from each index value.
See perlport -> Issues -> Newlines for details on this.
Returns an instance of a Siebel::Srvrmgr::ListParser class.
This method is invoked before the object instance is destroyed. It does really few things like writting messages to the define configuration of Log::Log4perl logger. It will also log if ALRM, INT or PIPE signals were received.
Subclasses may want to override the method "private" _my_cleanup to do their properly laundry since the definition of _my_cleanup for this class is just to return true. _my_cleanup is called with a reference of a Log::Log4perl::Logger instance for usage.
override
_my_cleanup
return
Moose
Siebel::Srvrmgr::Daemon::ActionFactory
Siebel::Srvrmgr::ListParser
Siebel::Srvrmgr::Regexes
POSIX
Siebel::Srvrmgr::Daemon::Command
Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org<>
This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org>
This file is part of Siebel Monitoring Tools.
Siebel Monitoring Tools is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Siebel Monitoring Tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Siebel Monitoring Tools. If not, see <http://www.gnu.org/licenses/>.
To install Siebel::Srvrmgr, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Siebel::Srvrmgr
CPAN shell
perl -MCPAN -e shell install Siebel::Srvrmgr
For more information on module installation, please visit the detailed CPAN module installation guide.