Re: [Nagios-users] Nagios Variables

2012-08-02 Thread Ruslan Valiyev
As I said, it's possible to extract the data from the variables you
mentioned.

*[root@bravura ~]# cat /usr/local/nagios/libexec/just_test*
#!/bin/bash
echo $NAGIOS_HOSTNAME

*Define a command:*
define command {
command_namejust_test_cmd
command_line$USER1$/just_test > /tmp/test.txt
}

*Define a service:*
define service {
name just_test_srv
use  local-service
host_namebravura.svc.unicc.org
check_commandjust_test_cmd
service_description  Just test
}

After check is run, you will get your data.

*[root@bravura ~]# cat /tmp/test.txt*
bravura.svc.unicc.org

Hope it helps.


Ruslan

On Thu, Aug 2, 2012 at 12:49 PM, Bruno Martins  wrote:

> Hello there,
>
> Thanks for fast reply.
>
> I have that setting in my nagios.cfg file:
> enable_environment_macros=1
>
> Do you know how can I make this possible, if it is really possible...
>
> Best regards,
>
> Bruno
>
>
> On Thu, Aug 2, 2012 at 11:32 AM, Assaf Flatto  wrote:
>
>> **
>> The marco's are internal to nagios and will not be read from an external
>> text file .
>>
>> there is a way to make nagios macros available to external commands (
>> look for "macros" in the nagios.cfg file)
>>
>> But what you are trying to do with the message.txt file will fail to work
>> as the SendEmail script most likely do not have access to the nagios
>> internal macros and there for will not expand them .
>>
>>
>>
>> On 02/08/12 11:25, Bruno Martins wrote:
>>
>> Hello list,
>>
>> How can I access Nagios variables like $NOTIFICATIONTYPE$, $SHORTDATETIME$,
>> etc from a text file passed in a command?
>>
>> I have one command which is:
>> /usr/local/bin/sendEmail -o message-file=/etc/nagios/message.txt ... bla
>> bla bla
>>
>> And inside message.txt I have those variables. However when I am
>> notified, I am not getting variable's values, instead, it gives me the
>> plain string "$NOTIFICATIONTYPE$", etc.
>>
>> Googling didn't help too much.
>>
>> Thanks for all help on this!
>>
>> Best regards,
>>
>> Bruno
>>
>>
>> --
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>
>>
>> ___
>> Nagios-users mailing 
>> listNagios-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/nagios-users
>> ::: Please include Nagios version, plugin version (-v) and OS when reporting 
>> any issue.
>> ::: Messages without supporting info will risk being sent to /dev/null
>>
>>
>>
>>
>> --
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> ___
>> Nagios-users mailing list
>> Nagios-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/nagios-users
>> ::: Please include Nagios version, plugin version (-v) and OS when
>> reporting any issue.
>> ::: Messages without supporting info will risk being sent to /dev/null
>>
>
>
>
> --
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> ___
> Nagios-users mailing list
> Nagios-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when
> reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and 

Re: [Nagios-users] Nagios Variables

2012-08-02 Thread Ruslan Valiyev
You need to append "NAGIOS_" eg. NAGIOS_NOTIFICATIONTYPE. And also make
sure you do "enable_environment_macros=1" in nagios.cfg


Ruslan

On Thu, Aug 2, 2012 at 12:32 PM, Assaf Flatto  wrote:

> **
> The marco's are internal to nagios and will not be read from an external
> text file .
>
> there is a way to make nagios macros available to external commands ( look
> for "macros" in the nagios.cfg file)
>
> But what you are trying to do with the message.txt file will fail to work
> as the SendEmail script most likely do not have access to the nagios
> internal macros and there for will not expand them .
>
>
>
> On 02/08/12 11:25, Bruno Martins wrote:
>
> Hello list,
>
> How can I access Nagios variables like $NOTIFICATIONTYPE$, $SHORTDATETIME$,
> etc from a text file passed in a command?
>
> I have one command which is:
> /usr/local/bin/sendEmail -o message-file=/etc/nagios/message.txt ... bla
> bla bla
>
> And inside message.txt I have those variables. However when I am notified,
> I am not getting variable's values, instead, it gives me the plain string 
> "$NOTIFICATIONTYPE$",
> etc.
>
> Googling didn't help too much.
>
> Thanks for all help on this!
>
> Best regards,
>
> Bruno
>
>
> --
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
>
> ___
> Nagios-users mailing 
> listNagios-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when reporting 
> any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>
>
>
>
> --
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> ___
> Nagios-users mailing list
> Nagios-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when
> reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Re: [Nagios-users] Differentiate receivers based on alert severity?

2012-07-30 Thread Ruslan Valiyev
Does it mean I have to create two different service templates and specify
my emails there?


On Mon, Jul 30, 2012 at 11:13 AM, Assaf Flatto  wrote:

> **
> Yes , you can use two different contacts , one that has only warning , and
> the other only for critical .
>
>
>
>
> On 30/07/12 09:54, Ruslan Valiyev wrote:
>
> Hi,
>
>  I was wondering if it's possible to achieve something a la:
>
>  - when CPU alerts are warning, they should go to us...@foo.com
> - when CPU alerts are critical, they should go to us...@foo.com
>
>
>  Ruslan
>
>
> --
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
>
> ___
> Nagios-users mailing 
> listNagios-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when reporting 
> any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>
>
>
>
> --
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> ___
> Nagios-users mailing list
> Nagios-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when
> reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

[Nagios-users] Differentiate receivers based on alert severity?

2012-07-30 Thread Ruslan Valiyev
Hi,

I was wondering if it's possible to achieve something a la:

- when CPU alerts are warning, they should go to us...@foo.com
- when CPU alerts are critical, they should go to us...@foo.com


Ruslan
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Re: [Nagios-users] check_ntp_time sometimes reports Offset unknown

2012-07-25 Thread Ruslan Valiyev
Actually, the machine I am running this plugin from is a Windows 2008 server.


Ruslan

On Jul 25, 2012, at 6:39 PM, Alberto Larripa wrote:

> Do you have installed the last versión of the check_ntpd plugin in you 
> client-server machine?, this problem sometimes occur if you don't have the 
> last version.
> 
> See you
> 
> 
> Alberto Larripa
> Sysadmin and DBA Administrator
> Company: University of navarra
> www.albertolarripa.com
> --
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. 
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
> Nagios-users mailing list
> Nagios-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when reporting 
> any issue. 
> ::: Messages without supporting info will risk being sent to /dev/null

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Re: [Nagios-users] check_ntp_time sometimes reports Offset unknown

2012-07-25 Thread Ruslan Valiyev
Sorry, I typed wrong. I meant, the machine executing check_ntp_time is a RHEL 
server, while the host I'm checking (-H) is a Windows server.


Ruslan

On Jul 25, 2012, at 7:59 PM, Ruslan Valiyev wrote:

> Actually, the machine I am running this plugin from is a Windows 2008 server.
> 
> 
> Ruslan
> 
> On Jul 25, 2012, at 6:39 PM, Alberto Larripa wrote:
> 
>> Do you have installed the last versión of the check_ntpd plugin in you 
>> client-server machine?, this problem sometimes occur if you don't have the 
>> last version.
>> 
>> See you
>> 
>> 
>> Alberto Larripa
>> Sysadmin and DBA Administrator
>> Company: University of navarra
>> www.albertolarripa.com
>> --
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and 
>> threat landscape has changed and how IT managers can respond. Discussions 
>> will include endpoint security, mobile security and the latest in malware 
>> threats. 
>> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
>> Nagios-users mailing list
>> Nagios-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/nagios-users
>> ::: Please include Nagios version, plugin version (-v) and OS when reporting 
>> any issue. 
>> ::: Messages without supporting info will risk being sent to /dev/null
> 

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

[Nagios-users] check_ntp_time sometimes reports Offset unknown

2012-07-25 Thread Ruslan Valiyev
Hi all,

Sometimes the output from check_ntp_time is "Offset unknown" while the ntp
server is fine.

It can stay like that for a while and then comes back to normal.

Here's a sample output while the problem was present on the server:

*[root@bravura plugins]# ./check_ntp_time -v -H windows.foo.com*
sending request to peer 0
response from peer 0: offset 1.376408458
sending request to peer 0
response from peer 0: offset 1.375704885
sending request to peer 0
response from peer 0: offset 1.375001431
sending request to peer 0
response from peer 0: offset 1.374346972
discarding peer 0: flags=3
overall average offset: 0
NTP CRITICAL: Offset unknown|

*OS:* Red Hat Enterprise Linux Server release 6.2 (Santiago) 64-bit
*nagios-plugins:* check_ntp_time v1.4.16-29-g3c10 (nagios-plugins 1.4.16)

Any ideas?


Regards,
Ruslan
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

[Nagios-users] Allow access to custom variables outside Nagios

2012-06-16 Thread Ruslan Valiyev
Hi all,
 
We have custom variables like this:
 
define host {
use linux-server
host_name   host.foo.com
address 192.168.1.44
_serverfunction Oracle EBS R12 Application Server
_serveradminAdmins_Linux
_serviceadmin   Admins_Oracle
_userorgACME
}
 
Now we have our own script to send out the notifications. And, apparently, 
custom variables are not exported outside Nagios for safety.
 
To give an example of when we’re able to get the var data:
my $o_hostname = $ENV{NAGIOS_HOSTNAME};
 
And this one doesn’t return anything:
my $o_hostfunction = $ENV{NAGIOS__HOSTSERVERFUNCTION};
 
Could someone help finding this limitation in the source code? The environment 
we have is pretty strict and isolated, also the custom variables we use never 
contain any confidential information.


Regards,
Ruslan--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null