Plugin loads but I got this at the top of the plugin management screen:
SQL Error [nagiosxi] : ERROR: syntax error at or near "send_sns"
LINE 1: ...gios XI','nagiosadmin',8,'User installed plugin \'send_sns.p...
Any idea what this is and how to make sure the plugin function is not affected? I am attempting to configure alerts using Amazon AWS SNS service.
SQL error when loading new plugin
Re: SQL error when loading new plugin
Can you post the plugin here as well as the command configurations you have setup for the Notification commands?
It looks like there could be a misplaced option or a typo in the command.
It looks like there could be a misplaced option or a typo in the command.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: SQL error when loading new plugin
I said plugin but I meant command. Sorry for the confusion:
Command name: notify-service-by-sns
Command Line: /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | aws sns publish --topic-arn arn:aws:sns:us-west-2:024374954588:OnshoreitInternal --subject "Onshore IT Service Alert $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" --message "$NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$"
Set as a misc command and it works from a command line if run as the nagios user.
I have a contact template set up to run that command but I don't think I have it set correctly so I tried adding the host and service commands into the Alert Settings tab (manage notification commands) for a contact that I created directly in CCM and a user that currently gets alerts. I see in the notification logs that the command is sent but nothing comes through.
Command name: notify-service-by-sns
Command Line: /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | aws sns publish --topic-arn arn:aws:sns:us-west-2:024374954588:OnshoreitInternal --subject "Onshore IT Service Alert $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" --message "$NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$"
Set as a misc command and it works from a command line if run as the nagios user.
I have a contact template set up to run that command but I don't think I have it set correctly so I tried adding the host and service commands into the Alert Settings tab (manage notification commands) for a contact that I created directly in CCM and a user that currently gets alerts. I see in the notification logs that the command is sent but nothing comes through.
Re: SQL error when loading new plugin
OK, the command looks OK but I think the error is coming from the Manage Notification settings.
Can you provide a screen capture of that so we can view it?
Can you provide a screen capture of that so we can view it?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: SQL error when loading new plugin
Was this the screen you wanted?
You do not have the required permissions to view the files attached to this post.
Re: SQL error when loading new plugin
No, we would need to see the screen where the error is generated.
Or where ever this "send_sns" is defined.
Or where ever this "send_sns" is defined.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: SQL error when loading new plugin
See my post from Fri May 25, 2018 12:15 pm. That is the command definition. I attached a screen shot as well. I don't see any error generated at all but if I run from the command line, I get the mail and sms but if I alert on a failure and cause the failure to happen, I don't get the notification. Could it be a path issue to the aws command perhaps? I will check....
You do not have the required permissions to view the files attached to this post.
Re: SQL error when loading new plugin
Here is the path to the Nagios command:
[nagios@nagiosvpn ~]$ which aws
~/.local/bin/aws
does that need to be in the command line maybe like this:
Command Line: /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | ~/.local/bin/aws sns publish --topic-arn arn:aws:sns:us-west-2:024374954588:OnshoreitInternal --subject "Onshore IT Service Alert $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" --message "$NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$""
Or should I use /home/nagios/.local/bin/aws instead?
[nagios@nagiosvpn ~]$ which aws
~/.local/bin/aws
does that need to be in the command line maybe like this:
Command Line: /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | ~/.local/bin/aws sns publish --topic-arn arn:aws:sns:us-west-2:024374954588:OnshoreitInternal --subject "Onshore IT Service Alert $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" --message "$NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$""
Or should I use /home/nagios/.local/bin/aws instead?
Re: SQL error when loading new plugin
RESOLVED!
It was the path. I set it to the full path and it worked!
I was working the issue with notifications on another ticket and that bled into here. I was more concerned with the SQL error. It is all working now but I am worried that I don't know why I got the SQL error or if it is still an issue that will bite me later. Is there anything we can do to troubleshoot the plugin problem and make sure no issues are brewing?
Thanks!
It was the path. I set it to the full path and it worked!
I was working the issue with notifications on another ticket and that bled into here. I was more concerned with the SQL error. It is all working now but I am worried that I don't know why I got the SQL error or if it is still an issue that will bite me later. Is there anything we can do to troubleshoot the plugin problem and make sure no issues are brewing?
Thanks!
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: SQL error when loading new plugin
Perfect! Glad to hear it is working.dfmco wrote:RESOLVED!
It was the path. I set it to the full path and it worked!
I was working the issue with notifications on another ticket and that bled into here. I was more concerned with the SQL error. It is all working now but I am worried that I don't know why I got the SQL error or if it is still an issue that will bite me later. Is there anything we can do to troubleshoot the plugin problem and make sure no issues are brewing?
Thanks!