irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

reIn2p3SysRule.cpp File Reference
#include "rcMisc.h"
#include "reIn2p3SysRule.hpp"
#include "genQuery.h"
#include "phyBundleColl.h"
#include "reDataObjOpr.hpp"
#include "rsGenQuery.hpp"
#include "rsGeneralRowInsert.hpp"
#include "rsGeneralAdmin.hpp"
#include "rsGeneralRowPurge.hpp"
#include <sys/socket.h>
#include <pthread.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "irods_stacktrace.hpp"
#include "irods_get_full_path_for_config_file.hpp"
#include "irods_configuration_parser.hpp"
#include "rodsErrorTable.h"
#include <boost/system/error_code.hpp>
#include <boost/asio.hpp>
#include <boost/algorithm/string.hpp>
#include <vector>
#include <string>
#include <sstream>
Include dependency graph for reIn2p3SysRule.cpp:

Go to the source code of this file.

Functions

int rodsMonPerfLog (char *serverName, char *resc, char *output, ruleExecInfo_t *rei)
 
int getListOfResc (rsComm_t *rsComm, char serverList[512][(1024+64)], int nservers, monInfo_t monList[512], int *nlist)
 
void * startMonScript (void *arg)
 
int checkHostAccessControl (const std::string &_user_name, const std::string &_host_client, const std::string &_groups_name)
 
int msiCheckHostAccessControl (ruleExecInfo_t *rei)
 
int msiServerMonPerf (msParam_t *verb, msParam_t *ptime, ruleExecInfo_t *rei)
 
int msiFlushMonStat (msParam_t *inpParam1, msParam_t *inpParam2, ruleExecInfo_t *rei)
 
int msiDigestMonStat (msParam_t *cpu_wght, msParam_t *mem_wght, msParam_t *swap_wght, msParam_t *runq_wght, msParam_t *disk_wght, msParam_t *netin_wght, msParam_t *netout_wght, ruleExecInfo_t *rei)
 

Variables

static pthread_mutex_t my_mutex
 
short threadIsAlive [512]
 

Function Documentation

◆ checkHostAccessControl()

int checkHostAccessControl ( const std::string &  _user_name,
const std::string &  _host_client,
const std::string &  _groups_name 
)

Definition at line 318 of file reIn2p3SysRule.cpp.

References irods::error::code(), terminate_irods_processes::e, ERROR, irods::configuration_parser::get(), irods::get_full_path_for_config_file(), HOST_ACCESS_CONTROL_FILE(), INVALID_ANY_CAST, KEY_NOT_FOUND, irods::configuration_parser::load(), irods::log(), irods::error::ok(), PASS, and UNMATCHED_KEY_OR_INDEX.

Referenced by msiCheckHostAccessControl().

Here is the call graph for this function:

◆ getListOfResc()

int getListOfResc ( rsComm_t rsComm,
char  serverList[512][(1024+64)],
int  nservers,
monInfo_t  monList[512],
int nlist 
)

search in the database, the list of resources with * their associated server. If config file exist, restrict * the list to serverList *

Definition at line 163 of file reIn2p3SysRule.cpp.

References addInxIval(), addInxVal(), GenQueryOut::attriCnt, BUNDLE_RESC, clearGenQueryInp(), COL_R_LOC, COL_R_RESC_NAME, COL_R_TYPE_NAME, COL_R_VAULT_PATH, ERROR, freeGenQueryOut(), get_db_schema_version::l, SqlResult::len, irods::log(), LONG_NAME_LEN, MAX_NAME_LEN, MAX_NSERVERS, MAX_SQL_ROWS, GenQueryInp::maxRows, NULL, GenQueryOut::rowCnt, rsGenQuery(), rstrcpy(), GenQueryInp::selectInp, GenQueryInp::sqlCondInp, GenQueryOut::sqlResult, irods.pypyodbc::status, and SqlResult::value.

Referenced by msiServerMonPerf().

Here is the call graph for this function:

◆ msiCheckHostAccessControl()

int msiCheckHostAccessControl ( ruleExecInfo_t rei)
Description:\n This microservice sets the access control policy. It checks the
access control by host and user based on the the policy given in the HostAccessControl file.
Module:\n core
Since
pre-2.1
Author
Jean-Yves Nief
Note
This microservice controls access to the iRODS service based on the information in the host based access configuration file: HOST_ACCESS_CONTROL_FILE
Example Usage:\n See clients/icommands/test/rules/
Parameters
[in,out]rei- The RuleExecInfo structure that is automatically handled by the rule engine. The user does not include rei as a parameter in the rule invocation.
Session Variables Used:\n none
Session Variables Modified:\n none
iCAT Attributes Used:\n none
iCAT Attributes Modified:\n none
Side Effect:\n none
Returns
integer
Return values
0upon success
Precondition
N/A
Postcondition
N/A
See also
N/A

Definition at line 470 of file reIn2p3SysRule.cpp.

