TECHZEN Zenoss User Community ARCHIVE  

zenoss 6 Page command

Subject: zenoss 6 Page command
Author: Jeroen
Posted: 2021-02-25 03:05

Hello,

I moved from zenoss4 to zenoss6 and noticed the trigger notification "page" is missing.  I have a device that sends the sms messages directly connected to my zenoss server.
I have already configured the page command (refering to my own script) in the advanced settings, and I am able to sent a test page to a user without problems.

Since I can't use the page trigger anymore, I decided to try and use a command trigger instead.  The problem I ran into is that I can't pass on the pager/telephone in the command.  I've tried to use $RECIPIENT as used in the advanced settings but I get a BadTalesExpression when the notification is triggered.

Traceback (most recent call last): File "/opt/zenoss/Products/ZenModel/actions.py",
line 332, in execute self.executeOnTarget(notification, signal, target) File "/opt/zenoss/Products/ZenModel/actions.py",
line 729, in executeOnTarget self._execute(notification, signal, environ) File "/opt/zenoss/Products/ZenModel/actions.py",
line 766, in _execute command = processTalSource(command, **environ) File "/opt/zenoss/Products/ZenModel/actions.py",
line 114, in processTalSource raise BadTalesExpresssion(message) BadTalesExpresssion: Unable to perform TALES evaluation
on "/usr/bin/ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null zenoss.ugent.be "/home/zenoss/zscript/sendsms $RECIPIENT testmessage"

How can I use the pager number from the zenoss user database in my notification ?

Thanks !



------------------------------
Jeroen
------------------------------


Subject: RE: zenoss 6 Page command
Author: Laurent Hemeryck
Posted: 2021-02-26 03:25

Hello Jeroen, 
Dag Jeroen, 

Here is how I did it. Under Advanced -> Settings -> Settings, I filled in "Page Command" with this : "/opt/zenoss/var/ext/bin/zenoss_smseagle.py $RECIPIENT". 
You can also see that I moved the script to DFS location, which makes it safe to survive through upgrades.
The message itself is read from the stdin: msg = sys.stdin.read()

Nice to read that Zenoss seems to be used in UGent. 

Groeten, 

Laurent

------------------------------
Laurent Hemeryck
Monitoring Engineer
FedNot
------------------------------


Subject: RE: zenoss 6 Page command
Author: Jeroen
Posted: 2021-02-26 09:21

Hi Laurent,

Thank you for the reply !  We have been running zenoss over 10 years now to monitor our network devices.

The page command under the Advanced Settings does work. I can send a test sms/page from the Advanced Settings User page and it arrives without problem.
Only when an event triggers a COMMAND based Notification using the $RECIPIENT in the command itself, I get a BadTalesExpresssion.

I've checked the zenactiond log and normally the "Target:" contains the page number or the email adres in case of an e-mail action and the "Event:" the message itself.  I would assume that $RECIPIENT would pass on the page number but that doesn't seem to work. 

Do you mean I have to start the script from a different location or in a different way ?


Many thanks,

Jeroen





------------------------------
Jeroen
------------------------------

Hello,

I moved from zenoss4 to zenoss6 and noticed the trigger notification "page" is missing.  I have a device that sends the sms messages directly connected to my zenoss server.
I have already configured the page command (refering to my own script) in the advanced settings, and I am able to sent a test page to a user without problems.

Since I can't use the page trigger anymore, I decided to try and use a command trigger instead.  The problem I ran into is that I can't pass on the pager/telephone in the command.  I've tried to use $RECIPIENT as used in the advanced settings but I get a BadTalesExpression when the notification is triggered.

Traceback (most recent call last): File "/opt/zenoss/Products/ZenModel/actions.py",
line 332, in execute self.executeOnTarget(notification, signal, target) File "/opt/zenoss/Products/ZenModel/actions.py",
line 729, in executeOnTarget self._execute(notification, signal, environ) File "/opt/zenoss/Products/ZenModel/actions.py",
line 766, in _execute command = processTalSource(command, **environ) File "/opt/zenoss/Products/ZenModel/actions.py",
line 114, in processTalSource raise BadTalesExpresssion(message) BadTalesExpresssion: Unable to perform TALES evaluation
on "/usr/bin/ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null zenoss.ugent.be "/home/zenoss/zscript/sendsms $RECIPIENT testmessage"

How can I use the pager number from the zenoss user database in my notification ?

Thanks !



------------------------------
Jeroen
------------------------------



Subject: RE: zenoss 6 Page command
Author: Laurent Hemeryck
Posted: 2021-02-26 09:40

Hello Jeroen, 

I can only remember that I had some issues with the COMMAND notification, but I can't remember what exactly. There must be a reason why I used the Page command. I'm not sure, but I think that's the only way to pull out the user's phone number. That's something I should check. 

The location of your script will not impact the variable you can import into it. However, placing it in a safe place will assure you that it remains in place even after container restarts and upgrades. 

Cheers, 

Laurent

------------------------------
Laurent Hemeryck
Monitoring Engineer
FedNot
------------------------------


Subject: RE: zenoss 6 Page command
Author: Jeroen
Posted: 2021-02-26 09:51

Hi Laurent,

Thanks for the reply.  It's unfortunate that they removed the Page Action trigger going from zenoss 5 to zenoss 6.  So now there seems no way to pass on the configured page number in an event trigger.

Regards,

Jeroen

------------------------------
Jeroen
------------------------------

Hi Laurent,

Thank you for the reply !  We have been running zenoss over 10 years now to monitor our network devices.

The page command under the Advanced Settings does work. I can send a test sms/page from the Advanced Settings User page and it arrives without problem.
Only when an event triggers a COMMAND based Notification using the $RECIPIENT in the command itself, I get a BadTalesExpresssion.

I've checked the zenactiond log and normally the "Target:" contains the page number or the email adres in case of an e-mail action and the "Event:" the message itself.  I would assume that $RECIPIENT would pass on the page number but that doesn't seem to work. 

Do you mean I have to start the script from a different location or in a different way ?


Many thanks,

Jeroen





------------------------------
Jeroen

Hello,

I moved from zenoss4 to zenoss6 and noticed the trigger notification "page" is missing.  I have a device that sends the sms messages directly connected to my zenoss server.
I have already configured the page command (refering to my own script) in the advanced settings, and I am able to sent a test page to a user without problems.

Since I can't use the page trigger anymore, I decided to try and use a command trigger instead.  The problem I ran into is that I can't pass on the pager/telephone in the command.  I've tried to use $RECIPIENT as used in the advanced settings but I get a BadTalesExpression when the notification is triggered.

Traceback (most recent call last): File "/opt/zenoss/Products/ZenModel/actions.py",
line 332, in execute self.executeOnTarget(notification, signal, target) File "/opt/zenoss/Products/ZenModel/actions.py",
line 729, in executeOnTarget self._execute(notification, signal, environ) File "/opt/zenoss/Products/ZenModel/actions.py",
line 766, in _execute command = processTalSource(command, **environ) File "/opt/zenoss/Products/ZenModel/actions.py",
line 114, in processTalSource raise BadTalesExpresssion(message) BadTalesExpresssion: Unable to perform TALES evaluation
on "/usr/bin/ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null zenoss.ugent.be "/home/zenoss/zscript/sendsms $RECIPIENT testmessage"

How can I use the pager number from the zenoss user database in my notification ?

Thanks !



------------------------------
Jeroen
------------------------------



< Previous
Zenoss - Mysql/Innodb - ibdata1 is huge
  Next
Cisco Gateway monitoring via SSH
>