Log File Monitoring with Solman 7.1 and SAP hostagent(Pattern Search)
Recently I got a chance to work on configuration scenario where the requirement was to enable monitoring of logs being written by unix cron scripts used to archive and take backup of MDM repositories.
An alert should be generated whenever the backup fails for any MDM repository. Without going into further MDM specific details, task was to search for a pattern in the file and generate alerts in SOLMAN MAI which can then be forwarded to a ticketing tool using SNMP traps.
There are two ways in which we can achieve this.
Using the text pattern search metric available under the Technical monitoring templates at host level. In our case we are working on linux and SOLMAN 7.1 Sp10
Go to Expert mode and edit. Click on change settings button and click on add variant button and add the following values precisely.
Only limitation is that only the files registered with sapstartsrv agent are monitored. ( Files which can be viewed via SAP MMC option Log files)
Once you have maintained the metric and applied it to the host to be monitored. You should be able to see the status in technical monitoring for that particular host.
This example is just an illustration , you can alter the scenario as per your needs.
SAPhostagent can be configured to send the data about log file pattern search (from any particular log file) to CCMS of the central monitoring system ,usually Solman
Attributes like age of the file, pattern matches, file time stamp(creation date) can be monitored . Alert can be generated if particular pattern is found or if the age of file is older than configured threshold. Alert data can be forwarded to MAI and alerts generated
Added advantage is that alert can be triggered if log file is older than configured threshold( eg >1 day).
To be able to configure the log file monitoring with SAP hostagent we have to configure the sapccmsr.ini configuration file which can be found at path “/usr/sap/hostctrl/work/sapccmsr” in case of unix platform. Provide the location of the lconfiguration files which contain the details of the log files to be monitored as below.
*logmon.ini file should be defined in the following format. To know in details about these parameters check Central Monitoring of Files – Infrastructure of the SAP NetWeaver Management Agents – SAP Library
Once the *logmon.ini file has been defined. Restart the SAPhostagent (hostexecstart -restart)
check the log file sapstartsrv_ccms.log for any errors or issues. Now we have prepared the log files to be monitored and registered it with the SAPhostagent.
Next step is to register the host in the central solman system to be able to receive the data in CCMS.
Use T-code RZ21 and navigate to
Provide all the information above and press the save button. You should be able to see the agent as ONLINE in RZ21 as below.
and log file monitoring data as configured should be available in CCMS (RZ20) SAP CCMS Monitors for Optional Components-> Logfile Monitoring.
Hope this document is helpful in understanding the concept of log file pattern search & monitoring .This can be applied to numerous scenarios and can be used as a base to configure your own setup.