References addInxIval(), addInxVal(), checkHostAccessControl(), clearGenQueryInp(), rsComm_t::clientUser, COL_USER_GROUP_NAME, COL_USER_NAME, freeGenQueryOut(), SqlResult::len, LOG_NOTICE, MAX_NAME_LEN, MAX_SQL_ROWS, GenQueryInp::maxRows, NULL, RE_TEST_MACRO, rsComm_t::remoteAddr, rodsLog(), GenQueryOut::rowCnt, RuleExecInfo::rsComm, rsGenQuery(), rstrcpy(), GenQueryInp::selectInp, GenQueryInp::sqlCondInp, GenQueryOut::sqlResult, irods.pypyodbc::status, RuleExecInfo::status, userInfo_t::userName, and SqlResult::value.

Referenced by irods::lookup_table< resource_ptr >::lookup_table().

Here is the call graph for this function:

◆ msiDigestMonStat()

int msiDigestMonStat ( msParam_t cpu_wght,
msParam_t mem_wght,
msParam_t swap_wght,
msParam_t runq_wght,
msParam_t disk_wght,
msParam_t netin_wght,
msParam_t netout_wght,
ruleExecInfo_t rei 
)
Description:\n This microservice calculates and stores a load factor for each connected
resource based on the weighting values passed in as parameters.
Module:\n core
Since
pre-2.1
Author
Jean-Yves Nief
Note
The following values are loaded from R_LOAD_SERVER:
  • cpu_used
  • mem_used
  • swap_used
  • runq_load
  • disk_space
  • net_input
  • net_output
The stored load factor is calculated as such:
  • load_factor = cpu_wght*cpu_used + mem_wght*mem_used + swap_wght*swap_used + runq_wght*runq_load + disk_wght*disk_space + netin_wght*net_input + netout_wght*net_output
Example Usage:\n See clients/icommands/test/rules/ and https://wiki.irods.org/index.php/Resource_Monitoring_System
Parameters
[in]cpu_wght- Required - a msParam of type STR_MS_T defining relative CPU weighting.
[in]mem_wght- Required - a msParam of type STR_MS_T defining relative memory weighting
[in]swap_wght- Required - a msParam of type STR_MS_T defining relative swap weighting
[in]runq_wght- Required - a msParam of type STR_MS_T defining relative run queue weighting
[in]disk_wght- Required - a msParam of type STR_MS_T defining relative disk space weighting
[in]netin_wght- Required - a msParam of type STR_MS_T defining relative inbound network weighting
[in]netout_wght- Required - a msParam of type STR_MS_T defining relative outbound network weighting
[in,out]rei- The RuleExecInfo structure that is automatically handled by the rule engine. The user does not include rei as a parameter in the rule invocation.
Session Variables Used:\n none
Session Variables Modified:\n none
iCAT Attributes Used:\n R_SERVER_LOAD table content
iCAT Attributes Modified:\n R_SERVER_LOAD_DIGEST table content
Side Effect:\n none
Returns
integer
Return values
0upon success
Precondition
N/A
Postcondition
N/A
See also
N/A

Definition at line 903 of file reIn2p3SysRule.cpp.

References addInxIval(), addInxVal(), generalRowInsertInp_t::arg1, generalRowInsertInp_t::arg2, GenQueryOut::attriCnt, clearGenQueryInp(), COL_SL_CPU_USED, COL_SL_CREATE_TIME, COL_SL_DISK_SPACE, COL_SL_MEM_USED, COL_SL_NET_INPUT, COL_SL_NET_OUTPUT, COL_SL_RESC_NAME, COL_SL_RUNQ_LOAD, COL_SL_SWAP_USED, freeGenQueryOut(), MsParam::inOutStruct, SqlResult::len, LOG_ERROR, MAX_NAME_LEN, MAX_NSERVERS, MAX_SQL_ROWS, GenQueryInp::maxRows, NRESULT, NULL, RE_TEST_MACRO, rsComm_t::rError, rodsLog(), rodsLogAndErrorMsg(), GenQueryOut::rowCnt, RuleExecInfo::rsComm, rsGeneralRowInsert(), rsGenQuery(), rstrcpy(), SELECT_MAX, GenQueryInp::selectInp, GenQueryInp::sqlCondInp, GenQueryOut::sqlResult, irods.pypyodbc::status, RuleExecInfo::status, STR_MS_T, SYS_INTERNAL_NULL_INPUT_ERR, generalRowInsertInp_t::tableName, MsParam::type, and SqlResult::value.

Referenced by irods::lookup_table< resource_ptr >::lookup_table().

Here is the call graph for this function:

◆ msiFlushMonStat()

int msiFlushMonStat ( msParam_t inpParam1,
msParam_t inpParam2,
ruleExecInfo_t rei 
)
Description:\n This microservice flushes the servers' monitoring statistics.
Module:\n core
Since
pre-2.1
Author
Jean-Yves Nief
Note
This microservice removes the servers' metrics older than the number of hours in "timespan".
Example Usage:\n See clients/icommands/test/rules/ and https://wiki.irods.org/index.php/Resource_Monitoring_System
Parameters
[in]inpParam1- Required - a msParam of type STR_MS_T defining the timespan in hours. "default" is equal to 24 hours.
[in]inpParam2- Required - a msParam of type STR_MS_T defining the tablename to be flushed. Currently must be either "serverload" or "serverloaddigest".
[in,out]rei- The RuleExecInfo structure that is automatically handled by the rule engine. The user does not include rei as a parameter in the rule invocation.
Session Variables Used:\n none
Session Variables Modified:\n none
iCAT Attributes Used:\n table R_SERVER_LOAD content
iCAT Attributes Modified:\n table R_SERVER_LOAD content
Side Effect:\n none
Returns
integer
Return values
0upon success
Precondition
N/A
Postcondition
N/A
See also
N/A

