how to send top snapshot when monit loadavg matched - monit

I am getting occasional resource limit (loadavg) alerts from monit in the middle of the night. The server seems to recover fine, but I'd love to know what's going on right at that time.
The (default) monit alert email includes a "description", but that just indicates that the loadavg (1min) or (5min) hit my threshold.
How can I setup this specific alert to include something like a 'top' snapshot so I can see the top 10-20 procs and figure out what's actually using all the resources?
I found this: stackoverflow-31513996, but I don't want to generate additional alerts, I just want additional info in the alert. Or should I somehow disable the alert on this test and enable an 'exec' like this link suggests???
Monit v5.14 on CentOS 7.

There is no possibility (yet) to customize the message content with custom values when using built-in alerts. You have to disable the alert and use a custom script as in the link you suggest.

Related

Is there a way to delay recovery operations action in Zabbix like with regular operations?

I can configure Zabbix to send me mail warning notifications only if a certain amount of time has passed and the trigger problem is still active on the dashboard.
Now, Zabbix doesn't have an option under "recovery operations" for delay like "Operations" has but is there a way to configure something so I can receive "RESOLVED" mail only if there was a "PROBLEM" mail for a certain trigger in the first place?
The way it works now is - if I set up 'recovery operations' for sending me 'resolved' mail it will send me that regardless if it did or didn't send me 'problem mail'.
I want to do solve this because it's very annoying getting all the notifications but I still need some notifications. Like when a problem is active for more than 20 minutes and I only want to see problem and resolved notifications for that.
Unfortunately there's no way out of the box to manage the recovery operation.
You can find more details in the documentation:
Recovery operations do not support escalating - all operations are
assigned to a single step.
If this is an important issue to you there are some ways to mitigate it, but any workaround that comes to mind is time consuming.
You can implement multiple triggers with tags and tag-bound actions (ie: duplicate triggers with different actions and recovery actions), manage the issue with an agent in your mailbox (horrible!) or write a custom script to be used as default recovery action.
This script should receive the problem ID as a parameter and use it to check via API if it needs to silently close the issue or send an email or set a trigger with a specific tag and use it with another zabbix action etc...

Configure Outgoing Mail Servers on Debugging

When configuring OMS you can specify, whether it's a debugging server or not. I marked it as one, but I couldn't find any information about that mark. I can check it manually and do not send emails when I'm on debugging server...
mail_values = template.with_context(context).generate_email(self.id)
mail = self.env['mail.mail'].create(mail_values)
IrMailServer = self.env['ir.mail_server'].search([], order='sequence desc')[0]
if not IrMailServer.smtp_debug:
mail.send()
But is there any better possibility to do so? Or maybe it's already implemented somewhere, and I couldn't find it?
This flag is used for showing more debugging information in the Odoo logfile. Your Odoo server has to be configured with log level "debug" to show these information.
With this conditions you will see the SMT protocol (SMTP) messages in your Odoo log, which makes it much easier to find out about problems sending emails from Odoo.
It's not a test mode! You will really send emails with this settings.

How to edit telnet form programmatically?

I'm not even sure whether I've framed this question correctly. Let me explain my situation.
I have an Application hosted in a OpenVMS environment which is being accessed via Telnet. I'm in need to programmatically accomplish certain tasks.
So far I could send and receive messages using a C# Telnet Client. I am able to execute tasks by sending commands and receiving responses. But for one task, I have to edit a Form to change some information. The command looks like below
>modify page <page_no>
As soon as I enter the above command, the entire terminal gets loaded with this Form, I have to use page-down to go through the fields, press enter to edit the text and use Ctrl-Z to save it.
I'm not sure how to accomplish this task programmatically.
I'm not familiar with telnet or VxWorks. I'm not sure the above is a feature of Telnet or OpenVMS. Kindly help.
This should be easy to figure out thanks to the clear text of telnet :D It shouldn't matter what platform your target is running. All you have to remember is that special keys like ctrl-z or page down, are just chars in the data stream. Ctrl-z is typically 0x1a, and I am not sure what page down is off the top of my head, but here is how you can figure it out:
Get wireshark http://www.wireshark.org/ and install it if you don't already have it.
Start wireshark up and capture all traffic on your NIC that will carry the connection to the target.
Start a normal telnet session to the target and issue all of the commands (including the page downs and the ctrl-z).
Stop wireshark capture and then filter out everything except telnet communication between you and the target.
Look at the data that was sent to issue the ctrl-z, and page downs.
Put those chars in your telnet stream when you are ready to issue those commands.
Easy.

