You should look up the text string corresponding to the error code in the agentErrors agent schema record and present it to the user with the specific error given in <error_message> . (The agent sends back a number rather than a string so the corresponding string can be edited by the local user -- for example, to change it to a different language.)
Netmgt_error errbuf;
char agentMsg[NETMGT_NAMESIZ]; /* agent message */
(void) netmgt_fetch_error(&errbuf); /* get error info */
if ((int)errbuf.service_error > (int)NETMGT_FATAL) { /* generic error */
if ((int)errbuf.service_error == (int)NETMGT_RPCTIMEDOUT)
retry_request(); /* retry request */
else
fprintf(stderr, "Generic error: %s, %s\n",
netmgt_sperror(), errbufmessage);
} else { /* agent error */
/* get error message from agent schema */
get_agentError(errbuf.agent_error, agentMsg);
fprintf(stderr, "Agent %s: %s, %s\n", /* print message */
(errbuf.service_error == NETMGT_FATAL) ? "error" : "warning",
agentMsg, errbuf.message);
}
return errbuf.service_error;