Definition at line 774 of file reIn2p3SysRule.cpp.

References CAT_SUCCESS_BUT_WITH_NO_INFO, MsParam::inOutStruct, LOG_ERROR, MAXLEN, NULL, RE_TEST_MACRO, rsComm_t::rError, rodsLog(), rodsLogAndErrorMsg(), RuleExecInfo::rsComm, rsGeneralRowPurge(), generalRowPurgeInp_t::secondsAgo, RuleExecInfo::status, STR_MS_T, SYS_INTERNAL_NULL_INPUT_ERR, generalRowPurgeInp_t::tableName, and MsParam::type.

Referenced by irods::lookup_table< resource_ptr >::lookup_table().

Here is the call graph for this function:

◆ msiServerMonPerf()

int msiServerMonPerf ( msParam_t verb,
msParam_t ptime,
ruleExecInfo_t rei 
)
Description:\n This microservice monitors the servers' activity and performance.
Module:\n core
Since
pre-2.1
Author
Jean-Yves Nief
Note
This microservice monitors the servers' activity and performance for CPU, network, memory and more. It retrieves the list of servers to monitor from the MON_CFG_FILE if it exists, or the iCAT if the configuration file does not exist.
The MON_PERF_SCRIPT is executed on each host. The result is put in the OUTPUT_MON_PERF file and will also be put in the iCAT in the near future.
Example Usage:\n See clients/icommands/test/rules/ and https://wiki.irods.org/index.php/Resource_Monitoring_System
Parameters
[in]verb- a msParam of type STR_MS_T defining verbose mode:
  • "default" - not verbose
  • "verbose" - verbose mode
[in]ptime- a msParam of type STR_MS_T defining probe time in seconds. "default" is equal to 10 seconds.
[in,out]rei- The RuleExecInfo structure that is automatically handled by the rule engine. The user does not include rei as a parameter in the rule invocation.
Session Variables Used:\n none
Session Variables Modified:\n none
iCAT Attributes Used:\n none
iCAT Attributes Modified:\n resource status flag, resource free space available,
table R_SERVER_LOAD
Side Effect:\n none
Returns
integer
Return values
0upon success
Precondition
N/A
Postcondition
N/A
See also
N/A

Definition at line 564 of file reIn2p3SysRule.cpp.

References thrInp_t::addPathToArgv, generate_iadmin_commands_for_41_to_42_upgrade::cmd, getListOfResc(), MsParam::inOutStruct, LEN_SECONDS, irods.pyparsing::line(), LOG_ERROR, LOG_NOTICE, LONG_NAME_LEN, MAX_NAME_LEN, MAX_NSERVERS, MAX_VALUE, MAXSTR, MON_CFG_FILE, MON_OUTPUT_NO_ANSWER, MON_PERF_SCRIPT, my_mutex, NULL, RE_TEST_MACRO, rodsLog(), rodsMonPerfLog(), RuleExecInfo::rsComm, rstrcat(), rstrcpy(), startMonScript(), RuleExecInfo::status, thrInp_t::threadId, threadIsAlive, TIMEOUT, and monInfo_t::vaultPath.

Referenced by irods::lookup_table< resource_ptr >::lookup_table().

Here is the call graph for this function:

◆ rodsMonPerfLog()

◆ startMonScript()

void* startMonScript ( void *  arg)

launch Perl script on each server, retrieve the result * and give it to the rodsMonPerfLog function in order to * insert it into the database . *

Definition at line 244 of file reIn2p3SysRule.cpp.

References thrInp_t::addPathToArgv, thrInp_t::cmd, thrInp_t::cmdArgv, thrInp_t::execAddr, fillIntInMsParam(), fillStrInMsParam(), thrInp_t::hintPath, MsParam::inOutStruct, LOG_ERROR, MAXSTR, MON_OUTPUT_NO_ANSWER, msiExecCmd(), NULL, generate_iadmin_commands_for_41_to_42_upgrade::output, thrInp_t::rei, thrInp_t::rescName, rodsLog(), rodsLogError(), rodsMonPerfLog(), irods.pypyodbc::status, thrInp_t::threadId, and threadIsAlive.

Referenced by msiServerMonPerf().

Here is the call graph for this function:

Variable Documentation

◆ my_mutex

pthread_mutex_t my_mutex
static

Definition at line 22 of file reIn2p3SysRule.cpp.

Referenced by msiServerMonPerf(), and rodsMonPerfLog().

◆ threadIsAlive

short threadIsAlive[512]

Definition at line 36 of file reIn2p3SysRule.cpp.

Referenced by msiServerMonPerf(), and startMonScript().