VMware Cloud Community
BigBirdy
Contributor
Contributor

Init script to start hq-agent.sh? and server?

Is there an init script for RH/SUSE/CENTOS to have the agents or servers start automatically?

Thanka
0 Kudos
11 Replies
bmeshier
Contributor
Contributor

I'd be interested in this as well. Currently I'm using /etc/rc.d/rc.local

/bin/su - hyperic -c "/srv/hyperic/server-2.7.7/bin/hq-server.sh start"
0 Kudos
PaulPeterson
Contributor
Contributor

I wrote this awhile back. Should work in all RHEL and CENTOS environments.

-Paul



#!/bin/bash
#
# hq-agent - Starts the Hyperic agent.
#
# Author: Paul Peterson
#
# chkconfig: - 99 01
# description: Start the Hyperic agent
# processname: hq-agent


start(){
echo "Starting hq-agent.."
su -l hyperic -c '/etc/hyperic/agent-2.6.31/hq-agent.sh start'
}

stop(){
echo "Stopping hq-agent.."
su -l hyperic -c '/etc/hyperic/agent-2.6.31/hq-agent.sh stop'
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: hq-agent {start|stop|restart}"
exit 1
esac

exit 0




Brent Meshier wrote:
>
> I'd be interested in this as well. Currently I'm using
> /etc/rc.d/rc.local
>
> /bin/su - hyperic -c "/srv/hyperic/server-2.7.7/bin/hq-server.sh start"
>


0 Kudos
BradFelmey
Hot Shot
Hot Shot

If you're using v3.x and a system with SysV-style initscripts, the hq-agent.sh is already ready to go, and you just need to create some symlinks.

Suse Linux:

cd /etc/init.d
ln -s $PATH_TO_HQ_AGENT/hq-agent.sh hyperic
cd rc3.d
ln -s /etc/init.d/hyperic S99hyperic
ln -s /etc/init.d/hyperic K01hyperic
cd rc5.d
ln -s /etc/init.d/hyperic S99hyperic
ln -s /etc/init.d/hyperic K01hyperic

On AIX, of course the init.d is in /etc/rc.d/init.d, and the default runlevel is /etc/rc.d/rc2.d.

Season to taste.

I guess it's time now for me to submit a patch to the server part, as well.
0 Kudos
JohnMarkOrg
Hot Shot
Hot Shot

Hi Brad,

I thought of you when I saw this post. Thanks for your help.

Personally, I would just use my run-level editor in lieu of creating symlinks, but it's always good to know how to bypass that cruft 🙂

-JM
0 Kudos
jbaptiste_hyper
Contributor
Contributor

In RH like systems like RH, CentOS, Mandriva, etc, you can use the chkconfig command to update those links.

chkconfig --add hq-agent after you have copied the script to the /etc/init.d directory.
0 Kudos
dgorman_hyperic
Enthusiast
Enthusiast

For thos SuSE distro folks out there, put the same script in /etc/rc3.d
0 Kudos
thing2
Contributor
Contributor

for the agent is a start up script in my case,

/home/hyperic/agent-3.0.3/rcfiles

and it is called agent.rc

This needs to be edited.....cannot find one for the server though....
0 Kudos
pbrunnen
Contributor
Contributor

Hey there...
I have my path as /opt/hyperic-hq
Here is my startup script patch to make it SuSE compliant.
You will need to change the username and path variables for your setup.
Just search for my path to find the server path var.

Then make the needed links:
ln -s /opt/hyperic-hq/server-3.1.4/bin/hq-server.sh /etc/init.d/hq-server
ln -s /etc/init.d/hq-server /usr/sbin/rchq-server

Critical is that while the script format is systemV compatible, the server path var is dynamically read by the path of the scripts' execution. This when linked into init.d causes the script to fail. That is why you must hardcode the path into the script.

Enjoy!
- Cheers, Peter.
0 Kudos
mjpe
Contributor
Contributor

I use the init scripts from
http://www.merlinux.org/hyperic.php

works fine for agent and server on Centos 5. Just install the rpm packages and edit the conf files somwhere under /etc/sysconfig/

cheers
0 Kudos
pbruna_hyperic
Contributor
Contributor

Hi,
Im attaching my initscripts for Red Hat, CentOS, Fedora, etc.
You only have to change the lines that says HYPERIC_HOME to the place where Hyperic Server/Agent is installed and the HYPERIC_USER variable to the user who runs the process.

You copy the scripts to /etc/init.d and the you add the services to the system:
chkconfig --add hyperic-agent
chkconfig --add hyperic-server


and then enable the services
chkconfig hyperic-agent on
chkconfig hyperic-server on

By
0 Kudos
excowboy
Virtuoso
Virtuoso

Hi Patricio,

it would be great if you post your scripts on HyperForge !http://support.hyperic.com/confluence/display/hypcomm/Additional+Scripts
0 Kudos