almonzer

Registered
Jan 7, 2020
1
0
1
Brazil
cPanel Access Level
Root Administrator
Hello everyone,
I want to stream the list of Server's services to external analysis tools, (The same list that appears in "Process Manager" Home »System Health »Process Manager ) the same list I want to stream it live.

I'm not a top expert in WHM, but I supposed that there should be an API to do that, I've created an API Tokens with the required permission, then I stuck here :)

Could anyone guide me on how can I achieve that? what it the WHM API Functions that allowed me to Monitor all the server process?
Is there any example I can follow?

Thanks
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,261
313
Houston
Hello,

There's no whmapi1 for this specifically, essentially all it's doing is giving you a version of the top command. You can see it in the access logs:

Code:
<MYIPADDRESS> - root [01/08/2020:23:25:39 -0000] "GET /cpsesshash/scripts2/top HTTP/1.1" 200 0 "https://server.mydomain.tld:2087/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" "s" "-" 2087
If you want to look further you can dig into the following where it's mentioned;

Code:
[[email protected] Whostmgr]# grep -ir "scripts2/top" /usr/local/cpanel/
Binary file /usr/local/cpanel/logs/access_log matches
/usr/local/cpanel/whostmgr/docroot/themes/x/breadcrumb:/scripts2/top:process_manager.png:Process Manager:/scripts/command?PFILE=System_Health:system_health_process_manager
/usr/local/cpanel/whostmgr/docroot/themes/x/dynamicui.conf:        "url": "/scripts2/top",
/usr/local/cpanel/whostmgr/docroot/templates/menu/System_Health.tmpl:        <a class="item-link" href="[% cp_security_token %]/scripts2/top" target="" title='[% varcache.locale_str -%]'>
/usr/local/cpanel/whostmgr/docroot/templates/menu/topframe.tmpl:                            [% IF !Whostmgr.dnsonly && has_root_privileges %]href="[% cp_security_token %]/scripts2/top"[% END %]
/usr/local/cpanel/whostmgr/docroot/templates/menu/command.tmpl:                        <a id="system_health_process_manager" href="[% cp_security_token %]/scripts2/top" target="" uniquekey="system_health_process_manager" title='[% varcache.locale_str -%]'>
/usr/local/cpanel/whostmgr/docroot/templates/managepid.tmpl:    breadcrumburl = '/scripts2/top'
/usr/local/cpanel/whostmgr/docroot/templates/managepid.tmpl:<a href="[% cp_security_token %]/scripts2/top">Back</a>
/usr/local/cpanel/whostmgr/docroot/templates/top.tmpl:    breadcrumburl = '/scripts2/top'
/usr/local/cpanel/etc/icontact_templates/Backup/Delayed.html.tmpl:[% CPANEL.locale.maketext('To determine which processes use the most memory and processor time, use [asis,WHM]’s [_1] interface at: [output,url,_2,_2,target,_3]', CPANEL.locale.maketext('Process Manager'), CPANEL.assemble_whm_url("scripts2/top"),'_blank') %]
But I don't believe this would be able to be utilized in the method you're looking to do.