Page 1 of 2

Issue with Status Inforamtion - Nagios XI

Posted: Thu Nov 07, 2019 2:46 am
by Srinija544
Hi All,

We have placed a stored procedure in Nagios. But we are getting correct output when we do Run Check Command.

Run Check Command Output:

==================================================================================
Moderator Note: Content removed per request
===========================================================================

But In the original alert - Status Information, We are seeing error message:

WARNING - Use of uninitialized value $sql in sprintf at /usr/local/nagios/local/DB/MSSQL/check_mssql_health line 6509.
Use of uninitialized value in subroutine entry at /usr/local/lib64/perl5/DBD/Sybase.pm line 138.
Use of uninitialized value $sql in pattern match (m//) at /usr/local/nagios/local/DB/MSSQL/check_mssql_health line 6517.
Use of uninitialized value $sql in pattern match (m//) at /usr/local/nagios/local/DB/MSSQL/check_mssql_health line 6517.
, got no valid response for

[cat: /usr/local/nagios/local/DB/SQL/SSIS.sql: No such file or directory
Use of uninitialized value in sprintf at /usr/local/nagios/local/DB/MSSQL/check_mssql_health line 2953.]

===============================================================
Plugin Script:
Please find the attachment for the plugin script./
=============================================================
Command:
$USER2$/DB/MSSQL/check_mssql_health -t 20 --server $HOSTADDRESS$$ARG3$ --username=$ARG1$\\$USER5$ --password=$USER6$ --mode=$ARG2$
======================================================================

Please help me in solving this issue.

Regards,
Srinija.

Re: Issue with Status Inforamtion - Nagios XI

Posted: Thu Nov 07, 2019 12:27 pm
by cdienger
The command definition doesn't seem to match the command that is getting run - "--name "`cat /usr/local/nagios/local/DB/SQL/SSIS.sql`" --name2 'SSIS' --warning 1: --critical 0:" doesn't appear to be in the definition.

Double check the settings of the command definition as well as the plugin and please provide screenshots of the configuration and error if this doesn't help to resolve the problem.

Re: Issue with Status Inforamtion - Nagios XI

Posted: Thu Nov 07, 2019 8:53 pm
by Srinija544
Hi cdienger,

Thank you for your response.

Please find the attached screenshots. If the command is wrong then we should get error in Run Check Command as well.

Regards,
Srinija.

Re: Issue with Status Inforamtion - Nagios XI

Posted: Fri Nov 08, 2019 12:11 pm
by cdienger
It's not clear where the "--name "`cat /usr/local/nagios/local/DB/SQL/SSIS.sql`" --name2 'SSIS' --warning 1: --critical 0:" part of the command is defined. Is it in $ARG2$? Try redefiing the command to look like:

Code: Select all

$USER2$/DB/MSSQL/check_mssql_health -t 20 --server $HOSTADDRESS$$ARG3$ --username=$ARG1$\\$USER5$ --password=$USER6$ --mode=$ARG2$ --name "`cat /usr/local/nagios/local/DB/SQL/SSIS.sql`" --name2 'SSIS' --warning 1: --critical 0:
and then only use "sql" in $ARG2$.

Re: Issue with Status Inforamtion - Nagios XI

Posted: Sun Nov 10, 2019 9:15 pm
by Srinija544
Yes this command(sql --name "`cat /usr/local/nagios/local/DB/SQL/SSIS.sql`" --name2 'SSIS' --warning 1: --critical 0:) is in $ARG2$ but also we are getting the same issue.

$ARG1$: TOWER.LAN
$ARG3$: empty

when i run this command in server backend, i am gettnig correct output:
=========================
[root@dc1prd484 MSSQL]# ./check_mssql_health -t 20 --server dc1prd186.tower.lan --username=$ARG1$\\$USER5$ --password=$USER6$ --mode=sql --name "`cat /usr/local/nagios/local/DB/SQL/SSIS.sql`" --name2 'SSIS' --warning 1: --critical 0:
OK - ssis: 1 | 'ssis'=1;1:;0:
=========================

However, the output from the front end is different and wrong(doesn't satisfy our requirement).
==============================
WARNING - Use of uninitialized value $sql in sprintf at /usr/local/nagios/local/DB/MSSQL/check_mssql_health line 6509.
Use of uninitialized value in subroutine entry at /usr/local/lib64/perl5/DBD/Sybase.pm line 138.
Use of uninitialized value $sql in pattern match (m//) at /usr/local/nagios/local/DB/MSSQL/check_mssql_health line 6517.
Use of uninitialized value $sql in pattern match (m//) at /usr/local/nagios/local/DB/MSSQL/check_mssql_health line 6517.
, got no valid response for

[cat: /usr/local/nagios/local/DB/SQL/SSIS.sql: No such file or directory
Use of uninitialized value in sprintf at /usr/local/nagios/local/DB/MSSQL/check_mssql_health line 2953.]
===================================

Please find the attachment and help me on this.

Regards,
Srinija.

Re: Issue with Status Inforamtion - Nagios XI

Posted: Mon Nov 11, 2019 5:21 pm
by mbellerue
Can you run the command in the backend once more, except before you run it, do su - nagios and then run the command. I think it will fail, but it may give us more information on where it is failing.

Re: Issue with Status Inforamtion - Nagios XI

Posted: Mon Nov 11, 2019 5:33 pm
by cdienger
I've also attached a modified copy of the script to get more info in /usr/local/nagios/libexec/reports.txt to compare the user and arguments that are available when executed.

Did you try defining the command as I suggested in my previous post?

Re: Issue with Status Inforamtion - Nagios XI

Posted: Tue Nov 12, 2019 2:00 am
by Srinija544
Hi mbellerue,

I ran this command su - nagios before running my command still we get the same output no change:
=============================
[nagios@dc1prd484 ~]$ /usr/local/nagios/local/DB/MSSQL/check_mssql_health -t 20 --server dc1prd186.tower.lan --username=$ARG1$\\$USER5$ --password=$USER6$ --mode=sql --name "`cat /usr/local/nagios/local/DB/SQL/SSIS.sql`" --name2 'SSIS' --warning 1: --critical 0:
OK - ssis: 1 | 'ssis'=1;1:;0:;;
========================================


Hi cdienger,

I have tried executing your command also but getting the same output:

$USER2$/DB/MSSQL/check_mssql_health -t 20 --server $HOSTADDRESS$$ARG3$ --username=$ARG1$\\$USER5$ --password=$USER6$ --mode=$ARG2$ --name "`cat /usr/local/nagios/local/DB/SQL/SSIS.sql`" --name2 'SSIS' --warning 1: --critical 0:

Re: Issue with Status Inforamtion - Nagios XI

Posted: Tue Nov 12, 2019 4:38 pm
by cdienger
The modifications will write the additional data to /usr/local/nagios/libexec/reports.txt. You may need to create this file first and make sure nagios has write permissions:

Code: Select all

touch /usr/local/nagios/libexec/reports.txt
chown nagios:nagios /usr/local/nagios/libexec/reports.txt
chmod 664 /usr/local/nagios/libexec/reports.txt

Re: Issue with Status Inforamtion - Nagios XI

Posted: Tue Nov 12, 2019 11:09 pm
by Srinija544
Hi mbellerue/cdienger,

This issue was resolved. Thank you all for your support.

Closing this request.

Regards,
Srinija.