Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegraf install logic does not support new Amazon Linux 2 operating system #5117

Closed
jdonboch opened this issue Dec 5, 2018 · 2 comments · Fixed by #5387
Closed

Telegraf install logic does not support new Amazon Linux 2 operating system #5117

jdonboch opened this issue Dec 5, 2018 · 2 comments · Fixed by #5387
Labels
area/packaging bug unexpected problem or unintended behavior
Milestone

Comments

@jdonboch
Copy link

jdonboch commented Dec 5, 2018

System info:

Telegraf agent 1.8.2
amzn2-ami-hvm-2.0.20181114-x86_64-gp2 (ami-009d6802948d06e52)
us-east-1 region of AWS

Steps to reproduce:

On Amazon Linux 2 OS:

$ yum -y localinstall /tmp/telegraf-agent.rpm
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Examining /tmp/telegraf-agent.rpm: telegraf-1.8.2-1.x86_64
Marking /tmp/telegraf-agent.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package telegraf.x86_64 0:1.8.2-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================
Package Arch Version Repository Size

Installing:
telegraf x86_64 1.8.2-1 /telegraf-agent 46 M

Transaction Summary

Install 1 Package

Total size: 46 M
Installed size: 46 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : telegraf-1.8.2-1.x86_64 1/1
Verifying : telegraf-1.8.2-1.x86_64 1/1

Installed:
telegraf.x86_64 0:1.8.2-1

Complete!

...
Populate files such as
/etc/default/telegraf
/etc/telegraf/telegraf.conf
...

$ telegraf --version
Telegraf 1.8.2 (git: HEAD 996a91f)
$ service telegraf status
telegraf Process is running [ OK ]
$ ps -ef | grep telegraf
telegraf 821 1 0 19:46 ? 00:00:00 /usr/bin/telegraf -pidfile /var/run/telegraf/telegraf.pid -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d
root 924 646 0 19:47 pts/0 00:00:00 grep --color=auto telegraf
$ systemctl status telegraf
● telegraf.service - LSB: Start telegraf at boot time
Loaded: loaded (/etc/rc.d/init.d/telegraf; bad; vendor preset: disabled)
Active: inactive (dead)
Docs: man:systemd-sysv-generator(8)
$ systemctl restart telegraf
$ systemctl status telegraf
● telegraf.service - LSB: Start telegraf at boot time
Loaded: loaded (/etc/rc.d/init.d/telegraf; bad; vendor preset: disabled)
Active: active (exited) since Wed 2018-12-05 19:47:50 UTC; 5s ago
Docs: man:systemd-sysv-generator(8)
Process: 966 ExecStart=/etc/rc.d/init.d/telegraf start (code=exited, status=0/SUCCESS)

Dec 05 19:47:50 i-0b8de5454928d.awsdev.inforcloud.local systemd[1]: Starting LSB: Start telegraf at boot time...
Dec 05 19:47:50 i-0b8de5454928d.awsdev.inforcloud.local telegraf[966]: telegraf process is running [ FAILED ]
Dec 05 19:47:50 i-0b8de5454928d.awsdev.inforcloud.local systemd[1]: Started LSB: Start telegraf at boot time.
$ service telegraf status
telegraf Process is running [ OK ]

Expected behavior:

Expected systemctl to be able to recognize that the service is running.

Actual behavior:

systemctl thinks service is not active and the agent must be restarted via systemctl.

Additional info:

This file may need to be updated to handle Amazon Linux 2:
https://github.com/influxdata/telegraf/blob/master/scripts/post-install.sh#L89

@glinton glinton added the bug unexpected problem or unintended behavior label Dec 6, 2018
@glinton
Copy link
Contributor

glinton commented Dec 6, 2018

@jdonboch if you've got time, feel free to open a pr for this. Thanks for pointing this out

@jpackagejasonc
Copy link

simplest solution is probably:

elif [[ -f /etc/os-release ]]; then
    source /etc/os-release
    if [[ $ID = "amzn" ]]; then
        if [[ $VERSION = "2" ]]; then
            install_systemd /lib/systemd/system/telegraf.service
        else
            # Amazon Linux logic
            install_init
            # Run update-rc.d or fallback to chkconfig if not available
            if which update-rc.d &>/dev/null; then
                install_update_rcd
            else
                install_chkconfig
            fi
        fi
    fi
fi

@danielnelson danielnelson added this to the 1.10.0 milestone Feb 7, 2019
@danielnelson danielnelson modified the milestones: 1.10.0, 1.9.5 Feb 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/packaging bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants