I've been trying to build an alert monitor in PHP that gets data from the CCMS. I'm new to SAP but not to PHP.
The saprfc works just fine and I'm able to test function modules with the saprfc_test.php. I've seen the tutorial on how to get alert data (CPU utilization) from the CCMS. And it works fine. So what's the problem you ask?
If anyone here have tried the SAP CCMS plugin for Nagios they know that all you need (almost all you need) is to provide the long name of the MTE e.g SID\system_SID_01\R3Services\Background\AbortedJobs and you get the alert message that you see in RZ20.
I've found several function modules that gives me the value of a monitor leaf node, but only the ones with a number as a value (percent CPU usage, MB disk space left +++). If I try to get data from e.g AbortedJobs i get nothing.
I've found one function module that gives me the data that e.g AbortedJobs shows (SALR_MTE_STAT_MSG_READ_CUR_VAL) but this one won't of course show leaf nodes with numbers...
The nagios plugin uses:
I'm having trouble trying any of these in my test application. The return array is:
Array ( [TYPE] => E [ID] => RA [NUMBER] => 346 [MESSAGE] => Problems accessing database (function 'BAPI_SYSTEM_MTE_GETMLCURVAL') [LOG_NO] => [LOG_MSG_NO] => 0 [MESSAGE_V1] => BAPI_SYSTEM_MTE_GETMLCURVAL [MESSAGE_V2] => [MESSAGE_V3] => [MESSAGE_V4] => [PARAMETER] => [ROW] => 0 [FIELD] => [SYSTEM] => )
Someone have to have tried to build a custom CCMS monitor of some sort?
My idea is that the leaf nodes I want to pull from the CCMS is defined in an XML file:
<SYSTEM>SolMan</SYSTEM> <MONITOR>Aborted Jobs</MONITOR> <MEASUREMENT>-</MEASUREMENT> <MTSYSID>SID</MTSYSID> <MTMCNAME>system_SID_01</MTMCNAME> <MTNUMRANGE>032</MTNUMRANGE> <MTUID>0000000003</MTUID> <MTCLASS>102</MTCLASS> <MTINDEX>0000002308</MTINDEX> <EXTINDEX>0000000050</EXTINDEX>
and then I can list them as I want on the screen.
I really hope someone can come with some pointers and shed some light on this. It would be much appreciated.
Ok, at least now I have something working. But it has its limitations. This could probably be written as a wiki entry, but I don't feel that the code is ready for the public yet. This is used against our Solution Manager which monitors all other systems.
This is how I have build it:
Everything I want to monitor is defined in an XML file
<monitor> <System> <SID> <set> <MONITOR>Shortdumps</MONITOR> <TYPE>alert</TYPE> <MTSYSID>SID</MTSYSID> <MTMCNAME>system_SID_01</MTMCNAME> <MTNUMRANGE>010</MTNUMRANGE> <MTUID>0000001797</MTUID> <MTCLASS>102</MTCLASS> <MTINDEX>0000000174</MTINDEX> <EXTINDEX>0000000008</EXTINDEX> </set> </SID> </System> </monitor>
where you have as many customers as you want, each customer has of course several systems (CRM, ERP, BW) and within each system everything that should be monitored is defined within the <set> tag. <MONITOR> is a label defined by the user, <TYPE> can be alert, disk or availability. This is only for grouping similar monitors together and list them as I want.
The rest inside the <set> is information SAP needs.
If a monitor set is disk or availability I call the
to get the integer value (e.g. 3454, as in 3454MB free disk space).
No mater what kind of type the monitor is I call
to get the alert value (1,2 or 3).
For now I'm only interested in yellow or red alerts so if the alert level is >1 I call
to get the alert data I need to look up the alert message.
The alert message is taken from
The results are written to an XML file with the same structure as the input XML file except the data inside the <set> contains the data I want to show.
<monitor> <System> <SID> <set> <MONITOR>Free Data Space</MONITOR> <TYPE>alert</TYPE> <ALERT>3</ALERT> <MSG>Some message from SAP CCMS here</MSG> <ALRELEVVAL>the integer value if type is disk or availability</ALRELEVVAL> </set> </SID> </System> </monitor>
Now that I have the data I can list it any way I want. E.g. grouping everything with type disk together to have an own place on the screen with disk monitoring or listing all alerts within the same System and SID.
This is of course not an optimal solution. Right now I have 56 monitor sets which takes about 20 seconds to check even though the SAP system is on the local network. There are also no alerts in the system right now so none of the function modules within the IF alert > 1 are checked either. If there are a lot of alerts the time will increase drastically. Guess I need to ask an ABAP person...
Any ideas / improvements are appreciated