How to know the host problem id and service problem id in XI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
grayloglearn
Posts: 222
Joined: Thu Jul 06, 2017 8:55 am

How to know the host problem id and service problem id in XI

Post by grayloglearn »

Hi Team,

When the host is critical or service is Critical or warning the nagios will generate one Host problem ID/Service problem ID. How can see that ID's and where is located in Nagios XI. Can anybody help on this.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: How to know the host problem id and service problem id i

Post by lmiltchev »

The $HOSTPROBLEMID$ and $SERVICEPROBLEMID$ are standard nagios macros. You can check what their value is in the status.dat (the "current_problem_id" directive). I can't think of any way to show these values in XI (in the GUI). I was thinking of using the Actions component, and displaying the values that way, but unfortunately, they are not available in the Actions component.

Can you give us some more detains on how are you going to be using the $HOSTPROBLEMID$ and $SERVICEPROBLEMID$ macros? What's the "use case"? Maybe knowing what you would like to accomplish would help us point you to the right direction. Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!
grayloglearn
Posts: 222
Joined: Thu Jul 06, 2017 8:55 am

Re: How to know the host problem id and service problem id i

Post by grayloglearn »

HI team,

We want to know the hostproblem ID and service problem ID for snmp traps. How nagios will work hostproblem ID and Service Problem ID on snmp traps. We know that for regular host or service ID will increment by 1 when normal to critical and if come critical to normal the value will go to 0. Can you give one example where we can see hostproblem ID and Service problem ID in Nagios XI.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: How to know the host problem id and service problem id i

Post by mcapra »

If you don't mind my asking, what exactly do you want to use the problem ID for?

I'm not 100% clear on exactly what you're trying to do, but I believe the Nagios XI REST API could be used to gather that information. Specifically, if you wanted to get the problem ID for a given state. Additional information regarding the REST API can be found in the "Help" section of the Nagios XI GUI.

It'd be nice if the API was documented somewhere other than the XI GUI ;)
Former Nagios employee
https://www.mcapra.com/
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: How to know the host problem id and service problem id i

Post by tgriep »

Thanks @mcapra for the help.

When Nagios XI receives a SNMP trap, it is forwarded to a service check and the system doesn't differentiate between a regular service check and a SNMP Trap to the same scheme would be used for the Service Problem ID.

I am guessing that you want to change the way SNMP traps are received in the server so they will generate OK, Warning and Critical Alerts, is that what you are looking for?
If so, the link below it a Trap Tutorial that explains how to setup Traps to generate different Alerts. Scroll down to this section "Create Custom Events In SNMPTT" for details on doing that.
https://support.nagios.com/kb/article/n ... al-77.html

There is not a way you view the ID in the XI GUI directly but you could use the API to gather the ID or create an Event Handler and log the data to a text file on the system, would that be an option?
Be sure to check out our Knowledgebase for helpful articles and solutions!
grayloglearn
Posts: 222
Joined: Thu Jul 06, 2017 8:55 am

Re: How to know the host problem id and service problem id i

Post by grayloglearn »

Hi thanks for the reply,

We gone through that document. But we did not find that where we can see host problem id and service problem id. Yes i understand we cant find in GUI, but some where we can find in backend, where is that.

I have seen the below but i am not able to understand how to get id for particular host

For example, the following macro will return a comma-separated list of host state ids for hosts that are members of the hg1 hostgroup:

$HOSTSTATEID:hg1:,$
This macro definition will return something that looks like this:
0,2,1,1,0,0,2

Just give the simple example where i can find host problem ID and service Problem ID in backend.
Ex: test host is having the memory critical for this some where we have service problem id how to find in backend
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How to know the host problem id and service problem id i

Post by scottwilkerson »

As mentioned earlier, the macros you are looking for are:
The $HOSTPROBLEMID$ and $SERVICEPROBLEMID$ are standard nagios macros.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
grayloglearn
Posts: 222
Joined: Thu Jul 06, 2017 8:55 am

Re: How to know the host problem id and service problem id i

Post by grayloglearn »

Hi Team,

Yes as you said those are standard nagios macros. How we can know the ID's from nagios for particular host. Few posts are saying that is status.dat as last_problem_id but those are only available for current status. I need the details last_problem_id from two days how we can see for the particular host or service .
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How to know the host problem id and service problem id i

Post by scottwilkerson »

grayloglearn wrote:Hi Team,

Yes as you said those are standard nagios macros. How we can know the ID's from nagios for particular host. Few posts are saying that is status.dat as last_problem_id but those are only available for current status. I need the details last_problem_id from two days how we can see for the particular host or service .
Sorry, this data is not available via macro. You would need to grab the data from the State History report in Nagios XI
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
grayloglearn
Posts: 222
Joined: Thu Jul 06, 2017 8:55 am

Re: How to know the host problem id and service problem id i

Post by grayloglearn »

Hi Team,

Thanks, Let us go with some example with my knowledge on test.cfg /usr/local/nagios/etc/windows/test.cfg .

$USER1$/sn_ticketer.pl --page="incident.do" --host="$HOSTNAME$" --state="$HOSTSTATE$" --category="Nagios" --short_description="$HOSTNAME$ is $SERVICESTATE$" --description="Host: $HOSTNAME$\nState: $HOSTSTATE$\nTime: $LONGDATETIME$\nDescription: $HOSTOUTPUT$\n\n"


HERE above Example . While we executing the script will take Hostname from coniguration file that is example test.cfg from /usr/local/nagios/etc/windows/test.cfg

Like that remaining like $hostproblemID$ and $SERVICE STATE$ all these values taking from where in the nagios for particular host .
Locked