/usr/local/bin/pdagent --help
A PagerDuty Agent and corresponding Command Line Interface.
The agent acts as a local server between your own infrastructure and PagerDuty,
providing command line tools to send PagerDuty events while ensuring event
ordering and mitigating backpressure.
On first run it's recommended you run "init" to generate a default
configuration, then run "server" to start the agent itself.
Usage:
pdagent [command]
Available Commands:
enqueue Queue up a trigger, acknowledge, or resolve v2 event to PagerDuty
help Help about any command
init Generate a new initial configuration file.
nagios Access the Nagios integration command(s).
queue Access the daemon's event queue.
send Queue up a trigger, acknowledge, or resolve a V1 event to PagerDuty
sensu Access the Sensu integration command(s).
server Start the server daemon.
version Version and build information.
zabbix Access the Zabbix integration command(s).
Flags:
-a, --address string address to run and access the agent server on. (default "127.0.0.1:49463")
--config string config file (default is $HOME/.go-pdagent.yaml)
-h, --help help for pdagent
--pidfile string pidfile for the currently running pdagent instance, if any. (default "/root/.pdagent/pidfile")
-s, --secret string secret used to authorize agent access. (default "wz22raz0ztxbkelwpro0ueg9t6xahcu2")
--version version for pdagent
cat /etc/systemd/system/multi-user.target.wants/pdagent.service
[Unit]
Description=PagerDuty Agent
After=network.target
[Service]
Type=simple
Environment=APP_ENV=production
ExecStart=/usr/local/bin/pdagent server
ExecStop=/usr/local/bin/pdagent server stop
KillMode=process
TimeoutStopSec=30
RestartSec=15
User=pdagent
Group=pdagent
PermissionsStartOnly=true
[Install]
WantedBy=multi-user.target
when triggered incident from icinga the debug logs :
cat /tmp//pd4icinga.log
2024-05-08 14:26:16,182 - __main__ - DEBUG - Just before subprocess.run
2024-05-08 14:26:16,183 - __main__ - DEBUG - Value of command: /usr/local/bin/pdagent.
2024-05-08 14:26:16,183 - __main__ - DEBUG - Value of arguments: -nservice-k$user.pager$-t$notification.type$-fSERVICEDESC=$service.name$-fSERVICEDISPLAYNAME=$service.display_name$-fHOSTNAME=$host.name$-fHOSTSTATE=$host.state$-fHOSTDISPLAYNAME=$host.display_name$-fSERVICESTATE=$service.state$-fSERVICEPROBLEMID=$service.state_id$-fSERVICEOUTPUT=$service.output$.
2024-05-08 14:26:16,190 - __main__ - DEBUG - Just after subprocess.run
from command line
sudo -u nagios pdagent enqueue -k "e6e4973984bb4606c0a2262bac1c760b" -t trigger -d "This is only a test" -u "https://events.pagerduty.com/integration/e6e4973984bb4606c0a2262bac1c760b/enqueue" -e "error" -f HOSTDISPLAYNAME=icinga01-mel.trellian.com
{"level":"info","ts":1715145828.157112,"logger":"Server","caller":"server/middleware.go:12","msg":"Handling request: /send"}
{"level":"info","ts":1715145828.1576862,"logger":"PersistentQueue","caller":"persistentqueue/enqueue.go:31","msg":"Enqueuing to e6e4973984bb4606c0a2262bac1c760b with key 7fcylvzqq8c80iky5gbhuwi4lzi484ua."}
{"level":"info","ts":1715145828.1649346,"logger":"PersistentQueue","caller":"persistentqueue/enqueue.go:37","msg":"Event enqueued with key 7fcylvzqq8c80iky5gbhuwi4lzi484ua, ID 3."}
{"level":"info","ts":1715145828.1649747,"logger":"PersistentQueue","caller":"persistentqueue/enqueue.go:50","msg":"Enqueuing 7fcylvzqq8c80iky5gbhuwi4lzi484ua with EventQueue."}
{"level":"info","ts":1715145828.1680493,"logger":"EventQueue.e6e4973984bb4606c0a2262bac1c760b","caller":"eventqueue/eventqueue.go:138","msg":"Worker started."}
{"level":"info","ts":1715145828.168147,"logger":"EventQueue.e6e4973984bb4606c0a2262bac1c760b","caller":"eventqueue/eventqueue.go:140","msg":"Job started, 0 pending."}
{"level":"info","ts":1715145829.0431778,"logger":"PersistentQueue","caller":"persistentqueue/enqueue.go:63","msg":"EventQueue returned success for 7fcylvzqq8c80iky5gbhuwi4lzi484ua. "}
{"level":"info","ts":1715145829.046886,"logger":"PersistentQueue","caller":"persistentqueue/enqueue.go:70","msg":"Set status of 7fcylvzqq8c80iky5gbhuwi4lzi484ua to success."}