Task Scheduler Win Srvr 2K8 - Run in Foreground/Interactive

Good morning. I have an application that queries a REST source. It needs to run continuously, capturing data which is refreshed every five minutes, without fail. My solution is Task Scheduler, where the app is set to launch on server boot. Once launched, it uses a timer to re-query periodically. The TS task is set to repeat every five minutes, with the check box "if app is already running, do not start another instance," so if the app crashes it should restart automatically within five minutes.
This works fine, but TS launches the app invisibly. I'd feel warmer and fuzzier inside if I could see the app, just as if I'd launched it myself. Also, if I need to close it (e.g., to post a new exe), I have to kill it via Task Manager; ouch. I've gone over the TS options a dozen times for some kind of "launch in foreground" option, but none exists. Can anyone tell me what I'm missing?
Notes:
From my web searches, it's clear that an app is only allowed to interact with the desktop if it's running under the same user account... but it is, I'm using my AD account, not SYSTEM or another local account.
It's acceptable for the app to only be visible to me, though even better would be if other users could also see and interact with it. I suppose the only way that would work would be if each user had their own monitor app which just reflected results exposed from a single invisible app which actually did the work.
I get the same behavior if I start the TS task manually or if it launches on boot automatically.
"Run only when the user is logged on" won't do, as I need it to resume even if the server restarts in the middle of the night.
I had been launching the app with a little PS script, so I could send a notification if the app failed to launch at all, but there's no change if I have TS launch it directly.
I suppose the proper solution would be to write this as a service. I put some time into that, but I haven't done that before and couldn't get it running. If the consensus is that that would be a better approach, I'll give it another try.
Any ideas? Thanks!
If you set the task to "run only when user is logged in" then it will be visible for you if you uncheck the "hidden" box.
If you have the "Run whetever user is logged on or not" choice checked, then it will be hidden even if you uncheck the "hidden" box. The implementation of Task Scheduler doesn't allow you to run programs in the foreground if you aren't logged in.
To solve this you can create a user that does AutoAdminLogon and start the application with the Startup script. By doing it this way, you will make the server log in with this user on boot and start the program you want.
If you then want to check how it's going or so, you can login as that user or switch to that session.

Work managers threads constraint and page cannot be displayed

We have a memory intensive processing for certain functionality and we would like to limit the number of parallel requests to this processing. We are able to configure by using "Work Managers" in WebLogic and putting a limit on the number of threads for that servlet.
For example, if we put maximim thread limit as 3, then if there are 10 parallel requests; 7 requests are in queue. There could be situations where these the requests waiting in queue could take up to 30-40 minutes to be processed. We did simple testing and the received page cannot be displayed due to timeout after 15 mins and received the message after 1 hour.
Does any one know if there is a setting in WebLogic to increase/decrease timeout and avoid page cannot be displayed?
Appreciate if any one has any thoughts around this.
Does any one know if there is a setting in WebLogic to increase/decrease timeout and avoid page cannot be displayed?
There might be something but I actually didn't check as it would be a bad advice anyway. By looking for this, you are trying to solve the wrong problem here. A browser is just not made for long-running process like the one you are describing (>30mn) even if you don't mind the user waiting (not mentioning that he could refresh the page and queue more and more jobs).
So, the right answer here is in my opinion: use asynchronism, this is the perfect use case. When the user clicks on the button, send a JMS message to a queue (or create a Quartz job) and send the user a page with a request ID telling him to come back later. When the processing is done, update the status somewhere and make the status/result available to the user. Really, the user experience will be better doing this and you'll face less problems than with a browser.
1) Use some other tool (not browser) like WGET where you can control timeout parameter (--timeout).
2) Why do you use HTTP? Use message driven beans and send message JMS to that and don't care about time outs.
Perhaps quartz can do what you need? Start a job and check in on it as you need to?