hvrmaint - Housekeeping script for HVR on the hub machine.
hvrmaint [optfile] [-options]
Command hvrmaint is a script for regular housekeeping of the HVR on the hub machine. The script can run on the hub machine and can be scheduled on Unix using crontab or as a Windows scheduled task.
The hvrmaint can be used for three main purposes:
- Maintenance. Schedule hvrmaint nightly (or weekly) with options -stop and -start. These options instruct hvrmaint to restart the HVR Scheduler. Often other options can be used, such as -scan_hvr_out (scan log files for HVR errors) or -archive_dir (move old log files to archive directory). Option -email can be used to send an email with the status summary to operator(s). When used in this way, hvrmaint could be scheduled on Unix using crontab, and on Windows as a Windows Scheduled Task.
- Monitoring. Run hvrmaint frequently (e.g. every 15 minutes) with options -ping, -check_logfile_growth and -scan_hvr_out to check if the HVR Scheduler is running and to scan the HVR log files for errors. Running hvrmaint this way does not interrupt the HVR Scheduler. There is option -email_only_when_errors to send emails only if an error has occurred.
- Backup. The last way to use hvrmaint is as part of a larger nightly or weekly batch script, which halts all server processes (including the DBMS), does a system backup and then restarts everything again. In this case, hvrmaint would be called at the top of the batch script with option -stop (stop the HVR Scheduler) and would then be called again near the bottom with option -start (restart the HVR Scheduler).
Command hvrmaint cannot process log files containing more than 12 months of data.
The behavior of hvrmaint is controlled by an option file, which can be generated using the HVR Maintenance Tasks dialog available from the context menu of the Scheduler.
- Right-click the Scheduler node and select Maintenance Tasks from the context menu. The Maintenance Tasks dialog opens with the list of tasks on the left pane and configuration options on the right pane (see the description of options available for command hvrmaint below).
- Click the Add button at the bottom of the left pane to create a new task (option file). Type the name of the task and click OK.
- Select the required options, specify parameters for them, where needed and click Save.
- Click Run to run the hvrmaint script you created against the hub. You can click View Log to watch the output of the script.
- The time options on the bottom pane allow you to schedule the task to run at a specific time, namely at regular intervals, daily or weekly.
Select Highest Privileges option to run the task with administrative permissions.
This section describes the options available for command hvrmaint.
Task name is used internally by hvrmaint to locate its option file and name its offset files. This allows different tasks defined in the GUI to have a different state. e.g. so that a when a task for one channel has processed today's files a different task for a different channel still remembers to process today's files.
Scan Scheduler log file hvr.out. Command hvrmaint writes a summary of HVR errors detected in this file to its output and to any emails that it sends.
Only scan for general errors and errors in specified channel(s) chn.
Only scan for general errors and errors in specified locations(s) loc.
Ignore log records which match specified pattern patt (can be regular expression).
Check that HVR Scheduler is actually running using hvrtestscheduler. If option -stop is also defined then this test is performed before the HVR Scheduler is stopped. If option -start is supplied then hvrmaint always checks that the HVR Scheduler is running using a test, regardless of whether or not option -test_scheduler is defined.
Check that logfile hvr.out has grown in size since the last time hvrmaint was run. If this file has not grown than an error message will be written.
Task group allows different hvrmaint tasks to share the same state. So a nightly task that processes log files and gives a warning if the latency is >1 hour can use the same 'offset state' as a task that runs during the day which gives a warning if latency is >1 minute.
Check for replication latencies and consider jobs over the limit erroneous. Value for dur can be specified in one of the following formats:
Milliseconds [.SSS] is ignored by this parameter.
Only check latencies of jobs in specified channel(s) chn.
Only check latencies of jobs in specified location(s) loc.
Stops HVR Scheduler.
Starts HVR Scheduler.
If jobs are still running when the HVR Scheduler must stop, allow seconds secs grace before killing them. The default is 60 seconds. This parameter is passed the HVR Scheduler using the -q option.
Move any files in directory $HVR_CONFIG/log/hub with pattern patt to the archive directory. Files which are not matched by patt are deleted.
Retain files in archive directory for N number of days. The retained files are deleted after N number of days. Requires option -archive_files. If this option is not specified, then archived files are kept indefinitely.
Compress HVR Scheduler log files while moving them to the archive directory. For a Windows hub, this option can only be used if command gzip has been installed.
Retain HVR journal files in directory $HVR_CONFIG/jnl for n number of days. The files are deleted after n number of days. These files are written by integrate jobs if parameter Integrate /JournalRouterFiles is defined.
Prints latency information and error summaries to hvrmaint output.
Email output from hvrmaint output to addr1 [and addr2]. Requires either option -smtp_server or option -mailer. Multiple email addresses can be specified, either using a single -email_to option with values separated by a semicolon or using multiple -email_to options.
Specify a sender address addr in email header.
Send an email if hvrmaint encountered an error itself or detected an HVR error while scanning hvr.out or the latency limit is exceeded.
Send an email if hvrmaint encountered an error itself or detected an HVR error or warning while scanning hvr.out or the latency limit is exceeded.
HVR errors reported is limited to N number. This option prevents the generated emails becoming too large. Default is 1000.
SMTP server to use when sending email. Value server can be either a node name or IP address. Requires option -email.
Username user for authentication SMTP server if needed.
Password pass used for authentication on the SMTP server if needed.
Mailer command to use for sending emails, instead of sending them via an SMTP server. Requires option -email. String %s contained in cmd is replaced by the email subject and string %a is replaced by the intended recipients of the email. The body of the email is piped to cmd as stdin. E.g. on Linux: -mailer=/bin/mail -s %s %a
A webhook for a Slack channel in company MyCorp looks like xxxx/yyyy.
To generate such a webhook, sign into Slack, then navigate to Apps ▶ Manage apps ▶ Custom Integrations ▶ Incoming WebHooks ▶ Add Configuration.
Hvrmaint will send the message to the specified slack channel chn. You can also send the message to a user (@username).
Send a slack message if hvrmaint encountered an error itself or detected an HVR error while scanning hvr.out or the latency limit is exceeded.
Send a slack message if hvrmaint encountered an error itself or detected an HVR error or warning while scanning hvr.out or the latency limit is exceeded.
Send SNMP v1 traps or v2c notifications. The -snmp_community option is required. See $HVR_HOME/lib/mibs/HVR-MIB.txt
Specify SNMP version. Value vers can be 1 or 2c (default).
Send a hvrMaintNotifySummary notification, even if there was nothing to report.
SNMP agent hostname host. Defaults to localhost.
SNMP agent trap port. Defaults to port 162.
Community string str for SNMPv1/v2c transactions.
hvrmaint is running but alerts are not generated. This can be useful during a maintenance window when channels are being modified or stopped. An alternative is to stop running hvrmaint during the maintenance window and restart it after, but this can generate a lot of alerts caused by the maintenance.
Hub database for HVR Scheduler. This value has form user/pwd (for an Oracle hub), inghub (for an Ingres hub database), or hub for a (SQL Server hub database). For Oracle, passwords can be encrypted using command hvrcrypt. In HVRGUI, this option is available inside the Text tab.
Extra startup parameters for the HVR Scheduler service. Possible examples are -uuser/pwd (for a username), -hsqlserver (for the hub class) or -cclus/clusgrp (for Windows cluster group). In HVRGUI, this option is available inside the Text tab.
Append hvrmaint output to file fil. If this option is not supplied, then output is sent to stdout. Output can also be sent to an operator using option -email. In HVRGUI, this option is available inside the Text tab.
Set environment variable. This option can be repeated to set multiple variables such as $HVR_HOME, $HVR_CONFIG, $HVR_TMP, $II_SYSTEM, $ORACLE_HOME etc. In HVRGUI, this option is available inside the Text tab.
- On Unix, hvrmaint could be scheduled to monitor the status of HVR every hour and also to restart the HVR Scheduler and rotate log files at 21:00 each Saturday. The environment for such batch programs is very limited, so many -env options are needed to pass it sufficient environment variables.
Two option files are prepared. The first option file /usr/hvr/hvr_config/files/hvrmaint_hourly.opt will just check for errors and contains the following:
The second option file /usr/hvr/hvr_config/files/hvrmaint_weekly.opt will restart the HVR Scheduler and rotate the log files each week.
The following lines are added to crontab for user hvr (these should be single lines without wrapping):
Alternatively the following line could be added to crontab for root:
Instead of scheduling hvrmaint on its own, it could also be used as part of a larger nightly batch script run by root which halts the HVR Scheduler and DBMS before doing a system backup. This batch script would roughly look like this:
- On Windows, hvrmaint can be run as a Windows Scheduled Task.
The configuration steps are as follows:
- Click Start ▶ Settings ▶ Control Panel ▶ Scheduled Tasks.
- Create a new Scheduled Task by clicking File ▶ New ▶ Scheduled Task.
- Double-click Add Scheduled Task.
On the Tasks tab enter the hvrmaint command line in the Run field, for example:
- On the Schedule tab, configure when the hvrmaint script should run.
- When ready click the OK button.
- A dialog now appears requesting Windows account information (username and passwords). Enter this information as requested.
A sample option file for hourly monitoring could be:
A sample option file for weekly restart of HVR on Windows would be:
HVR Scheduler log files.
Main Scheduler log file.
hvrmaint state file.
Archived Scheduler log file. These files are created if hvrmaint option -archive_files is defined and deleted again if option -archive_keep_days is defined.
Archived Scheduler log file if -archive_compress is defined.