vmware-archive / newrelic_pivotal_agent

MIT License
36 stars 42 forks source link

Error running it on Windows 2012 R2 64-bit server #53

Open sudarshanb opened 9 years ago

sudarshanb commented 9 years ago

Hi, I followed all the steps in the GitHub documentation. But when I am trying to run last command $ ./pivotal_agent, it gives me error saying that:

'pivotal_agent' is not recognized as an internal or external command, operable program or batch file.

I have tried with or without '.'

So, is this plugin supported on 64-bit windows? OR am i missing something?

Thanks for your help!

wjs-broadcom commented 9 years ago

I'm not aware of this ever being used on Windows. It is very possible that additional actions are going to be needed. You're welcome to submit a pull request with any updates on getting it running on windows. At this time, however, all I can say is that it has never been tested on windows.

Eric-Lemmon commented 9 years ago

We got the New Relic RabbitMQ plugin working on Windows 2012 R2 64-bit server with these steps.

c:
cd c:\Ruby22-x64\DevKit
ruby dk.rb init
- C:\Ruby22-x64
ruby dk.rb install
gem install bundler
newrelic_pivotal_agent-pivotal_agent-1.0.5\config\template_newrelic_plugin.yml
bundle install
    Process _process = null;

    protected override void OnStart(string[] args)
    {
        var rubyExePath = ConfigurationManager.AppSettings["RubyExePath"];
        var pivotalAgentPath = ConfigurationManager.AppSettings["PivotalAgentPath"];
        var sslCertFilePath = ConfigurationManager.AppSettings["SslCertFilePath"];

        if (string.IsNullOrWhiteSpace(rubyExePath) || 
            string.IsNullOrWhiteSpace(pivotalAgentPath) || 
            string.IsNullOrWhiteSpace(sslCertFilePath))
            throw new ConfigurationErrorsException("AppSettings RubyExePath, PivotalAgentPath, and/or SslCertFilePath are missing.");

        try
        {
            // Ruby doesn't know about SSL CAs, so reference (for only current process) the CA certs file.
            Environment.SetEnvironmentVariable("SSL_CERT_FILE", sslCertFilePath);

            // Start the Pivotal agent, keeping a reference to it, so it can be stopped easily.
            _process = Process.Start(rubyExePath, pivotalAgentPath);
        }
        catch (Exception ex)
        {
            var appLog = new EventLog();
            appLog.Source = "NewRelicRabbitMQAgent";
            appLog.WriteEntry(string.Format("Error starting ruby process.\r\n{0}", ex.ToString()));
            throw;
        }
    }

    protected override void OnStop()
    {
        try
        {
            _process.Kill();
            _process.Dispose();
        }
        catch(Exception ex)
        {
            var appLog = new EventLog();
            appLog.Source = "NewRelicRabbitMQAgent";
            appLog.WriteEntry(string.Format("Error stopping service.\r\n{0}", ex.ToString()));
        }
    }
sc create "New Relic RabbitMQ Agent" binPath= "c:\{YOUR PATH}\newrelic-rabbitmq-agent-1.0.5\WindowsService\NewRelicRabbitMQAgent.exe"
sc description "New Relic RabbitMQ Agent" "Sends RabbitMQ statistics from the RMQ API to New Relic for reporting and alerting"
sc config "New Relic RabbitMQ Agent" start=auto
sc failure "New Relic RabbitMQ Agent"  actions= restart/180000/restart/180000/restart/180000 reset= 0
net start "New Relic RabbitMQ Agent"