Direct link to Host/Service problem in Message Notification
Re: Direct link to Host/Service problem in Message Notification
Can you provide an example $HOSTNOTESURL$?
I'm concerned about php's handling of GET vs POST/arguments VS an array. There are also the auth differences as XI's interface uses cookies and javascript. What features does the smartphone support? We make heavy use of frames also.
Accessing the legacy nagios UI may be an option, but we do plan on completely removing this once the XI UI is a feature compatible replacement.
I'm concerned about php's handling of GET vs POST/arguments VS an array. There are also the auth differences as XI's interface uses cookies and javascript. What features does the smartphone support? We make heavy use of frames also.
Accessing the legacy nagios UI may be an option, but we do plan on completely removing this once the XI UI is a feature compatible replacement.
Re: Direct link to Host/Service problem in Message Notification
Correct the links now work the problem is that if you do not have a session cookie? or something like that then rather then giving you a login/password challenge/response it just throws up a "Session timed out" message. Behaviour should be
1) hit link
2) challenge/response auth
3) display page
That is how things worked under core just using apache auth. however under XI you hit the link and it doesn't ask you to log in it just tells you that your session has timed out so the link only works if you already have a valid session in your browser.
1) hit link
2) challenge/response auth
3) display page
That is how things worked under core just using apache auth. however under XI you hit the link and it doesn't ask you to log in it just tells you that your session has timed out so the link only works if you already have a valid session in your browser.
Re: Direct link to Host/Service problem in Message Notification
Actually, htmlentities() doesn't apply, as the notification commands he's using send notifications directly from Nagios Core. Only notifications that are routed through Nagios XI are subject to the PHP stuff that's been added.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Ethan Galstad
President
Ethan Galstad
President
Re: Direct link to Host/Service problem in Message Notification
fmpub:
I'm sorry I didn't follow your last message. Could you please provide more information.
What features does the smartphone support?
I'm sorry I didn't follow your last message. Could you please provide more information.
Can you provide an example $HOSTNOTESURL$? Please label them as working/not-working/ect.mmestnik wrote:Can you provide an example $HOSTNOTESURL$?
I'm concerned about php's handling of GET vs POST/arguments VS an array. There are also the auth differences as XI's interface uses cookies and javascript. What features does the smartphone support? We make heavy use of frames also.
Accessing the legacy nagios UI may be an option, but we do plan on completely removing this once the XI UI is a feature compatible replacement.
What features does the smartphone support?
Re: Direct link to Host/Service problem in Message Notification
So here is what is happening. Under Naios Core we had apache auth on "/" so you would hit the link regardless of your browser (mobile etc.) and it would challenge you to auth and once done so would pull up your page and allow you to acknowledge the service/host problem
XI uses a completely different auth. so when you hit the Link the webpage tries to pull up and it goes "you don't have an auth token, your session has timed out" rather then first asking you to auth then redirecting you to the page so you can acknowledge services.
The Illegal Macro thing has allowed us to get the Link working, but there remains the auth problem which I believe we have solved by changing the URL to do the following;
XI uses a completely different auth. so when you hit the Link the webpage tries to pull up and it goes "you don't have an auth token, your session has timed out" rather then first asking you to auth then redirecting you to the page so you can acknowledge services.
The Illegal Macro thing has allowed us to get the Link working, but there remains the auth problem which I believe we have solved by changing the URL to do the following;
Code: Select all
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nAcknowledged By: $SERVICEACKAUTHORALIAS$\nAcknowledgment Note: $SERVICEACKCOMMENT$\nURL: $SERVICENOTESURL$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
becomes
/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nAcknowledged By: $SERVICEACKAUTHORALIAS$\nAcknowledgment Note: $SERVICEACKCOMMENT$\nURL: http://nagios.fmpub.net/nagiosxi/login.php?redirect=/nagiosxi/includes/components/xicore/status.php%3Fshow=servicedetail%26host=$HOSTALIAS$%26service=$SERVICEDESC$%26dest=auto\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
Re: Direct link to Host/Service problem in Message Notification
You have it working then?
Do think it would be acceptable to redirect unauthenticated requests to the login script with the correct parameter to redirect back?
Do think it would be acceptable to redirect unauthenticated requests to the login script with the correct parameter to redirect back?
Re: Direct link to Host/Service problem in Message Notification
it's working.. I need to use the illegalmacro thing to get it to work so that's not 100% ideal but workable not sure what kind of an RFE can fix that but will allow you guys to decide. The Reformatting of the URL works but perhaps it may be better for Nagios XI to do this by default if possible. that is to redirect someone to the login screen if they do not have an auth token/session and then redirect them back to their page after auth.
If something like that is possible I could see the value in it's addition to XI.
If something like that is possible I could see the value in it's addition to XI.
Re: Direct link to Host/Service problem in Message Notification
I've opened a tracker for the unauthenticated redirect.
I still don't follow what part of the macro is illegal. Can you provide an example?
This is how I'd have expected this to be done:Any char that can't be sent because of command expansion rules can be replaced with it's oct/hex/uni code like so:
I still don't follow what part of the macro is illegal. Can you provide an example?
This is how I'd have expected this to be done:
Code: Select all
/usr/bin/printf "***** Nagios *****\n\nNotification Type: %s\nAcknowledged By: %s\nAcknowledgment Note: %s\nURL: http://nagios.fmpub.net/nagiosxi/login.php?redirect=/nagiosxi/includes/components/xicore/status.php%%3Fshow=servicedetail%%26host=%s%%26service=%s%%26dest=auto\n\nService: %s\nHost: %s\nAddress: %s\nState: %s\n\nDate/Time: %s\n\nAdditional Info:\n\n%s" "$NOTIFICATIONTYPE$" "$SERVICEACKAUTHORALIAS$" "$SERVICEACKCOMMENT$" "$HOSTALIAS$" "$SERVICEDESC$" "$SERVICEDESC$" "$HOSTALIAS$" "$HOSTADDRESS$" "$SERVICESTATE$" "$LONGDATETIME$" "$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
Code: Select all
\NNN byte with octal value NNN (1 to 3 digits)
\xHH byte with hexadecimal value HH (1 to 2 digits)
\uHHHH Unicode (ISO/IEC 10646) character with hex value HHHH (4 digits)
\UHHHHHHHH
Unicode character with hex value HHHHHHHH (8 digits)
Re: Direct link to Host/Service problem in Message Notification
No that's not it.. the problem is that Nagios doesn't automatically redirect to a login page if you don't have an auth token, then after auth'ing redirect you back to the page you were trying to get to.
Re: Direct link to Host/Service problem in Message Notification
I thought you had two problems.
1. Login redirect. From what I can tell this isn't going to be fixed. Insert this into your URL should be a workaround:2. Something with illegalmacro. I don't understand, perhaps this was never a problem and instead your problem was only #1?
1. Login redirect. From what I can tell this isn't going to be fixed. Insert this into your URL should be a workaround:
Code: Select all
/nagiosxi/login.php?redirect=