Nagios Integration with HP Service Manager

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
HIINNS
Posts: 172
Joined: Wed Mar 14, 2018 9:43 am

Nagios Integration with HP Service Manager

Post by HIINNS »

I am in the process of integrating Nagios XI with HP Service Manager. It should be a pretty easy process as I just need to forward an e-mail from Nagios XI to a HPSM mailbox. I do have some 3 questions about this.

1. Is there a way to only send 1 e-mail to HPSM when a condition is met, rather than continually sending e-mails until the condition is no longer met? (HPSM sends e-mails to the the group responsible for fixing the problem)
2. Is there a way to modify the e-mail to include the group name responsible for fixing the problem.
3. Is there a way to only send warning messages to the group responsible for fixing the servers problems, and to add the HPSM mailbox when it reaches a critical state?

Thank you!!!
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: Nagios Integration with HP Service Manager

Post by dchurch »

HIINNS wrote:1. Is there a way to only send 1 e-mail to HPSM when a condition is met, rather than continually sending e-mails until the condition is no longer met? (HPSM sends e-mails to the the group responsible for fixing the problem)
Yes. Setting the Notification Interval to 0 for a host or service will accomplish this.
HIINNS wrote:2. Is there a way to modify the e-mail to include the group name responsible for fixing the problem.
Yes, at a high level, you can do this using Free Variables:
1. Set a Free Variable on the host called "mythingy"
2. Modify xi_host_notification_handler under CCM -> Commands, adding --mygroup=$_HOSTMYTHINGY$
3. Open Admin -> Notification Management, and add a line Group Responsible: %mygroup%

Once you do this, you'll want to "deploy" the notification preferences to the contacts/users affected.

- More about free variables
- Using Free Variables in Notifications
HIINNS wrote:3. Is there a way to only send warning messages to the group responsible for fixing the servers problems, and to add the HPSM mailbox when it reaches a critical state?
There are many ways to do it, including smartening-up the notification command above to only proceed if the host is in a Critical state.

Unfortunately, a "Critical" can be triggered right away, so this may not be what you're looking for, if you're looking to notify the team first, then the HPSM after a time.

You may want to have a look at tweaking your config so Reports -> SLA Report shows meaningful data for any "problem" hosts and/or host groups.

You may also want to try to use a BPI grouping to stagger notifications.
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
HIINNS
Posts: 172
Joined: Wed Mar 14, 2018 9:43 am

Re: Nagios Integration with HP Service Manager

Post by HIINNS »

I just tried implementing putting a user group into a nagios generated e-mail using free variables. In setting mythingy, it asked for a value or it would not allow me to set the variable. What value do I need to use?

Thank you, :roll:
HIINNS
Posts: 172
Joined: Wed Mar 14, 2018 9:43 am

Re: Nagios Integration with HP Service Manager

Post by HIINNS »

Sorry, my bad. Sometimes I just don't think things through. Please ignore my previous post. :oops:
HIINNS
Posts: 172
Joined: Wed Mar 14, 2018 9:43 am

Re: Nagios Integration with HP Service Manager

Post by HIINNS »

I updated the adding the group name to be posted on a notification e-mail as follows:

1. I added the _mythingy variable on MYHOST and added variable NN_TSO_PLNG as the group (verified that _mythingy was added to the /usr/local/nagios/etc/services/MYHOST.cfg). Then modified the xi_host_notification_handler to add the --mygroup=$HOSTMYTHINGY$ to the end of the record. I receive the following e-mail that didn't contain the group I placed in _mythingy.

***** Nagios XI Alert *****

Nagios has detected a problem with this service.

Notification Type: PROBLEM

Service: Disk Usage on C:/
Host: MYHOST
Address: 172.30.29.223
State: CRITICAL
Info:
CRITICAL: Used disk space was 91.90 % (Used: 45.47 GiB, Free: 4.02 GiB, Total: 49.50 GiB)
Date/Time: 2021-03-18 11:27:46

Respond: https://myhost/nagiosxi/rr.php?oid=2707 ... 1542a531cz
Nagios URL: https://myhost/nagiosxi/

Thinking that the free variable should have been _hostmythingy, I made the appropriate change. I got the same result. Have I done something wrong?

Thank you
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: Nagios Integration with HP Service Manager

Post by dchurch »

I think you missed a step where you deploy the notification template to users. That step is necessary because users can set their own notification templates.
HIINNS wrote:--mygroup=$HOSTMYTHINGY$
Well, if that doesn't work, try what I said instead, --mygroup=$_HOSTMYTHINGY$
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
HIINNS
Posts: 172
Joined: Wed Mar 14, 2018 9:43 am

Re: Nagios Integration with HP Service Manager

Post by HIINNS »

My bad. I did have --mygroup=$_HOSTMYTHINGY$ set. Still not returning the group in the e-mail. Sorry for not getting back sooner. I visited my grandson and his family starting on Friday. Got back late yesterday.
HIINNS
Posts: 172
Joined: Wed Mar 14, 2018 9:43 am

Re: Nagios Integration with HP Service Manager

Post by HIINNS »

I read the two links you sent and modified settings according to the directions. I am trying to send an alert when a C Drive exceeds 90%. So I changed the _mythingy variable to NN_TSO_PLNG group. I next modified the xi_service_notification_handler command to include
--mygroup=_SERVICEMYTHINGY , instead of --mygroup=_HOSTMYTHINGY. I then clicked on my userid in the upper right hand corner and modified the the notifications sent to me to include Group: %mygroup%. I next did a bulk change to add _mythingy NN_TSO_PLNG to all C Drive services to free variables. Applied all changes and am still getting the following:

***** Nagios XI Alert *****

Nagios has detected a problem with this service.

Notification Type: PROBLEM

Service: Disk Usage on C:/
Host: MYSERVER
Address: Sorry can't send IPs.
State: CRITICAL
Group: %mygroup%
Info:
CRITICAL: Used disk space was 91.90 % (Used: 45.47 GiB, Free: 4.03 GiB, Total: 49.50 GiB)
Date/Time: 2021-03-23 10:18:59

Respond: https://myserver/nagiosxi/rr.php?oid=27 ... b44fea7730
Nagios URL: https://myserver/nagiosxi/

Any ideas???
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: Nagios Integration with HP Service Manager

Post by dchurch »

HIINNS wrote:So I changed the _mythingy variable to NN_TSO_PLNG group.
So the free variable is called _nn_tso_plng, and it's set to the appropriate string in the service definition?
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
HIINNS
Posts: 172
Joined: Wed Mar 14, 2018 9:43 am

Re: Nagios Integration with HP Service Manager

Post by HIINNS »

Manage Free Variables
Name Value Actions
_xiwizard ncpa
_mythingy NN_TSO_PLNG

/usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php --notification-type=host --contact="$CONTACTNAME$" --contactemail="$CONTACTEMAIL$" --type=$NOTIFICATIONTYPE$ --escalated="$NOTIFICATIONISESCALATED$" --author="$NOTIFICATIONAUTHOR$" --comments="$NOTIFICATIONCOMMENT$" --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hostalias="$HOSTALIAS$" --hostdisplayname="$HOSTDISPLAYNAME$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --lasthoststate=$LASTHOSTSTATE$ --lasthoststateid=$LASTHOSTSTATEID$ --hoststatetype=$HOSTSTATETYPE$ --currentattempt=$HOSTATTEMPT$ --maxattempts=$MAXHOSTATTEMPTS$ --hosteventid=$HOSTEVENTID$ --hostproblemid=$HOSTPROBLEMID$ --hostoutput="$HOSTOUTPUT$" --longhostoutput="$LONGHOSTOUTPUT$" --datetime="$LONGDATETIME$" --mygroup="$_SERVICEMYTHINGY$" -> contents of xi_host_notification handler

Service Alert Message:

***** Nagios XI Alert *****

%alertsummary%

Notification Type: %type%

Service: %service%
Host: %host%
Address: %hostaddress%
State: %servicestate%
Group: %mygroup%
Info:
%serviceoutput%
Date/Time: %datetime%

Respond: %responseurl%
Nagios URL: %xiserverurl%
Locked