KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Passing extra info from shell script to email action

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
Harry



Joined: 10 Oct 2018
Posts: 8

PostPosted: Fri Jun 28, 2019 3:33 am    Post subject: Passing extra info from shell script to email action Reply with quote

We have several tests using a VB script to check some values in databases (like messages processed, log table records, status checks)
For example we have a reply from the test script "2 unprocessed messages in my_queue_table" which will trigger an alert action sending an mail using the %Reply% in the body.

The end of the current VB script which will pass the %status% and %reply% back to Hostmonitor:
Code:
WScript.StdOut.Write statusBad 'const statusBad = "scriptRes:Bad:"
WScript.StdOut.Write replyText 'variable replyText filled from query result in first part of the script

But I'm looking for a way to pass more details / info back to HM, to use it in the email.
But only %status% and %reply% can be used.

For example, I'm looking at some kind of this output with record details in the mail fetched by the query in the VB script:
Quote:
2 unprocessed messages in my_queue_table:
#1 11:09:53 Sender1 Destionation22 MsgTypeXYZ
#2 11:10:16 Sender2 Destionation33 MsgTypeABC

I was trying to use WScript.StdOut.WriteLine instead of Write. But only 1 line will be passed back to HM.
I thought another option was to use <BR> into the replyText. But this will result in unreadable / dirty reply values in HM it selves (with a whole list of 'lines'). And also the <BR> will be encoded as &lt;br&gt; into the mail body and shown as <BR> in the text instead of give a linefeed

I'm looking into a solution to pass more details into the alert email like an extra variable which could be set. For example set a variable like %ReplyFullDetails% with all the details build up in the script containing CR's. And then be used this %ReplyFullDetails% in the mail template. But as far I know you can not set any other variable (or misuse an existing one) in a test script.

Any suggestions?
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12790
Location: USA

PostPosted: Fri Jun 28, 2019 6:52 am    Post subject: Reply with quote

Looks like we need new variable, something like %Reply_AsIs% or %Reply_withBRtags% so HostMonitor will not process <br> tags when you use variable in HTML report or HTML e-mail.
What version of HostMonitor do you use?
Could you please send your registration name or order number to support@ks-soft.net?

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
Harry



Joined: 10 Oct 2018
Posts: 8

PostPosted: Fri Jun 28, 2019 7:46 am    Post subject: Reply with quote

Thanks for your reply and your suggestion.
Currently using v 11.97 and will send you the registration details.

Is it also possible to catch the script output with line breaks into the the new %New_Reply_Variable% variable?
And to fill the current %Reply% value only with the first line as it is now.
Or fill the %New_Reply_Variable% with full details in another way?
For example
Code:
WScript.StdOut.Write statusBad
WScript.StdOut.WriteLine "2 unprocessed messages in my_queue_table:" 'This line will come into the %Reply% value
'after line break the next values wont come into the %Reply% value
'Loop trough the records
WScript.StdOut.WriteLine record_id record_time record_sender record_dest record_type "<BR> or /c/r " 'This lines will come into the %New_Reply_Variable% value

Advantage is that the short/simple/normal %Reply% value will be presented in the GUI without a lot of text / lines / details and will be easier to handle in conditions in other steps. And the full reply is available in the mail actions.

Also want to suggest for processing the html tags (<BR> in this case) to make a checkbox in the mail template or mail action properties "Process variables as is" to disable processing any HTML tags instead of make 1 variable specific for 1 html tag like the %Reply_withBRtags% suggest to do
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12790
Location: USA

PostPosted: Sat Jun 29, 2019 3:46 am    Post subject: Reply with quote

We sent you update, added %Reply_AsIs%
We will not change script behavior, at least in version 11, may be in version 12..

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
Harry



Joined: 10 Oct 2018
Posts: 8

PostPosted: Tue Jul 02, 2019 6:03 am    Post subject: Reply with quote

Thanks for the %Reply_AsIs% extension. This will answer my requirements to put more script output data into a mail from alert profile in a bit structured way.
For the long term I like the idea to manipulate / fill more variables from the scripting host. But I understood this can not be delivered in the current version.
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12790
Location: USA

PostPosted: Tue Jul 02, 2019 7:31 am    Post subject: Reply with quote

We sent you e-mail with another update and instructions how to setup test for your needs.

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
Kris



Joined: 12 May 2010
Posts: 375

PostPosted: Fri Jul 05, 2019 1:46 am    Post subject: Reply with quote

Interesting

Is this feature available in the 11.99 beta version?
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12790
Location: USA

PostPosted: Fri Jul 05, 2019 5:02 am    Post subject: Reply with quote

No
If you need update, please send request to support@ks-soft.net

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
Harry



Joined: 10 Oct 2018
Posts: 8

PostPosted: Fri Jul 05, 2019 6:00 am    Post subject: Reply with quote

KS-Soft wrote:
We sent you e-mail with another update and instructions how to setup test for your needs.

Thanks for the suggestion, I've implemented this and will start 'playing' with some variations.

Really appreciate the quick response and making small modifications!
Back to top
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 12790
Location: USA

PostPosted: Fri Jul 05, 2019 6:01 am    Post subject: Reply with quote

You are welcome

Regards
Alex
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index